/* ═══════════════════════════════════════════════════════════════════
   Talon — The Audiophile's Journal
   Light editorial design. Cormorant Garamond + DM Sans.
   Warm cream, gold accents, luxury magazine aesthetic.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg-body: #f5f2ec;
    --bg-card: #ffffff;
    --bg-card-hover: #faf8f4;
    --bg-input: #faf8f4;
    --bg-modal: #ffffff;
    --bg-sidebar: #1a1a1e;
    --bg-sidebar-hover: rgba(255, 255, 255, 0.06);

    --border-color: #e2ddd4;
    --border-light: #ebe7e0;

    --text-primary: #1a1a1e;
    --text-secondary: #5a5750;
    --text-muted: #9a958c;

    --gold: #b8860b;
    --gold-light: #c49a3c;
    --gold-bg: rgba(184, 134, 11, 0.08);
    --gold-border: rgba(184, 134, 11, 0.2);

    --green: #2d8659;
    --green-bg: rgba(45, 134, 89, 0.08);
    --red: #c0392b;
    --red-bg: rgba(192, 57, 43, 0.07);
    --amber: #b8740b;
    --amber-bg: rgba(184, 116, 11, 0.08);
    --teal: #1a7a7a;
    --teal-bg: rgba(26, 122, 122, 0.08);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.1);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --sidebar-width: 240px;

    --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'DM Mono', 'Menlo', monospace;
}

/* ── Reset ────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
}

h1, h2, h3 { font-weight: 600; line-height: 1.3; }

h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-secondary);
}

h1:focus, h2:focus, h3:focus { outline: none; }

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ── App Layout ───────────────────────────────────────────────── */

.app-layout { display: flex; min-height: 100vh; }

/* ── Mobile Top Bar ───────────────────────────────────────────── */

.mobile-topbar { display: none; }
.sidebar-close-btn { display: none; }
.sidebar-backdrop { display: none; }

/* ── Sidebar (stays dark for contrast) ────────────────────────── */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon { width: 30px; height: 30px; flex-shrink: 0; }

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    color: #e8e6e0;
    letter-spacing: 0.02em;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px 10px;
    flex: 1;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.3);
    padding: 18px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.88rem;
    font-weight: 500;
    transition: background-color 0.15s, color 0.15s;
    text-decoration: none;
}

.nav-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: rgba(255, 255, 255, 0.85);
}

.nav-item.active {
    background-color: rgba(196, 154, 60, 0.12);
    color: var(--gold-light);
}

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    overflow: hidden;
}

.user-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Main Content ─────────────────────────────────────────────── */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 36px 48px;
    max-width: 1400px;
}

/* ── Page Header ──────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
}

.page-header h1 { margin: 0; }

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    font-family: var(--font-display);
}

.header-actions { display: flex; align-items: center; gap: 12px; }

/* ── Cards ────────────────────────────────────────────────────── */

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card h2 { margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }

/* ── Buttons ──────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background-color: var(--gold);
    color: white;
    border-color: var(--gold);
}

.btn-primary:hover:not(:disabled) { background-color: var(--gold-light); border-color: var(--gold-light); }

.btn-secondary {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) { background-color: var(--bg-card-hover); color: var(--text-primary); border-color: var(--text-muted); }

.btn-danger { background-color: var(--red-bg); color: var(--red); border-color: transparent; }
.btn-danger:hover:not(:disabled) { background-color: var(--red); color: white; }

.btn-small { padding: 5px 11px; font-size: 0.78rem; }

/* ── Forms ────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input {
    width: 100%;
    padding: 9px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-bg); }
.form-input::placeholder { color: var(--text-muted); }
.form-input-file { font-family: var(--font-body); font-size: 0.85rem; color: var(--text-secondary); }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; font-style: italic; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.save-confirmation { font-size: 0.85rem; color: var(--green); font-weight: 500; }
.import-form { display: flex; flex-direction: column; gap: 12px; }
.import-message { font-size: 0.85rem; color: var(--green); }

/* ── Modal ────────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(26, 26, 30, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal {
    background-color: var(--bg-modal);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 440px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
}

.modal h2 { margin-bottom: 20px; color: var(--text-primary); font-size: 1.3rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 24px; }

/* ── Tables ───────────────────────────────────────────────────── */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.track-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.track-list th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.track-list td { padding: 11px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-secondary); }
.track-list tbody tr:hover { background-color: var(--bg-card-hover); }
.track-list td a { color: var(--gold); }
.track-list td a:hover { color: var(--gold-light); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 28px 16px !important; font-style: italic; }

/* ── Status Badges ────────────────────────────────────────────── */

.status-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-running { background-color: var(--amber-bg); color: var(--amber); }
.status-completed { background-color: var(--green-bg); color: var(--green); }
.status-failed { background-color: var(--red-bg); color: var(--red); }

/* ── Empty State ──────────────────────────────────────────────── */

.empty-state { text-align: center; padding: 60px 24px; color: var(--text-muted); }
.empty-icon { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 12px; opacity: 0.5; }
.not-found { text-align: center; padding: 60px 24px; color: var(--text-muted); font-size: 1rem; font-style: italic; }

/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD — Stats, Products, Filters, Mentions
   ═══════════════════════════════════════════════════════════════════ */

/* ── Stats Bar ────────────────────────────────────────────────── */

.stats-bar { display: flex; gap: 14px; margin-bottom: 28px; flex-wrap: wrap; }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 22px;
    text-align: center;
    min-width: 100px;
    flex: 1;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold);
    opacity: 0.3;
}

.stat-card .stat-number {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-card.cas::before { background: var(--teal); opacity: 0.6; }
.stat-card.cas .stat-number { color: var(--teal); }
.stat-card.shows::before { background: var(--amber); opacity: 0.6; }
.stat-card.shows .stat-number { color: var(--amber); }
.stat-card.positive::before { background: var(--green); opacity: 0.6; }
.stat-card.positive .stat-number { color: var(--green); }

/* ── Product Grid ─────────────────────────────────────────────── */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 28px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 10px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.product-card:hover { border-color: var(--gold-border); box-shadow: var(--shadow-md); }

.product-card .product-count {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gold);
    line-height: 1.1;
}

.product-card .product-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Filter Bar ───────────────────────────────────────────────── */

.filter-bar { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }

.filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 7px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.filter-btn:hover { border-color: var(--gold-border); color: var(--gold); }

.filter-btn.active {
    background-color: var(--gold);
    color: white;
    border-color: var(--gold);
}

/* ── Mention Sections ─────────────────────────────────────────── */

.mention-section { margin-bottom: 16px; }

.section-header {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
    margin-top: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.01em;
}

.section-badge {
    font-family: var(--font-body);
    font-size: 0.62rem;
    padding: 2px 9px;
    border-radius: 10px;
    font-weight: 700;
    color: white;
    letter-spacing: 0.02em;
}

.section-badge.cas { background-color: var(--teal); }
.section-badge.shows { background-color: var(--amber); }
.section-badge.reviews { background-color: var(--gold); }
.section-badge.forums { background-color: #6366a0; }
.section-badge.other { background-color: var(--text-muted); }

/* ── Mention Cards ────────────────────────────────────────────── */

a.mention-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
    border-left: 3px solid transparent;
    animation: cardIn 0.4s ease both;
}

a.mention-card:hover {
    border-color: var(--gold-border);
    border-left-color: var(--gold);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    color: inherit;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.mention-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 6px;
}

.mention-source {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.mention-date {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.mention-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.35;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.external-icon {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.2s;
    vertical-align: baseline;
}

a.mention-card:hover .external-icon { opacity: 0.6; }

.mention-summary {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.55;
}

.mention-tags { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Tags / Pills ─────────────────────────────────────────────── */

.tag {
    font-size: 0.68rem;
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.02em;
}

.tag-product { background-color: var(--gold-bg); color: var(--gold); border: 1px solid var(--gold-border); }
.tag-positive { background-color: var(--green-bg); color: var(--green); }
.tag-negative { background-color: var(--red-bg); color: var(--red); }
.tag-neutral { background-color: rgba(154, 149, 140, 0.1); color: var(--text-muted); }
.tag-mixed { background-color: var(--amber-bg); color: var(--amber); }
.tag-brand-cas { background-color: var(--teal-bg); color: var(--teal); font-weight: 700; }

/* ── Mention Detail ───────────────────────────────────────────── */

.detail-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px 24px; margin-bottom: 24px; }
.detail-row { display: contents; }

.detail-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 6px 0;
}

.detail-value { font-size: 0.9rem; color: var(--text-primary); padding: 6px 0; }

.detail-summary { padding-top: 20px; border-top: 1px solid var(--border-color); margin-bottom: 20px; }
.detail-summary h2 { margin-bottom: 8px; }
.detail-summary p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.65; }

.detail-actions { display: flex; gap: 10px; margin-bottom: 24px; }

.detail-admin { padding-top: 20px; border-top: 1px solid var(--border-color); margin-top: 16px; }
.detail-admin h2 { margin-bottom: 12px; }

/* ── Login Page ───────────────────────────────────────────────── */

.login-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f2ec 0%, #ebe5d8 100%);
}

.login-card { text-align: center; padding: 48px; }

.login-icon { width: 64px; height: 64px; margin-bottom: 24px; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1)); }

.login-card h1 {
    font-family: var(--font-display);
    font-size: 2.6rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-style: italic;
    color: var(--gold);
    margin-bottom: 16px;
    letter-spacing: 0.04em;
}

.login-tagline {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 0.9rem;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.login-btn {
    font-size: 0.95rem;
    padding: 12px 32px;
    border-radius: var(--radius-md);
}

/* ── Blazor Reconnect ─────────────────────────────────────────── */

.blazor-reconnect { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); backdrop-filter: blur(4px); z-index: 9999; align-items: center; justify-content: center; }
.blazor-reconnect[style*="display: flex"], #components-reconnect-modal.components-reconnect-show { display: flex !important; }
#components-reconnect-modal.components-reconnect-hide { display: none !important; }

.blazor-reconnect-dialog {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 16px 28px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
}

.blazor-reconnect-spinner { width: 20px; height: 20px; color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (768px)
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 56px;
        padding: 0 16px;
        background-color: var(--bg-sidebar);
        z-index: 90;
    }

    .hamburger-btn { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; padding: 4px; }
    .hamburger-btn svg { width: 22px; height: 22px; }
    .mobile-brand { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; color: #e8e6e0; }

    .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }

    .sidebar-close-btn { display: block; background: none; border: none; color: rgba(255,255,255,0.4); cursor: pointer; padding: 4px; margin-left: auto; }
    .sidebar-close-btn svg { width: 18px; height: 18px; }
    .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 99; }

    .main-content { margin-left: 0; padding: 72px 16px 24px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .header-actions { flex-wrap: wrap; }
    .stats-bar { gap: 8px; }
    .stat-card { min-width: 0; padding: 14px; }
    .stat-card .stat-number { font-size: 1.6rem; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)); }
    a.mention-card { padding: 16px; }
    .table-scroll { margin: 0 -16px; padding: 0 16px; }
    .track-list { min-width: 600px; }
    .modal { width: calc(100vw - 32px); }
    .detail-grid { grid-template-columns: 1fr; gap: 4px; }
    .detail-row { display: flex; flex-direction: column; margin-bottom: 8px; }
}
