/* ═══════════════════════════════════════════════════════════
   Queen Filter Dashboard — CSS
   Based on Brandbook: Deep Black-Plum + Champagne accents
   Glassmorphism UI, Cormorant Garamond + Inter fonts
   Mobile-first responsive
   ═══════════════════════════════════════════════════════════ */

/* Reset & Variables */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #0d0c11;
    --bg-panel: #16131c;
    --bg-lighter: #221c29;

    --plum: #3a1a2b;
    --burgundy: #52162a;

    --champagne: #e8d5be;
    --champagne-muted: #bdae9c;

    --text-main: #f5f0ef;
    --text-muted: #aba3a6;

    --glass-bg: rgba(28, 24, 35, 0.65);
    --glass-border: rgba(232, 213, 190, 0.1);
    --glass-border-hover: rgba(232, 213, 190, 0.25);

    --red: #ff5f56;
    --yellow: #ffbd2e;
    --green: #27c93f;

    --radius: 12px;
    --radius-lg: 16px;
    --transition: cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 500;
    color: var(--text-main);
}

a {
    color: var(--champagne);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--text-main);
}

/* Glass */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: border-color 0.4s var(--transition);
}

.glass:hover {
    border-color: var(--glass-border-hover);
}

/* Layout */
.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.main {
    flex: 1;
    padding: 100px 0 60px;
}

/* ═══════ Header ═══════ */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(13, 12, 17, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 0 20px;
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--champagne);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--text-main);
    background: var(--bg-lighter);
}

.nav-link.active {
    color: var(--champagne);
    background: rgba(232, 213, 190, 0.08);
}

.nav-link--muted {
    color: #666;
}

/* ═══════ Footer ═══════ */
.footer {
    padding: 24px 20px;
    border-top: 1px solid var(--glass-border);
    text-align: center;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-brand {
    font-family: 'Cormorant Garamond', serif;
    color: var(--champagne-muted);
    font-size: 0.9rem;
}

.footer-muted {
    color: #555;
    font-size: 0.8rem;
}

/* ═══════ Login ═══════ */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    max-width: 420px;
    width: 100%;
    padding: 48px 40px;
    text-align: center;
}

.login-brand {
    margin-bottom: 40px;
}

.login-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.login-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    background: linear-gradient(135deg, #ffffff, var(--champagne));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.login-widget {
    margin: 32px 0;
    display: flex;
    justify-content: center;
}

.login-note {
    color: #666;
    font-size: 0.8rem;
    margin-top: 24px;
}

/* ═══════ Dashboard ═══════ */
.page-title {
    font-size: 2rem;
    margin-bottom: 4px;
    color: var(--text-main);
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.dashboard-stats {
    display: flex;
    gap: 24px;
    padding: 16px 24px;
}

.stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--champagne);
}

.stat-red {
    color: var(--red);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tier badges */
.tier-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-free {
    background: rgba(171, 163, 166, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(171, 163, 166, 0.2);
}

.tier-smart {
    background: rgba(232, 213, 190, 0.12);
    color: var(--champagne);
    border: 1px solid rgba(232, 213, 190, 0.25);
}

.tier-premium {
    background: rgba(232, 213, 190, 0.2);
    color: var(--champagne);
    border: 1px solid var(--champagne);
}

/* Email badge */
.email-badge {
    font-size: 0.85rem;
}

.email-badge.verified {
    color: var(--green);
}

/* ═══════ Filters ═══════ */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    border-color: var(--glass-border-hover);
    color: var(--text-main);
}

.filter-btn.active {
    color: var(--champagne);
    border-color: var(--champagne);
    background: rgba(232, 213, 190, 0.08);
}

/* ═══════ Case Cards ═══════ */
.case-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.case-card {
    display: block;
    padding: 20px 24px;
    transition: all 0.4s var(--transition);
}

.case-card:hover {
    transform: translateY(-2px);
    border-color: var(--glass-border-hover);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.case-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.case-flag {
    font-size: 1.2rem;
}

.case-name {
    font-family: 'Inter', sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text-main);
}

.case-nickname {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: auto;
}

.case-card-body {
    display: flex;
    gap: 12px;
    margin-left: 36px;
}

.case-platform, .case-stage {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-lighter);
}

.case-card-footer {
    margin-top: 12px;
    margin-left: 36px;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.case-verdict {
    font-size: 0.85rem;
    color: var(--champagne-muted);
    font-weight: 500;
}

.case-next-step {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

.case-owner {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
    font-family: monospace;
}

.case-date {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Empty state */
.empty-state {
    padding: 60px 32px;
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    margin-bottom: 8px;
}

.empty-state p {
    color: #666;
    font-size: 0.9rem;
}

/* ═══════ Case Detail ═══════ */
.back-link {
    display: inline-block;
    margin-bottom: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.back-link:hover {
    color: var(--champagne);
}

.case-header {
    padding: 32px;
    margin-bottom: 24px;
}

.case-header-top {
    margin-bottom: 16px;
}

.case-flag-lg {
    font-size: 1.1rem;
    font-weight: 500;
}

.flag-red { color: var(--red); }
.flag-yellow { color: var(--yellow); }
.flag-green { color: var(--green); }
.flag-grey { color: var(--text-muted); }

.case-title {
    font-size: 2rem;
    margin-bottom: 8px;
}

.case-meta {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-right: 16px;
}

/* Strategy */
.strategy-block {
    padding: 28px 32px;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.3rem;
    color: var(--champagne);
    margin-bottom: 20px;
}

.strategy-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.strategy-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.strategy-item.highlight {
    background: rgba(232, 213, 190, 0.05);
    padding: 16px;
    border-radius: var(--radius);
    border-bottom: none;
}

.strategy-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.strategy-value {
    font-size: 1rem;
    font-weight: 500;
}

.strategy-text {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
}

/* Timeline */
.timeline-section {
    margin-bottom: 24px;
}

.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--glass-border);
}

.timeline-item {
    position: relative;
    padding: 16px 20px;
    margin-bottom: 12px;
    margin-left: 16px;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--champagne);
    border: 2px solid var(--bg-dark);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.timeline-type {
    font-size: 0.8rem;
    color: var(--champagne-muted);
    font-weight: 500;
}

.timeline-date {
    font-size: 0.75rem;
    color: #666;
}

.timeline-trigger {
    font-size: 0.9rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

.timeline-conclusion {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
}

.timeline-flag {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--red);
    margin-top: 8px;
}

/* Flags grid */
.flags-section {
    padding: 28px 32px;
    margin-bottom: 24px;
}

.flags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.flag-tag {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.tag-red {
    background: rgba(255, 95, 86, 0.12);
    color: var(--red);
    border: 1px solid rgba(255, 95, 86, 0.25);
}

.tag-yellow {
    background: rgba(255, 189, 46, 0.12);
    color: var(--yellow);
    border: 1px solid rgba(255, 189, 46, 0.25);
}

.tag-green {
    background: rgba(39, 201, 63, 0.12);
    color: var(--green);
    border: 1px solid rgba(39, 201, 63, 0.25);
}

/* Archetype */
.archetype-section {
    padding: 28px 32px;
    margin-bottom: 24px;
}

.archetype-primary {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--champagne);
}

.archetype-secondary {
    color: var(--text-muted);
    font-size: 1rem;
    margin-left: 8px;
}

/* CTA */
.case-cta {
    text-align: center;
    margin: 40px 0;
}

/* ═══════ Profile ═══════ */
.profile-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.profile-card {
    padding: 28px 32px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-value {
    color: var(--text-main);
    font-size: 0.9rem;
    text-align: right;
}

.verified-badge {
    color: var(--green);
    font-size: 0.85rem;
}

.pending-badge {
    color: var(--yellow);
    font-size: 0.85rem;
}

.not-set {
    color: #666;
}

.link-action {
    margin-left: 8px;
    font-size: 0.85rem;
    color: var(--champagne);
}

.role-badge {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.role-user { background: var(--bg-lighter); color: var(--text-muted); }
.role-admin { background: rgba(232, 213, 190, 0.15); color: var(--champagne); }
.role-support { background: rgba(39, 201, 63, 0.12); color: var(--green); }

.tier-display {
    text-align: center;
    padding: 24px 0;
}

.tier-current {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.profile-note {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

/* ═══════ Admin ═══════ */
.admin-filters {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.input-search {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-search:focus {
    border-color: var(--champagne);
}

.input-search::placeholder {
    color: #666;
}

.input-select {
    padding: 10px 16px;
    background: var(--bg-lighter);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.input-select option {
    background: var(--bg-panel);
}

.count-badge {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Table */
.table-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th {
    text-align: left;
    padding: 12px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--glass-border);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.td-mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.td-date {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.red-indicator {
    color: var(--red);
    font-size: 0.8rem;
}

/* ═══════ Buttons ═══════ */
.btn-primary {
    display: inline-block;
    padding: 14px 28px;
    background: var(--bg-lighter);
    color: var(--champagne);
    border: 1px solid var(--glass-border-hover);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.4s var(--transition);
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--champagne);
    color: var(--bg-dark);
    box-shadow: 0 0 24px rgba(232, 213, 190, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 10px 20px;
    font-size: 0.85rem;
}

/* ═══════ Pagination ═══════ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}

.page-btn {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--bg-panel);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    transition: all 0.3s;
}

.page-btn:hover {
    color: var(--champagne);
    border-color: var(--champagne);
}

.page-info {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ═══════ Responsive ═══════ */
@media (max-width: 768px) {
    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

    .nav {
        width: 100%;
        justify-content: center;
        gap: 2px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .dashboard-header {
        flex-direction: column;
    }

    .dashboard-stats {
        width: 100%;
        justify-content: space-around;
    }

    .page-title {
        font-size: 1.6rem;
    }

    .case-header {
        padding: 20px;
    }

    .strategy-block, .flags-section, .archetype-section {
        padding: 20px;
    }

    .profile-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .profile-value {
        text-align: left;
    }

    .admin-filters {
        flex-direction: column;
    }

    .input-search {
        min-width: auto;
    }

    .footer-inner {
        flex-direction: column;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .main {
        padding: 80px 0 40px;
    }

    .login-card {
        padding: 32px 24px;
    }

    .login-title {
        font-size: 2rem;
    }

    .filters {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .filter-btn {
        white-space: nowrap;
    }
}

/* === GEMINI ADDITIONS === */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }
.loader-spinner { width: 20px; height: 20px; border: 2px solid var(--glass-border); border-top-color: var(--champagne); border-radius: 50%; animation: spin 1s linear infinite; margin-left: 10px; }
@keyframes spin { 100% { transform: rotate(360deg); } }

.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; z-index: 200; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--text-main); transition: all 0.3s; }

.breadcrumbs-container { padding-top: 20px; }

.login-bg-glow { position: absolute; top: 50%; left: 50%; width: 60vw; height: 60vh; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(232, 213, 190, 0.05) 0%, rgba(82, 22, 42, 0.05) 40%, rgba(13, 12, 17, 0) 70%); z-index: -1; filter: blur(60px); }
.fade-in { animation: fadeIn 0.8s ease-out forwards; opacity: 0; transform: translateY(10px); }
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }

.login-error { background: rgba(255, 95, 86, 0.1); border: 1px solid rgba(255, 95, 86, 0.3); color: var(--red); padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; }

.case-meta-group { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.verdict-red { color: var(--red); font-weight: 600; }
.verdict-yellow { color: var(--yellow); font-weight: 600; }
.verdict-green { color: var(--green); font-weight: 600; }

.cta-highlight { background: rgba(232, 213, 190, 0.08); border: 1px solid rgba(232, 213, 190, 0.2); }

.timeline-empty { text-align: center; padding: 40px 20px; }

.profile-identity { display: flex; align-items: center; gap: 20px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--plum), var(--burgundy)); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; font-weight: 600; color: var(--champagne); border: 2px solid var(--glass-border); }

@media (max-width: 640px) {
    .hamburger { display: flex; }
    .nav { position: absolute; top: 64px; left: 0; right: 0; background: rgba(13, 12, 17, 0.95); backdrop-filter: blur(12px); flex-direction: column; padding: 20px; border-bottom: 1px solid var(--glass-border); transform: translateY(-100%); opacity: 0; visibility: hidden; transition: all 0.3s ease; z-index: -1; }
    .mobile-menu-toggle:checked ~ .nav { transform: translateY(0); opacity: 1; visibility: visible; }
    .mobile-menu-toggle:checked ~ .hamburger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .mobile-menu-toggle:checked ~ .hamburger span:nth-child(2) { opacity: 0; }
    .mobile-menu-toggle:checked ~ .hamburger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
    .case-card-body { margin-left: 0; margin-top: 12px; }
    .case-card-footer { margin-left: 0; }
}


/* JS Menu Variant Overrides */
@media (max-width: 640px) {
    .js-nav.active { transform: translateY(0); opacity: 1; visibility: visible; }
    .js-hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .js-hamburger.active span:nth-child(2) { opacity: 0; }
    .js-hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}

/* Warning Patterns block */
.warning-pattern {
    background: rgba(255, 189, 46, 0.1);
    border: 1px solid rgba(255, 189, 46, 0.2);
    color: var(--yellow);
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 0.9rem;
}
