/* ============================================================
   LAWYA DESIGN SYSTEM — Plain CSS, zero build tools
   Per CLAUDE.md §4: Monochrome Precision
   ============================================================ */

/* Variables */
:root {
  --black: #0A0A0A;
  --white: #FFFFFF;
  --grey-100: #F5F5F5;
  --grey-200: #E8E8E8;
  --grey-300: #D0D0D0;
  --grey-400: #A0A0A0;
  --grey-600: #606060;
  --grey-800: #2A2A2A;
  --grey-900: #1A1A1A;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: var(--font-body); color: var(--black); background: var(--grey-100); }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); }
input, textarea, select { font-family: var(--font-body); }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); color: var(--grey-800); }

/* Typography */
.font-display, .font-heading { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }
.text-xs { font-size: 11px; line-height: 1.4; }
.text-sm { font-size: 13px; line-height: 1.5; }
.text-base { font-size: 15px; line-height: 1.5; }
.text-lg { font-size: 18px; line-height: 1.4; }
.text-xl { font-size: 22px; line-height: 1.3; }
.text-2xl { font-size: 28px; line-height: 1.2; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.text-black { color: var(--black); }
.text-white { color: var(--white); }
.text-grey-400 { color: var(--grey-400); }
.text-grey-600 { color: var(--grey-600); }
.text-grey-800 { color: var(--grey-800); }
.italic { font-style: italic; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-through { text-decoration: line-through; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Layout */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.flex-shrink-0, .shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-around { justify-content: space-around; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-5 { gap: 20px; }
.gap-6 { gap: 24px; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.col-span-2 { grid-column: span 2; }
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* Sizing */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-5 { width: 20px; }
.w-10 { width: 40px; }
.w-16 { width: 64px; }
.w-\[280px\] { width: 280px; }
.h-full { height: 100%; }
.h-5 { height: 20px; }
.h-10 { height: 40px; }
.h-16 { height: 64px; }
.h-screen { height: 100vh; }
.min-w-0 { min-width: 0; }
.min-h-screen { min-height: 100vh; }
.max-w-sm { max-width: 380px; }
.max-w-md { max-width: 480px; }
.max-w-lg { max-width: 560px; }

/* Spacing — padding */
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.px-5 { padding-left: 20px; padding-right: 20px; }
.px-6 { padding-left: 24px; padding-right: 24px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.py-1\.5 { padding-top: 6px; padding-bottom: 6px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 12px; padding-bottom: 12px; }
.py-4 { padding-top: 16px; padding-bottom: 16px; }
.pt-4 { padding-top: 16px; }
.pb-4 { padding-bottom: 16px; }
.pb-6 { padding-bottom: 24px; }

/* Spacing — margin */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.ml-3 { margin-left: 12px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.-translate-y-1\/2 { transform: translateY(-50%); }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.top-1\/2 { top: 50%; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.left-full { left: 100%; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }
.z-9999 { z-index: 9999; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-hidden { overflow-x: hidden; }

/* Border */
.border { border: 1px solid var(--grey-200); }
.border-t { border-top: 1px solid var(--grey-200); }
.border-b { border-bottom: 1px solid var(--grey-200); }
.border-l { border-left: 1px solid var(--grey-200); }
.border-black { border-color: var(--black); }
.border-2 { border-width: 2px; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

/* Background */
.bg-black { background-color: var(--black); }
.bg-white { background-color: var(--white); }
.bg-grey-100 { background-color: var(--grey-100); }
.bg-grey-200 { background-color: var(--grey-200); }
.bg-grey-900 { background-color: var(--grey-900); }

/* Shadow */
.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Opacity / Pointer */
.opacity-50 { opacity: 0.5; }
.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }
.select-none { user-select: none; }

/* Transition */
.transition { transition: all 0.15s ease; }
.transition-all { transition: all 0.15s ease; }
.transition-colors { transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease; }
.duration-200 { transition-duration: 200ms; }
.duration-150 { transition-duration: 150ms; }

/* Whitespace */
.whitespace-nowrap { white-space: nowrap; }

/* ============================================================
   LAWYA COMPONENT STYLES
   ============================================================ */

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius); font-size: 14px; font-weight: 500; font-family: var(--font-body); cursor: pointer; transition: all 0.15s ease; white-space: nowrap; }
.btn-primary { background: var(--black); color: var(--white); border: 1px solid var(--black); }
.btn-primary:hover { background: var(--grey-900); }
.btn-secondary { background: var(--white); color: var(--black); border: 1px solid var(--grey-300); }
.btn-secondary:hover { border-color: var(--black); }
.btn-ghost { background: transparent; color: var(--grey-600); border: 1px solid transparent; }
.btn-ghost:hover { color: var(--black); border-color: var(--grey-200); }
.btn-danger { background: var(--white); color: #CC0000; border: 1px solid #CC0000; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 28px; font-size: 15px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; pointer-events: none; }

/* Form inputs */
.input { width: 100%; padding: 10px 14px; background: var(--white); border: 1px solid var(--grey-300); border-radius: var(--radius); font-size: 14px; font-family: var(--font-body); color: var(--black); transition: border-color 0.15s; outline: none; }
.input:focus { border-color: var(--black); }
.input::placeholder { color: var(--grey-400); }
.input-error { border-color: #CC0000; }
.label { display: block; font-size: 12px; font-weight: 500; color: var(--grey-600); margin-bottom: 6px; }
.error-text { font-size: 12px; color: #CC0000; margin-top: 4px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23606060' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-lg); padding: 24px; }
.card-sm { padding: 16px; }
.stat-card { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-lg); padding: 20px 24px; }
.stat-card.dark { background: var(--black); border-color: var(--black); color: var(--white); }
.stat-number { font-family: var(--font-display); font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--grey-400); margin-top: 4px; }
.stat-card.dark .stat-label { color: rgba(255,255,255,0.5); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge-default { background: var(--grey-200); color: var(--grey-800); }
.badge-active { background: var(--black); color: var(--white); }
.badge-pending { background: var(--grey-100); color: var(--grey-600); border: 1px solid var(--grey-300); }
.badge-success { background: var(--black); color: var(--white); }
.badge-danger { background: var(--white); color: #CC0000; border: 1px solid #CC0000; }
.badge-ai { background: var(--grey-900); color: var(--white); font-size: 10px; }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--grey-200); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: var(--grey-800); flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--grey-400); padding: 8px 16px; border-bottom: 1px solid var(--grey-200); text-transform: uppercase; letter-spacing: 0.05em; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--grey-100); color: var(--grey-800); }
.table tr:hover td { background: var(--grey-100); }
.table tr:last-child td { border-bottom: none; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--grey-200); gap: 0; }
.tab { padding: 12px 20px; font-size: 13px; font-weight: 500; color: var(--grey-400); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; }
.tab:hover { color: var(--black); }
.tab.active { color: var(--black); border-bottom-color: var(--black); }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal { background: var(--white); border-radius: 16px; padding: 32px; width: 100%; max-width: 520px; box-shadow: 0 24px 80px rgba(0,0,0,0.2); position: relative; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: var(--grey-100); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--grey-600); }
.modal-close:hover { background: var(--grey-200); }

/* Sidebar */
.sidebar { width: 64px; background: var(--black); height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 16px 0; position: fixed; left: 0; top: 0; z-index: 100; }
.sidebar-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--grey-400); cursor: pointer; transition: all 0.15s; position: relative; }
.sidebar-icon:hover { background: var(--grey-900); color: var(--white); }
.sidebar-icon.active { background: var(--white); color: var(--black); }
.sidebar-icon .tooltip { position: absolute; left: calc(100% + 12px); background: var(--white); color: var(--black); padding: 6px 12px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; box-shadow: var(--shadow); }
.sidebar-icon:hover .tooltip { opacity: 1; }

/* Right panel */
.right-panel { width: 280px; background: var(--white); border-left: 1px solid var(--grey-200); height: 100vh; position: fixed; right: 0; top: 0; padding: 24px; overflow-y: auto; }

/* Main content */
.main-content { margin-left: 64px; margin-right: 280px; min-height: 100vh; padding: 32px; }

/* Divider */
.divider { height: 1px; background: var(--grey-200); width: 100%; }

/* Empty state */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 32px; text-align: center; }
.empty-state-icon { width: 56px; height: 56px; background: var(--grey-100); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; color: var(--grey-400); }
.empty-state-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.empty-state-text { font-size: 14px; color: var(--grey-400); max-width: 300px; }

/* Loading spinner */
.spinner { width: 20px; height: 20px; border: 2px solid var(--grey-200); border-top-color: var(--black); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress bar */
.progress-bar { width: 100%; height: 4px; background: var(--grey-200); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--black); border-radius: var(--radius-full); transition: width 0.3s ease; }

/* Risk indicator */
.risk-bar { height: 4px; border-radius: var(--radius-full); background: var(--grey-200); overflow: hidden; }
.risk-fill-low { background: var(--grey-300); }
.risk-fill-medium { background: var(--grey-600); }
.risk-fill-high { background: var(--grey-900); }
.risk-fill-critical { background: var(--black); }

/* Chat bubbles */
.bubble { max-width: 75%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; }
.bubble-inbound { background: var(--grey-100); color: var(--black); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble-outbound { background: var(--black); color: var(--white); border-bottom-right-radius: 4px; align-self: flex-end; }

/* Pulse animation */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.pulse { animation: pulse 3s ease-in-out infinite; }

/* Page header */
.page-header { margin-bottom: 32px; }
.page-title { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--black); }
.page-subtitle { font-size: 14px; color: var(--grey-400); margin-top: 4px; }
.breadcrumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--grey-400); margin-bottom: 8px; }
.breadcrumbs span { color: var(--grey-300); }

/* Alpine.js cloak */
[x-cloak] { display: none !important; }

/* ============================================================
   LAWYA MOBILE & PLATFORM-SPECIFIC STYLES
   Per CLAUDE.md §18: Full mobile feature parity. Breakpoint: 768px
   ============================================================ */

/* Sidebar: strict width, no drag/resize */
.lawya-sidebar-desktop {
    flex-shrink: 0;
    flex-grow: 0;
    overflow: hidden;
    resize: none;
    user-select: none;
    -webkit-user-select: none;
    background-color: var(--black);
}

/* Hide desktop sidebar on mobile */
@media (max-width: 767px) {
    .lawya-sidebar-desktop {
        display: none !important;
    }
    .lawya-right-panel-desktop {
        display: none !important;
    }
    .lawya-main-content {
        padding: 16px 12px 80px 12px !important;
    }
}

/* Hide mobile nav on desktop */
@media (min-width: 768px) {
    .lawya-mobile-nav {
        display: none !important;
    }
    .lawya-mobile-quick-capture-fab {
        display: none !important;
    }
}

/* ── Mobile bottom tab bar ──────────────────────────────────────────────── */
.lawya-mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9990;
    height: 64px;
    background-color: var(--black);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.lawya-mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    color: var(--grey-400);
    text-decoration: none;
    font-size: 9px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.lawya-mobile-nav-item.active {
    color: var(--white);
}

.lawya-mobile-nav-item svg {
    width: 22px;
    height: 22px;
}

/* ── More slide-up menu ─────────────────────────────────────────────────── */
.lawya-more-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9991;
    background: rgba(10, 10, 10, 0.5);
}

.lawya-more-menu {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9992;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
    max-height: 70vh;
    overflow-y: auto;
}

.lawya-more-menu-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--grey-300);
    margin: 0 auto 12px;
}

.lawya-more-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 8px;
    border-radius: 10px;
    color: var(--grey-800);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    transition: background-color 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.lawya-more-menu-item:active {
    background-color: var(--grey-100);
}

.lawya-more-menu-item svg {
    width: 20px;
    height: 20px;
    color: var(--grey-400);
    flex-shrink: 0;
}

/* ── Mobile matter cards (swipe) ────────────────────────────────────────── */
.lawya-mobile-matter-card {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin-bottom: 8px;
    background: var(--white);
    border: 1px solid var(--grey-200);
    touch-action: pan-y;
}

.lawya-mobile-matter-card-inner {
    position: relative;
    z-index: 1;
    padding: 14px 16px;
    background: var(--white);
    transition: transform 0.2s ease;
}

.lawya-mobile-matter-card-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    z-index: 0;
}

.lawya-mobile-matter-card-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    border: none;
    font-size: 10px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    flex-direction: column;
    gap: 2px;
}

/* ── Mobile Quick Capture FAB ───────────────────────────────────────────── */
.lawya-mobile-quick-capture-fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 9989;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--black);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    -webkit-tap-highlight-color: transparent;
}

/* ── Quick Capture bottom sheet ─────────────────────────────────────────── */
.lawya-quick-capture-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9993;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    padding: 12px 16px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
}

/* ── Argü mobile full-screen ────────────────────────────────────────────── */
@media (max-width: 767px) {
    .arguo-mobile-fullscreen {
        position: fixed !important;
        inset: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
        z-index: 9999 !important;
    }
    .arguo-mobile-fullscreen > div {
        width: 100% !important;
        height: 100% !important;
        border-radius: 0 !important;
    }
}
