/* ================================================================
   LitFinder — Mobile-first responsive CSS
   ================================================================ */

/* ── Reset & base ─────────────────────────────────────────────── */

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

:root {
    --primary:      #0a2038;
    --primary-light:#153457;
    --accent:       #009cf0;
    --accent-hover: #0084d1;
    --bg:           #f4f7fb;
    --surface:      #ffffff;
    --text:         #0a2038;
    --text-muted:   #5b6b82;
    --border:       #e2e8f0;

    --landmark:     #7c3aed;
    --landmark-bg:  #ede9fe;
    --intermediate: #0284c7;
    --inter-bg:     #e0f2fe;
    --latest:       #059669;
    --latest-bg:    #d1fae5;
    --indian:       #ea580c;
    --indian-bg:    #ffedd5;

    --radius:       12px;
    --radius-sm:    8px;
    --shadow:       0 2px 8px rgba(10,32,56,0.06);
    --shadow-lg:    0 6px 24px rgba(10,32,56,0.14);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    width: 100%;
}


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

.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    padding: 12px 18px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}


.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sidebar-toggle-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 9px;
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.04);
}

.hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.2s ease;
}

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

.brand-square-emblem {
    width: 44px;
    height: 44px;
    aspect-ratio: 1 / 1;
    border-radius: 11px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.brand-square-emblem:hover {
    transform: scale(1.06);
}

.brand-text h1 {
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.2;
    color: #ffffff;
}

.brand-highlight {
    color: #38bdf8;
    font-weight: 800;
}

.tagline {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.82);
    margin-top: 2px;
    letter-spacing: 0.2px;
}


/* ── Secondary Status Strip (Sub-Bar) ─────────────────────────── */

.sub-header-strip {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    width: 100%;
    box-sizing: border-box;
    padding: 6px 14px;
    animation: fadeIn 0.25s ease-out;
}

@media (min-width: 769px) {
    .sub-header-strip {
        display: none; /* Only needed on mobile/tablet where header buttons move to sub-strip & sidebar */
    }
}

.sub-strip-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Auth / Account in sub-bar (small, sharp font) */
.strip-auth-account {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-shrink: 1;
}

.strip-btn-auth {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.strip-btn-auth:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.strip-auth-icon {
    font-size: 11px;
}

.strip-auth-text {
    font-weight: 700;
    color: #0284c7;
}

.strip-auth-credits {
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
}

.strip-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.strip-user-account-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    padding: 3px 9px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    max-width: 190px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.strip-user-account-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.strip-dot {
    font-size: 8px;
    line-height: 1;
}

.strip-username {
    font-weight: 700;
    color: #0f172a;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.strip-credits-num {
    background: #e0f2fe;
    color: #0369a1;
    padding: 1px 6px;
    border-radius: 10px;
    font-size: 10.5px;
    font-weight: 700;
}

.strip-btn-admin {
    display: inline-flex;
    align-items: center;
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.strip-btn-admin:hover {
    background: #fde68a;
}

.strip-lib-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 4px 10px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.strip-lib-link:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}


/* ── Hero Section ─────────────────────────────────────────────── */

.hero-intro {
    text-align: center;
    padding: 24px 12px 18px;
    margin-bottom: 8px;
    animation: fadeIn 0.4s ease-out;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: #e0f2fe;
    color: #0369a1;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 20px;
    border: 1px solid #bae6fd;
    margin-bottom: 14px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.hero-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0284c7;
    box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
    animation: statusPulse 1.8s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.7);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(2, 132, 199, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(2, 132, 199, 0);
    }
}

.hero-headline {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.25;
    letter-spacing: -0.6px;
    margin-bottom: 10px;
}

.hero-subtext {
    font-size: 14.5px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 620px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .desktop-only-btn,
    .desktop-only-pill {
        display: none !important; /* Move to sub-header strip and sidebar to prevent any header overlap */
    }
}

@media (max-width: 600px) {
    .app-header {
        padding: 8px 12px;
    }
    .header-content {
        gap: 8px;
    }
    .sidebar-toggle-btn {
        width: 34px;
        height: 34px;
        padding: 7px;
    }
    .brand-square-emblem {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }
    .logo {
        gap: 8px;
        min-width: 0;
    }
    .brand-text {
        min-width: 0;
    }
    .brand-text h1 {
        font-size: 16px;
        line-height: 1.15;
        white-space: nowrap;
    }
    .tagline {
        display: none !important; /* Hide 3-line tagline on mobile screens so header stays clean and unclipped */
    }
    .header-user-actions {
        gap: 6px;
        flex-shrink: 0;
    }
    .nav-btn-upgrade {
        padding: 5px 12px;
        font-size: 12px;
        font-weight: 700;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .sub-header-strip {
        padding: 5px 10px;
    }
    .strip-auth-account {
        gap: 5px;
    }
    .strip-btn-auth {
        padding: 3px 8px;
        font-size: 11px;
        gap: 4px;
    }
    .strip-user-account-btn {
        padding: 3px 7px;
        font-size: 11px;
        max-width: 160px;
    }
    .strip-username {
        max-width: 65px;
    }
    .strip-credits-num {
        font-size: 10px;
        padding: 1px 5px;
    }
    .strip-btn-admin {
        font-size: 10.5px;
        padding: 2px 6px;
    }
    .strip-lib-link {
        font-size: 11px;
        padding: 3px 8px;
        gap: 4px;
    }
    .hero-intro {
        padding: 14px 4px 10px;
    }
    .hero-headline {
        font-size: 19px;
        line-height: 1.3;
    }
    .hero-subtext {
        font-size: 13px;
        line-height: 1.5;
    }
    main {
        padding: 12px;
    }
    .study-type-pills-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-top: 10px;
    }
    .study-type-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        width: 100%;
    }
    .study-pill {
        padding: 5px 9px;
        font-size: 11.5px;
    }
    .settings-row {
        gap: 8px;
        margin-top: 8px;
        flex-wrap: wrap;
    }
}


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

main {
    flex: 1;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    padding: 16px;
}


/* ── Search ───────────────────────────────────────────────────── */

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

.search-bar {
    display: flex;
    gap: 10px;
    width: 100%;
    align-items: stretch;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

.search-input-wrapper input {
    width: 100%;
    min-width: 0;
    padding: 14px 50px 14px 18px;
    font-size: 16px;          /* prevent iOS zoom, readable */
    font-weight: 500;
    color: #0f172a;
    line-height: 1.4;
    min-height: 52px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    box-sizing: border-box;
}

.search-input-wrapper input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.search-input-wrapper input::placeholder {
    color: #94a3b8;
    font-size: 15px;
    font-weight: 400;
}

/* Mic button inside search input */
.search-input-wrapper .mic-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 8px;
    font-size: 19px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    z-index: 2;
}

.search-input-wrapper .mic-btn:hover {
    background: #f1f5f9 !important;
    transform: translateY(-50%) scale(1.08);
}

.search-input-wrapper .mic-btn.recording {
    background: #fee2e2 !important;
    color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25);
    border-radius: 50% !important;
    animation: micPulse 1.2s infinite ease-in-out;
}

/* Search Action Button */
#search-btn {
    padding: 0 24px;
    min-height: 52px;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(30, 58, 95, 0.2);
}

#search-btn:hover {
    background: linear-gradient(135deg, #172554, #1d4ed8);
    box-shadow: 0 4px 14px rgba(30, 58, 95, 0.3);
    transform: translateY(-1px);
}

#search-btn:active {
    transform: translateY(0);
}

#search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#search-btn .btn-icon {
    display: inline-block;
    font-size: 15px;
}

#search-btn .btn-text {
    display: inline-block;
}

/* Mobile Search Bar layout: Input full width + Search button moved DOWN */
@media (max-width: 600px) {
    .search-bar {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .search-input-wrapper input {
        width: 100%;
        min-height: 52px;
        font-size: 16px;
        padding: 14px 48px 14px 16px;
        border-radius: 12px;
    }

    #search-btn {
        width: 100%;
        min-height: 48px;
        border-radius: 12px;
        font-size: 16px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        letter-spacing: 0.2px;
    }

    #search-btn .btn-icon {
        display: inline-block !important;
        font-size: 16px;
    }

    #search-btn .btn-text {
        display: inline-block !important;
    }
}

.study-type-pills-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    width: 100%;
}

.pills-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.study-type-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap; /* Wraps cleanly so Case Reports & other pills are never cut off */
    align-items: center;
}

.study-pill {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    color: #4b5563;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.study-pill:hover {
    background: #f1f5f9;
    border-color: var(--accent);
    color: var(--accent);
}

.study-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(30, 58, 95, 0.25);
}

/* ── MeSH Disambiguation Box (Google-style) ────────────────── */

.mesh-suggestion-box {
    margin-top: 10px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.2s ease-in-out;
}

.mesh-suggestion-label {
    font-size: 13px;
    color: #4b5563;
    font-weight: 600;
    font-style: italic;
}

.mesh-suggestion-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mesh-chip {
    display: inline-block;
    padding: 7px 14px;
    font-size: 13.5px;
    font-weight: 500;
    color: #1d4ed8;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
    line-height: 1.4;
}

.mesh-chip:hover {
    background: #1d4ed8;
    color: #ffffff;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(29, 78, 216, 0.2);
}

.mesh-chip:active {
    transform: scale(0.98);
}

.settings-row {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.setting {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.setting select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 13px;
    cursor: pointer;
}


/* ── Loading ──────────────────────────────────────────────────── */

.loading-section {
    text-align: center;
    padding: 48px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.loading-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}


/* ── Error ────────────────────────────────────────────────────── */

.error-section {
    padding: 20px 0;
}

.error-card {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.error-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.error-card p {
    color: #991b1b;
    margin-bottom: 12px;
}

.error-card button {
    padding: 8px 20px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
}


/* ── Narrative card ───────────────────────────────────────────── */

.narrative-card {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.narrative-card h3 {
    font-size: 15px;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.narrative-card p {
    font-size: 14px;
    color: #334155;
}


/* ── Stats bar ────────────────────────────────────────────────── */

.stats-bar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
    font-size: 13px;
}

.stat-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
}

.stat-chip.landmark   { background: var(--landmark-bg); color: var(--landmark); }
.stat-chip.intermediate { background: var(--inter-bg); color: var(--intermediate); }
.stat-chip.latest     { background: var(--latest-bg); color: var(--latest); }
.stat-chip.indian     { background: var(--indian-bg); color: var(--indian); }
.stat-chip.total      { background: #f1f5f9; color: var(--text-muted); }


/* ── Paper cards ──────────────────────────────────────────────── */

.papers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.paper-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.paper-card:hover {
    box-shadow: var(--shadow-lg);
}

.paper-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.paper-year {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.tag-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-badge.landmark     { background: var(--landmark-bg); color: var(--landmark); }
.tag-badge.intermediate { background: var(--inter-bg); color: var(--intermediate); }
.tag-badge.latest       { background: var(--latest-bg); color: var(--latest); }
.tag-badge.indian, .tag-badge.indian-study { background: var(--indian-bg); color: var(--indian); }
.tag-badge.systematic-review { background: #f0fdfa; color: #0d9488; }
.tag-badge.meta-analysis     { background: #faf5ff; color: #9333ea; }
.tag-badge.rct               { background: #fdf2f8; color: #db2777; }
.tag-badge.comparative-study { background: #f8fafc; color: #475569; }

.retraction-badge {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid #f87171;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
}

/* ── Study Design Badges ───────────────────────────────────────── */

.study-design-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.study-design-badge.retrospective-study {
    background: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.study-design-badge.prospective-study {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #bae6fd;
}

.study-design-badge.randomized-controlled-trial, .study-design-badge.rct {
    background: #fdf2f8;
    color: #be185d;
    border-color: #fbcfe8;
}

.study-design-badge.systematic-review {
    background: #f0fdfa;
    color: #0f766e;
    border-color: #99f6e4;
}

.study-design-badge.meta-analysis {
    background: #faf5ff;
    color: #7e22ce;
    border-color: #e9d5ff;
}

.study-design-badge.comparative-study {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}

.study-design-badge.case-series {
    background: #eef2ff;
    color: #4338ca;
    border-color: #c7d2fe;
}

.study-design-badge.case-report {
    background: #fdf4ff;
    color: #a21caf;
    border-color: #f5d0fe;
}

.study-design-badge.in-vitro---biomechanical, .study-design-badge.in-vitro {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.study-design-badge.clinical-guideline {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.study-design-badge.clinical-study {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.abstract-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #eff6ff;
    border-radius: var(--radius-sm);
    color: #1e40af;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #bfdbfe;
    margin-bottom: 12px;
}

.abstract-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #93c5fd;
    border-top-color: #1d4ed8;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}


.paper-title {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 6px;
    color: var(--text);
    cursor: pointer;
}

.paper-title:hover {
    color: var(--accent);
}

.paper-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 4px;
    line-height: 1.4;
}

.paper-contribution {
    font-size: 13px;
    color: #334155;
    background: #f8fafc;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    margin-top: 8px;
    line-height: 1.5;
}

.paper-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    flex-wrap: wrap;
}

.paper-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.paper-links a, .btn-card-action {
    font-size: 12px;
    padding: 4px 12px;
    background: #f1f5f9;
    color: var(--accent);
    text-decoration: none;
    border-radius: 20px;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.paper-links a:hover, .btn-card-action:hover {
    background: #dbeafe;
}

.btn-card-action.vancouver-btn {
    background: #f8fafc;
    color: #2563eb;
    border-color: #cbd5e1;
}

.btn-card-action.vancouver-btn:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.btn-card-action.drawer-btn {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.btn-card-action.drawer-btn:hover {
    background: #dcfce7;
}

.citations-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
}

.cpy-text {
    font-size: 11px;
    color: #b45309;
    margin-left: 2px;
    opacity: 0.9;
}


/* ── Load more section (Unified Modern Design for Desktop & Mobile) ── */

.load-more-section {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.load-more-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.load-group-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.load-more-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

@media (max-width: 640px) {
    .load-more-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }
}

@media (max-width: 380px) {
    .load-more-buttons {
        grid-template-columns: 1fr;
    }
}

.load-btn {
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.load-btn .btn-text {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.3;
}

.load-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.load-btn:active {
    transform: scale(0.98);
}

.load-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Distinct color badges matching academic tags */
.load-btn.landmark-btn {
    background: #faf5ff;
    color: #6b21a8;
    border-color: #d8b4fe;
}
.load-btn.landmark-btn:hover {
    background: #f3e8ff;
    border-color: #c084fc;
}

.load-btn.intermediate-btn {
    background: #f0f9ff;
    color: #0369a1;
    border-color: #bae6fd;
}
.load-btn.intermediate-btn:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

.load-btn.latest-btn {
    background: #f0fdf4;
    color: #15803d;
    border-color: #bbf7d0;
}
.load-btn.latest-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
}

.load-btn.indian-btn {
    background: #fff7ed;
    color: #c2410c;
    border-color: #fed7aa;
}
.load-btn.indian-btn:hover {
    background: #ffedd5;
    border-color: #fdba74;
}

.load-btn.systematic-btn {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #bfdbfe;
}
.load-btn.systematic-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.load-btn.rct-btn {
    background: #f0fdfa;
    color: #0f766e;
    border-color: #99f6e4;
}
.load-btn.rct-btn:hover {
    background: #ccfbf1;
    border-color: #5eead4;
}

.load-btn.comparative-btn {
    background: #f8fafc;
    color: #334155;
    border-color: #cbd5e1;
}
.load-btn.comparative-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.load-btn.case-report-btn {
    background: #fff1f2;
    color: #be123c;
    border-color: #fecdd3;
}
.load-btn.case-report-btn:hover {
    background: #ffe4e6;
    border-color: #fda4af;
}

.load-more-status {
    margin-top: 6px;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    text-align: center;
}


/* ── Slide-Over Navigation Sidebar (ChatGPT / Perplexity Style) ── */

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

.nav-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: #ffffff;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.18);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.nav-sidebar.hidden {
    transform: translateX(-100%);
    pointer-events: none;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #ffffff;
    padding: 16px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-title {
    font-size: 15px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.2;
}

.sidebar-brand-subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
}

.sidebar-close-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sidebar-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
}

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

.account-user-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.account-tier-label {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
}

.account-quota-pill {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.account-quota-desc {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.sidebar-action-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-upgrade-pro {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    border: none;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.3);
}

.btn-upgrade-pro:hover {
    background: linear-gradient(135deg, #fbbf24, #b45309);
    transform: translateY(-1px);
}

.auth-card {
    border-left: 3px solid #3b82f6;
    background: #f0f7ff;
}

.auth-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e3a5f;
    margin-bottom: 4px;
}

.auth-card-desc {
    font-size: 11.5px;
    color: #475569;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.btn-auth-trigger {
    background: #ffffff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.btn-auth-trigger:hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-top: 4px;
}

.sidebar-menu-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #ffffff;
    color: #334155;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.sidebar-menu-item:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #0f172a;
    transform: translateX(2px);
}

.menu-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.menu-label {
    flex: 1;
}

.menu-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

.menu-arrow {
    color: #94a3b8;
    font-size: 14px;
}

.sidebar-currency-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.sidebar-curr-toggles {
    display: flex;
    gap: 6px;
}

.curr-btn-mini {
    padding: 4px 9px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
}

.curr-btn-mini.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
    background: #fafafa;
}

.sidebar-app-ver {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.sidebar-credits {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 2px;
}


/* ── Slide-Over Abstract Drawer ────────────────────────────────── */

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    transition: opacity 0.25s ease;
}

.abstract-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 580px;
    background: var(--surface);
    z-index: 1001;
    box-shadow: -8px 0 30px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.drawer-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #eff6ff;
    color: var(--primary);
    border: 1px solid #bfdbfe;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.drawer-back-btn:hover {
    background: #dbeafe;
    transform: translateX(-2px);
}

.drawer-close-btn {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    transition: all 0.2s;
}

.drawer-close-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

.drawer-content {
    padding: 24px 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.drawer-pill-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.drawer-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
    margin-bottom: 12px;
}

.drawer-retraction-alert {
    background: #fef2f2;
    border: 1.5px solid #ef4444;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: #991b1b;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-meta-box {
    background: #f8fafc;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
}

.drawer-meta-box strong {
    color: var(--text);
}

.drawer-meta-box em {
    color: var(--text-muted);
}

.drawer-abstract-container {
    margin-top: 16px;
    margin-bottom: 24px;
}

.drawer-abstract-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.drawer-abstract-text {
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
}

.abstract-section {
    margin-bottom: 14px;
}

.abstract-section-heading {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #1e3a5f;
    background: #e0f2fe;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.abstract-para {
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
    margin: 0 0 10px 0;
}

.abstract-para:last-child {
    margin-bottom: 0;
}

.drawer-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.drawer-action-btn {
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.drawer-action-btn.vancouver-btn {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.drawer-action-btn.vancouver-btn:hover {
    background: var(--primary-light);
}

.drawer-action-btn.external-btn {
    background: #f1f5f9;
    color: var(--accent);
}

.drawer-action-btn.external-btn:hover {
    background: #dbeafe;
}


/* ── Toast Notification ────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: white;
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    z-index: 2000;
    pointer-events: none;
    animation: toast-fade 0.2s ease-out;
}

@keyframes toast-fade {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}


/* ── Export row ────────────────────────────────────────────────── */

.export-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.export-btn {
    padding: 10px 18px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.export-btn:hover {
    background: #f1f5f9;
    border-color: var(--accent);
}

.export-btn:active {
    transform: scale(0.97);
}


/* ── Footer ───────────────────────────────────────────────────── */

footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

footer a {
    color: var(--accent);
    text-decoration: none;
}


/* ── Utilities ────────────────────────────────────────────────── */

.hidden {
    display: none !important;
}


/* ── Desktop refinements ──────────────────────────────────────── */

@media (min-width: 640px) {
    main {
        padding: 24px;
    }

    .paper-card {
        padding: 20px;
    }

    .export-row {
        gap: 12px;
    }
}


/* ── Speech-to-Text (Mic Button & Voice Indicator) ────────── */

.mic-btn {
    padding: 8px 10px;
    background: transparent;
    color: var(--text);
    border: none;
    border-radius: var(--radius);
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mic-btn:hover {
    background: #e2e8f0;
}

.mic-btn.recording {
    background: #fee2e2;
    color: #ef4444;
    border-color: #ef4444;
    animation: micPulse 1.2s infinite ease-in-out;
}

@keyframes micPulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-sm);
    color: #991b1b;
    font-size: 13px;
    font-weight: 500;
    flex-wrap: wrap;
    animation: fadeIn 0.2s ease;
}

.voice-pulse-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    animation: voicePulse 1s infinite alternate;
}

@keyframes voicePulse {
    from { opacity: 0.4; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1.15); }
}

.voice-indicator-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.voice-stop-btn {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
    padding: 6px 14px !important;
    border-radius: 16px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.voice-stop-btn:hover {
    background: #dc2626 !important;
    transform: scale(1.02);
}

.voice-cancel-btn {
    background: none !important;
    border: 1px solid #fca5a5 !important;
    border-radius: 16px !important;
    color: #991b1b !important;
    padding: 5px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background 0.15s ease;
}

.voice-cancel-btn:hover {
    background: #fee2e2 !important;
}

/* ── Shimmer Placeholder for Progressive Two-Stage Loading ── */

.shimmer-placeholder {
    display: inline-block;
    height: 14px;
    width: 85%;
    border-radius: 4px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}


/* ── Paper Action Buttons (Free PDF, Download) ───────────────── */

.spinner-inline {
    width: 11px;
    height: 11px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}


/* ── Drawer Access Section ────────────────────────────────────── */

.drawer-access-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
}

.drawer-access-title {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.drawer-access-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.drawer-access-grid a, .drawer-access-grid button {
    font-size: 12px;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}


/* ── Commercial Header Actions & Workspace ────────────────────── */

.header-user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.nav-btn-library {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn-library:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.badge-count {
    background: #3b82f6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 12px;
}

.user-tier-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-tier-pill:hover {
    background: rgba(255, 255, 255, 0.16);
}

.tier-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.quota-pill {
    background: rgba(15, 23, 42, 0.5);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    color: #93c5fd;
    font-weight: 600;
}

.nav-btn-upgrade {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    border: none;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
    transition: all 0.2s ease;
}

.nav-btn-upgrade:hover {
    background: linear-gradient(135deg, #fbbf24, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45);
}

/* Results action bar */
.results-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 10px 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.results-topic-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.results-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3b82f6;
}

.btn-save-project {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #cbd5e1;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save-project:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-card-action.bookmark-btn {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.btn-card-action.bookmark-btn.bookmarked {
    background: #fef3c7;
    color: #b45309;
    border-color: #fde68a;
    font-weight: 700;
}

/* ── Modals & Backdrop ────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    z-index: 999;
}

.app-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    z-index: 1000;
    width: 92%;
    max-width: 880px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
}

.pricing-modal {
    max-width: 920px;
}

.library-modal {
    max-width: 780px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 18px;
    margin-bottom: 20px;
}

.modal-badge {
    display: inline-block;
    background: #eff6ff;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.modal-title-box h2 {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 6px 0;
}

.modal-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.modal-close-btn {
    background: #f1f5f9;
    border: none;
    font-size: 18px;
    color: #64748b;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Currency Toggle */
.pricing-currency-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.curr-label {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
}

.curr-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.curr-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}

/* Pricing Grid */
.pricing-cards-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.pricing-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.pricing-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pricing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1);
}

.pricing-card.popular {
    border: 2px solid #3b82f6;
    box-shadow: 0 10px 30px -10px rgba(59, 130, 246, 0.3);
}

.popular-ribbon {
    position: absolute;
    top: -12px;
    right: 20px;
    background: #3b82f6;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 8px;
}

.plan-price-box {
    margin-bottom: 18px;
}

.plan-price-num {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
}

.plan-price-period {
    font-size: 13px;
    color: #64748b;
    margin-left: 4px;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    flex-grow: 1;
}

.plan-features li {
    font-size: 13px;
    color: #334155;
    padding: 6px 0;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.plan-features li::before {
    content: "✓";
    color: #10b981;
    font-weight: 800;
}

.plan-cta-btn {
    width: 100%;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    border: none;
    transition: all 0.2s ease;
}

.plan-cta-btn.btn-primary {
    background: #3b82f6;
    color: #ffffff;
}

.plan-cta-btn.btn-primary:hover {
    background: #2563eb;
}

.plan-cta-btn.btn-outline {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.plan-cta-btn.btn-outline:hover {
    background: #f1f5f9;
}

/* Pricing Topups Box */
.pricing-topups-box {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
}

.topups-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.topup-badge {
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.topup-subtext {
    font-size: 12px;
    color: #64748b;
}

.topup-items-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.topup-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    transition: border-color 0.15s ease;
}

.topup-item:hover {
    border-color: #94a3b8;
}

.topup-info {
    display: flex;
    flex-direction: column;
}

.topup-name {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.topup-desc {
    font-size: 11.5px;
    color: #64748b;
}

.topup-btn {
    background: #0284c7;
    color: #ffffff;
    border: none;
    font-weight: 700;
    font-size: 12.5px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease;
}

.topup-btn:hover {
    background: #0369a1;
}

.pricing-guarantee {
    text-align: center;
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid #f1f5f9;
    padding-top: 16px;
}

/* ── Library Workspace Modal ──────────────────────────────────── */

.library-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.library-tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.library-tab-btn.active {
    color: #0f172a;
    border-bottom-color: #3b82f6;
}

.library-empty {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.library-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.library-item-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: border-color 0.15s ease;
}

.library-item-card:hover {
    border-color: #cbd5e1;
}

.library-item-info {
    flex-grow: 1;
}

.library-item-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.library-item-meta {
    font-size: 12px;
    color: #64748b;
}

.library-item-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-lib-action {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    transition: all 0.15s ease;
}

.btn-lib-action.btn-open {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.btn-lib-action.btn-open:hover {
    background: #2563eb;
}

.btn-lib-action.btn-del {
    color: #ef4444;
    border-color: #fecaca;
}

.btn-lib-action.btn-del:hover {
    background: #fee2e2;
}

@media (max-width: 768px) {
    .header-user-actions {
        gap: 6px;
    }
    .nav-btn-library .btn-text {
        display: none;
    }
    .user-tier-pill {
        padding: 5px 8px;
        font-size: 11px;
    }
    .pricing-cards-container {
        grid-template-columns: 1fr;
    }
    .library-item-card {
        flex-direction: column;
        align-items: flex-start;
    }
    .library-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ── Lot / Addition Batch Highlighting ────────────────────────── */

/* Base transition for smooth highlight appearance */
.paper-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.3s ease, border-color 0.3s ease;
}

@keyframes batchCardPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
        transform: scale(1.015);
    }
    100% {
        box-shadow: var(--shadow);
        transform: scale(1);
    }
}

.paper-card.batch-card-pulse {
    animation: batchCardPulse 1.2s ease-in-out 2;
}

/* Lot 1 — Emerald / Mint */
.paper-card.batch-lot-1 {
    background: #f0fdf4 !important;
    border: 1px solid #bbf7d0 !important;
    border-left: 5px solid #059669 !important;
}
.batch-lot-pill.batch-lot-1,
.batch-nav-chip.batch-filter-1 {
    background: #dcfce7 !important;
    color: #14532d !important;
    border: 1px solid #86efac !important;
}

/* Lot 2 — Amber / Warm Honey */
.paper-card.batch-lot-2 {
    background: #fffbeb !important;
    border: 1px solid #fde68a !important;
    border-left: 5px solid #d97706 !important;
}
.batch-lot-pill.batch-lot-2,
.batch-nav-chip.batch-filter-2 {
    background: #fef3c7 !important;
    color: #78350f !important;
    border: 1px solid #fcd34d !important;
}

/* Lot 3 — Purple / Lavender */
.paper-card.batch-lot-3 {
    background: #faf5ff !important;
    border: 1px solid #ddd6fe !important;
    border-left: 5px solid #7c3aed !important;
}
.batch-lot-pill.batch-lot-3,
.batch-nav-chip.batch-filter-3 {
    background: #ede9fe !important;
    color: #4c1d95 !important;
    border: 1px solid #c4b5fd !important;
}

/* Lot 4 — Rose / Coral */
.paper-card.batch-lot-4 {
    background: #fff1f2 !important;
    border: 1px solid #fecdd3 !important;
    border-left: 5px solid #e11d48 !important;
}
.batch-lot-pill.batch-lot-4,
.batch-nav-chip.batch-filter-4 {
    background: #ffe4e6 !important;
    color: #881337 !important;
    border: 1px solid #fda4af !important;
}

/* Lot 5 — Sky Blue / Cyan */
.paper-card.batch-lot-5 {
    background: #f0f9ff !important;
    border: 1px solid #bae6fd !important;
    border-left: 5px solid #0284c7 !important;
}
.batch-lot-pill.batch-lot-5,
.batch-nav-chip.batch-filter-5 {
    background: #e0f2fe !important;
    color: #0c4a6e !important;
    border: 1px solid #7dd3fc !important;
}

/* Lot 6 — Indigo */
.paper-card.batch-lot-6 {
    background: #eef2ff !important;
    border: 1px solid #c7d2fe !important;
    border-left: 5px solid #4f46e5 !important;
}
.batch-lot-pill.batch-lot-6,
.batch-nav-chip.batch-filter-6 {
    background: #e0e7ff !important;
    color: #312e81 !important;
    border: 1px solid #a5b4fc !important;
}

/* Pill badge on paper cards */
.batch-lot-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Batch navigation / lot jump filter bar */
.batch-navigation-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed #cbd5e1;
    width: 100%;
}

.batch-nav-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-nav-chip {
    padding: 4px 11px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.batch-nav-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.batch-nav-chip.active {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

/* ================================================================
   AI Thinking Live Progress HUD
   ================================================================ */

/* ================================================================
   Anvesha Research Agent Single Progress Card
   ================================================================ */

.ai-progress-card {
    max-width: 580px;
    margin: 0 auto;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-lg, 16px);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    padding: 20px 24px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.ai-progress-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #06b6d4, #10b981, #2563eb);
    background-size: 200% 100%;
    animation: gradientFlow 2.5s linear infinite;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.ai-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-agent-identity {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-pulse-orb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle, #38bdf8 0%, #0284c7 70%, #0369a1 100%);
    box-shadow: 0 0 12px rgba(2, 132, 199, 0.5);
    animation: orbGlow 1.8s ease-in-out infinite alternate;
    flex-shrink: 0;
}

@keyframes orbGlow {
    0% { transform: scale(0.92); box-shadow: 0 0 6px rgba(2, 132, 199, 0.4); }
    100% { transform: scale(1.1); box-shadow: 0 0 16px rgba(56, 189, 248, 0.8); }
}

.ai-agent-name {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.ai-status-badge {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.ai-status-badge .pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #16a34a;
    display: inline-block;
    animation: blink 1s infinite alternate;
}

.ai-progress-track {
    width: 100%;
    height: 9px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 14px;
}

.ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #06b6d4);
    border-radius: 6px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-process-status {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #334155;
    font-size: 13.5px;
    font-weight: 500;
    min-height: 22px;
}

.ai-process-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.ai-process-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #334155;
    transition: opacity 0.2s ease;
}

@keyframes blink {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

@keyframes blink {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

/* ================================================================
   Library Multi-Select & Batch Toolbar
   ================================================================ */

.library-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius, 8px);
}

.library-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.library-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    user-select: none;
}

.library-selected-badge {
    font-size: 12px;
    font-weight: 600;
    background: #e2e8f0;
    color: #475569;
    padding: 2px 8px;
    border-radius: 12px;
}

.library-selected-badge.active {
    background: #dbeafe;
    color: #1d4ed8;
}

.library-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-lib-export {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-lib-export:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-lib-export:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-lib-export.btn-csv {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #166534;
}

.btn-lib-export.btn-csv:hover:not(:disabled) {
    background: #dcfce7;
    border-color: #86efac;
}

.btn-lib-export.btn-vancouver {
    background: #f0f9ff;
    border-color: #bae6fd;
    color: #0369a1;
}

.btn-lib-export.btn-vancouver:hover:not(:disabled) {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

.btn-lib-export.btn-download-pdfs {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.btn-lib-export.btn-download-pdfs:hover:not(:disabled) {
    background: #dbeafe;
    border-color: #60a5fa;
    color: #1e40af;
}

.btn-lib-export.btn-del-selected {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.btn-lib-export.btn-del-selected:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fca5a5;
}

.bookmark-select-wrap {
    display: flex;
    align-items: center;
    padding-right: 10px;
    flex-shrink: 0;
}

.bookmark-select-wrap input[type="checkbox"] {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--accent, #0284c7);
}

.library-item-card.is-selected {
    border-color: #93c5fd;
    background: #f8fbff;
}

/* ── Auth & Admin System Styles (Phase 1) ─────────────────────── */

.nav-btn-auth {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn-auth:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.nav-btn-admin {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f59e0b;
    border: 1px solid #d97706;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-btn-admin:hover {
    background: #d97706;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* Auth Modal */
.auth-modal {
    max-width: 440px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.auth-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.google-auth-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: 100%;
    position: relative;
}

.btn-google-direct {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 11px 16px;
    background: #ffffff;
    border: 1px solid #dadce0;
    border-radius: 24px;
    color: #3c4043;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08), 0 1px 3px rgba(60, 64, 67, 0.12);
    transition: all 0.2s ease;
}

.btn-google-direct:hover {
    background: #f8fafd;
    border-color: #d2e3fc;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.2), 0 2px 6px rgba(60, 64, 67, 0.15);
}

.btn-google-direct:active {
    background: #eeeeee;
    transform: scale(0.99);
}

.google-icon {
    flex-shrink: 0;
}

.google-btn-container {
    display: flex;
    justify-content: center;
    width: 100%;
}

.auth-loading-text {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
    text-align: center;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}

.auth-divider span {
    padding: 0 10px;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
    gap: 4px;
}

.auth-tab-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.auth-field-group label {
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.auth-field-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.auth-field-group input:focus {
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 40px;
}

.btn-toggle-pwd {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-toggle-pwd:hover {
    opacity: 1;
}

.auth-submit-btn {
    width: 100%;
    padding: 12px;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-top: 4px;
}

.auth-submit-btn:hover {
    background: #0369a1;
}

.auth-submit-btn:active {
    transform: scale(0.99);
}

.auth-error-banner {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 10px;
}

.auth-success-banner {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 10px;
}

/* Sidebar User Status Card */
.sidebar-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.sidebar-avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #0284c7;
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-user-fullname {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-user-mail {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.sidebar-credit-status-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}

.btn-admin-panel {
    background: #fef3c7 !important;
    border-color: #fde68a !important;
    color: #b45309 !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
}

.btn-admin-panel:hover {
    background: #fde68a !important;
}

.btn-sign-out {
    background: #f1f5f9 !important;
    border-color: #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 600 !important;
}

.btn-sign-out:hover {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Admin Credits Modal */
.admin-modal {
    max-width: 760px;
    padding: 24px;
}

.admin-badge {
    background: #fef3c7 !important;
    color: #b45309 !important;
}

.admin-section-h3 {
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.admin-form-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}

.admin-input-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-input {
    flex: 1;
    min-width: 200px;
    padding: 9px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}

.admin-input-num {
    max-width: 110px;
    min-width: 90px;
}

.admin-submit-btn {
    background: #f59e0b;
    border: none;
    color: #ffffff;
    font-weight: 700;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.admin-submit-btn:hover {
    background: #d97706;
}

.admin-feedback {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.admin-feedback.success {
    background: #dcfce7;
    color: #15803d;
}

.admin-feedback.error {
    background: #fee2e2;
    color: #b91c1c;
}

.admin-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.admin-refresh-btn {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.admin-table-wrapper {
    overflow-x: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    max-height: 380px;
    overflow-y: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.admin-table th {
    background: #f1f5f9;
    color: #475569;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.admin-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #1e293b;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.table-credit-pill {
    background: #eff6ff;
    color: #1d4ed8;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 12px;
    display: inline-block;
}

.table-btn-topup {
    background: #e0f2fe;
    border: 1px solid #bae6fd;
    color: #0369a1;
    font-weight: 600;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 4px;
}

.table-btn-topup:hover {
    background: #bae6fd;
}

/* ── Mobile Modal & Auth Polish (Max-Width 600px) ───────────────── */
@media (max-width: 600px) {
    .app-modal {
        width: 93% !important;
        max-width: 93% !important;
        padding: 18px 16px !important;
        border-radius: 14px !important;
        max-height: 88vh !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal-header {
        padding-bottom: 12px !important;
        margin-bottom: 14px !important;
        gap: 8px;
    }

    .modal-title-box h2 {
        font-size: 17px !important;
        line-height: 1.25 !important;
    }

    .modal-subtitle {
        font-size: 12px !important;
        line-height: 1.4 !important;
    }

    .modal-badge {
        font-size: 10px !important;
        padding: 2px 7px !important;
        margin-bottom: 4px !important;
    }

    .modal-close-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 15px !important;
        flex-shrink: 0;
    }

    /* Auth Modal Specifics on Mobile */
    .auth-modal {
        max-width: 390px !important;
        padding: 18px 16px !important;
    }

    .auth-modal-body {
        gap: 12px !important;
    }

    .btn-google-direct {
        padding: 10px 14px !important;
        font-size: 13.5px !important;
        min-height: 44px !important;
    }

    .auth-divider {
        font-size: 11px !important;
        margin: 2px 0 !important;
    }

    .auth-tabs {
        padding: 3px !important;
        gap: 3px !important;
    }

    .auth-tab-btn {
        padding: 7px 10px !important;
        font-size: 12px !important;
    }

    .auth-field-group {
        margin-bottom: 10px !important;
        gap: 4px !important;
    }

    .auth-field-group label {
        font-size: 11.5px !important;
    }

    /* 16px font-size prevents mobile browsers (iOS Safari & Android Chrome) from auto-zooming in on input focus */
    .auth-field-group input {
        padding: 10px 12px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
        box-sizing: border-box !important;
    }

    .auth-submit-btn {
        padding: 11px !important;
        font-size: 13.5px !important;
        min-height: 44px !important;
        margin-top: 6px !important;
    }

    /* Admin Modal Mobile */
    .admin-modal {
        max-width: 94% !important;
        padding: 16px 12px !important;
    }

    .admin-input-row {
        flex-direction: column;
    }

    .admin-input {
        min-width: 100% !important;
        font-size: 16px !important;
    }

    .admin-input-num {
        max-width: 100% !important;
    }
}




