/* ═══════════════════════════════════════════════════════════════
   CANONICAL ASSET PATH — public/css/theme.css
   ───────────────────────────────────────────────────────────────
   This file IS the served file. The Blade layouts load it via
   `asset('css/theme.css')` which resolves to /public/css/theme.css.
   There is no build step. Edit this file directly. Do NOT recreate
   resources/css/ or resources/js/ — those are deleted on purpose.
   See docs/diagnostics/Tint_Diagnostic_2026_05_10.md for context.
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   THEME SYSTEM — theme.css
   ───────────────────────────────────────────────────────────────
   Single file for ALL colors, fonts, spacing, radii, shadows.
   Change values here → entire platform updates instantly.

   RULES:
   - Never put colors/fonts/spacing in other CSS files
   - Always reference these variables: var(--variable-name)
   - Two theme blocks: [data-theme="light"] and [data-theme="dark"]
   - User preference stored in cookie (works across sessions)
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ══════════════════════════════════════
     BRAND COLORS
     Your company's core identity colors.
     ══════════════════════════════════════ */
  --brand-primary: #1e3a5f;           /* Dark navy — sidebar, headings */
  --brand-primary-light: #2a5a8f;     /* Medium navy — hover states */
  --brand-primary-lighter: #3a7bc8;   /* Bright blue — links, active */
  --brand-accent: #e8772233;          /* Orange with transparency — badges bg */
  --brand-accent-solid: #e87722;      /* Orange solid — accent buttons, highlights */

  /* ══════════════════════════════════════
     SEMANTIC COLORS
     Meaning-based colors used across all modules.
     Each has a solid color + a soft background.
     ══════════════════════════════════════ */
  --color-success: #22c55e;
  --color-success-bg: #f0fdf4;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-info: #3b82f6;
  --color-info-bg: #eff6ff;
  --color-purple: #8b5cf6;
  --color-purple-bg: #f3e8ff;

  /* ══════════════════════════════════════
     TYPOGRAPHY
     Two font families only:
     - DM Sans: everything (body, headings, UI)
     - JetBrains Mono: numbers, code, timestamps
     ══════════════════════════════════════ */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Font sizes — use these names, never raw px/rem */
  --fs-xs: 0.7rem;      /* 11.2px — tiny labels, timestamps */
  --fs-sm: 0.8rem;      /* 12.8px — secondary text, metadata */
  --fs-base: 0.875rem;  /* 14px — body text, nav items */
  --fs-lg: 1rem;        /* 16px — card titles, emphasis */
  --fs-xl: 1.25rem;     /* 20px — section headings */
  --fs-2xl: 1.5rem;     /* 24px — page titles */
  --fs-3xl: 1.875rem;   /* 30px — dashboard greeting */

  /* ══════════════════════════════════════
     SPACING SCALE
     Consistent spacing across entire platform.
     Use these instead of random pixel values.
     ══════════════════════════════════════ */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* ══════════════════════════════════════
     BORDER RADIUS
     Rounded corners — consistent everywhere.
     ══════════════════════════════════════ */
  --r-sm: 6px;     /* Small elements: buttons, badges */
  --r-md: 10px;    /* Medium: inputs, dropdowns */
  --r-lg: 14px;    /* Large: cards, modals */
  --r-xl: 20px;    /* Extra large: panels, sheets */
  --r-full: 9999px; /* Pill shape: pills, avatars */

  /* ══════════════════════════════════════
     LAYOUT DIMENSIONS
     Fixed sizes for structural elements.
     ══════════════════════════════════════ */
  --sidebar-w: 220px;       /* Sidebar width (desktop) */
  --sidebar-w-collapsed: 60px; /* Sidebar width (collapsed) */
  --topbar-h: 52px;         /* Top bar height */
  --content-max-w: 1400px;  /* Max content width */

  /* ══════════════════════════════════════
     Z-INDEX LAYERS
     Predictable stacking across the app.
     ══════════════════════════════════════ */
  --z-base: 1;
  --z-dropdown: 50;
  --z-topbar: 60;
  --z-sidebar: 100;
  --z-modal-overlay: 150;
  --z-modal: 200;
  --z-toast: 300;
  --z-tooltip: 400;
}


/* ════════════════════════════════════════════════════════════════
   LIGHT THEME
   Default theme. Clean whites and subtle grays.
   ════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  /* Backgrounds */
  --bg-body: #f5f6f8;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f8f9fb;
  --bg-surface-active: #f0f1f3;
  --bg-sidebar: var(--brand-primary);
  --bg-sidebar-hover: var(--brand-primary-light);
  --bg-sidebar-active: var(--brand-primary-light);
  --bg-topbar: #ffffff;
  --bg-input: #f5f6f8;
  --bg-input-focus: #ffffff;
  --bg-badge: #eef1f5;
  --bg-overlay: rgba(0, 0, 0, 0.4);
  --bg-tooltip: #1a1d23;

  /* Text */
  --text-primary: #1a1d23;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-placeholder: #b0b5be;
  --text-sidebar: rgba(255, 255, 255, 0.65);
  --text-sidebar-active: #ffffff;
  --text-on-primary: #ffffff;
  --text-on-tooltip: #ffffff;
  --text-link: var(--brand-primary-lighter);

  /* Borders */
  --border-color: #e5e7eb;
  --border-light: #f0f1f3;
  --border-focus: var(--brand-primary-lighter);

  /* Shadows */
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 2px 8px rgba(0, 0, 0, 0.07);
  --dropdown-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  --modal-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  --focus-ring: 0 0 0 3px rgba(58, 123, 200, 0.15);

  /* View-tier preview tints + preview-banner tokens were removed in
     Prompt 3 along with the tier-switcher UI. The "Superuser is
     read-only on operational data" rule still stands. */
}


/* ════════════════════════════════════════════════════════════════
   DARK THEME
   Easy on the eyes for late-night work.
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* Backgrounds */
  --bg-body: #0f1117;
  --bg-surface: #1a1d27;
  --bg-surface-hover: #22252f;
  --bg-surface-active: #2a2d37;
  --bg-sidebar: #13151d;
  --bg-sidebar-hover: #1e2130;
  --bg-sidebar-active: #1e2130;
  --bg-topbar: #1a1d27;
  --bg-input: #22252f;
  --bg-input-focus: #2a2d37;
  --bg-badge: #2a2d37;
  --bg-overlay: rgba(0, 0, 0, 0.6);
  --bg-tooltip: #2a2d37;

  /* Text */
  --text-primary: #f0f1f3;
  --text-secondary: #9ca3af;
  --text-tertiary: #6b7280;
  --text-placeholder: #4b5563;
  --text-sidebar: rgba(255, 255, 255, 0.45);
  --text-sidebar-active: #ffffff;
  --text-on-primary: #ffffff;
  --text-on-tooltip: #f0f1f3;
  --text-link: #60a5fa;

  /* Borders */
  --border-color: #2a2d37;
  --border-light: #22252f;
  --border-focus: #60a5fa;

  /* Shadows */
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
  --dropdown-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  --modal-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.2);

  /* Semantic background overrides for dark */
  --color-success-bg: #0a2615;
  --color-warning-bg: #261a05;
  --color-danger-bg: #260a0a;
  --color-info-bg: #0a1526;
  --color-purple-bg: #1a0a2e;

  /* Tier-switcher dark-variant tokens removed in Prompt 3. */
}


/* ════════════════════════════════════════════════════════════════
   TIER-GATED ACTION (simplified in Prompt 3 — was Model C Section 6)
   The tier-switcher itself was torn out. <x-tier-gated-action> now
   renders just a disabled hint button when canActOperationally is
   false. The preview-banner, body tints, topbar-tier-switcher, and
   __form / __exit styles all went with it.
   ════════════════════════════════════════════════════════════════ */
.tier-gated-action {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.tier-gated-action__btn {
    background: var(--bg-surface-active);
    color: var(--text-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--r-sm);
    padding: 6px 12px;
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: not-allowed;
    opacity: 0.65;
}


/* ════════════════════════════════════════════════════════════════
   MODULE ADMIN BUTTON (Chat 10 — Decision #52)
   Lives in topbar-right; renders only when current user has admin
   access on $currentModule.
   ════════════════════════════════════════════════════════════════ */
.module-admin-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--r-md);
    background: #f59e0b;
    color: #ffffff;
    font-size: var(--fs-sm);
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}
.module-admin-button:hover,
.module-admin-button:focus {
    background: #d97706;
    color: #ffffff;
    text-decoration: none;
}
.module-admin-button svg { flex-shrink: 0; }


/* ════════════════════════════════════════════════════════════════
   ADMIN LANDING GRID (Module 3 admin index; reusable)
   ════════════════════════════════════════════════════════════════ */
.admin-landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-4);
}
.admin-landing-card {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    padding: var(--sp-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md);
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-landing-card:hover,
.admin-landing-card:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
}
.admin-landing-card__title {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text-primary);
}
.admin-landing-card__count {
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--brand-primary);
}
.admin-landing-card__sub {
    font-size: var(--fs-xs);
    color: var(--text-tertiary);
}


/* ════════════════════════════════════════════════════════════════
   PROJECT DETAIL — phase pill, panels, members table
   ════════════════════════════════════════════════════════════════ */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 600;
    background: var(--bg-surface-active);
    color: var(--text-secondary);
    margin-right: 4px;
}
.pill-phase { text-transform: uppercase; letter-spacing: 0.04em; }
.pill-phase-bidding   { background: #fef3c7; color: #92400e; }
.pill-phase-awarded   { background: #fed7aa; color: #9a3412; }
.pill-phase-active    { background: #d1fae5; color: #065f46; }
.pill-phase-closed    { background: #fee2e2; color: #991b1b; }
.pill-phase-completed { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .pill-phase-bidding   { background: #4a3508; color: #fef3c7; }
[data-theme="dark"] .pill-phase-awarded   { background: #5b2c08; color: #fed7aa; }
[data-theme="dark"] .pill-phase-active    { background: #064e3b; color: #d1fae5; }
[data-theme="dark"] .pill-phase-closed    { background: #5b1717; color: #fee2e2; }
[data-theme="dark"] .pill-phase-completed { background: #1e3a8a; color: #dbeafe; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--sp-4);
    margin-top: var(--sp-4);
}
.detail-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--r-md);
    padding: var(--sp-4);
}
.detail-panel__title {
    font-size: var(--fs-md);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--sp-3) 0;
    padding-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border-light);
}
.detail-panel__placeholder {
    color: var(--text-tertiary);
    font-size: var(--fs-sm);
    font-style: italic;
    padding: var(--sp-3) 0;
}
.detail-panel__row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: var(--sp-1) 0;
    font-size: var(--fs-sm);
}
.detail-panel__row .label { color: var(--text-secondary); }
.detail-panel__row .value { color: var(--text-primary); font-weight: 500; }

.members-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.members-table th, .members-table td {
    text-align: left;
    padding: var(--sp-2) var(--sp-3);
    border-bottom: 1px solid var(--border-light);
}
.members-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.members-table tr:last-child td { border-bottom: none; }
.member-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-surface-active);
    color: var(--text-secondary);
    font-size: var(--fs-xs);
    font-weight: 500;
}


/* ════════════════════════════════════════════════════════════════
   TEMPLATE PARTS (admin templates create/edit form)
   ════════════════════════════════════════════════════════════════ */
.template-part {
    border: 1px solid var(--border-color);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-3);
    background: var(--bg-surface);
}
.template-part__header {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    cursor: pointer;
    user-select: none;
}
.template-part__title { font-weight: 600; color: var(--text-primary); }
.template-part__hint { font-size: var(--fs-xs); color: var(--text-tertiary); margin-left: auto; }
.template-part__body {
    padding: var(--sp-4);
    border-top: 1px solid var(--border-light);
    display: none;
}
.template-part.is-active .template-part__body { display: block; }
.template-part--disabled { opacity: 0.55; pointer-events: none; }
