/* ==========================================================
   Title: styles.css
   Version: 2.24.0
   Folder: assets/css/
   ========================================================== */

/* --- Section 1: Design Tokens --- */
:root {
    --white: #f4f8fc;
    --background: #e9eff5;
    --text-dark: #1a1a1a;
    --text-muted: #5f6365;
    --navy: #1b2a4a;
    --navy-hover: #0f1d33;
    --gold: #c5a059;
    --gold-hover: #b08d45;
    --gold-light: #fdf8ef;
    --border-color: #d4dce6;
    --shadow-subtle: 0 2px 8px rgba(27, 42, 74, 0.06);
    --radius: 4px;
    --max-width: 720px;

    --admin-bg: #f4f5f7;
    --admin-text: #333;
    --admin-card-bg: #fff;
    --admin-card-border: #e0e4e8;
    --admin-card-shadow: rgba(0, 0, 0, 0.05);
    --admin-heading: #1b2a4a;
    --admin-subtext: #666;
    --admin-input-border: #ccc;
    --admin-input-bg: #fff;
    --admin-error-bg: #ffecec;
    --admin-error-text: #d93025;
    --admin-error-border: #d93025;
    --admin-warning-bg: #fff8e1;
    --admin-warning-text: #8a6d3b;
    --admin-warning-border: #c5a059;
    --admin-gold: #c5a059;
    --admin-gold-hover: #b08d45;
    --admin-gold-light: #fdf8ef;
    --admin-navy: #1b2a4a;
    --admin-label-color: #444;
    --admin-input-focus-shadow: rgba(197, 160, 89, 0.2);
    --admin-active-subtext: #888;
    --admin-list-border: #eee;
}

/* --- Section 2: Dark Mode Design Tokens --- */
[data-theme="dark"] {
    --white: #1e1e1e;
    --background: #121212;
    --text-dark: #e1e1e1;
    --text-muted: #9e9e9e;
    --border-color: #333;
    --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.4);
    --gold-light: #2a2215;

    --admin-bg: #121212;
    --admin-text: #e0e0e0;
    --admin-card-bg: #1e1e1e;
    --admin-card-border: #333;
    --admin-card-shadow: rgba(0, 0, 0, 0.3);
    --admin-heading: #fff;
    --admin-subtext: #aaa;
    --admin-input-border: #555;
    --admin-input-bg: #2a2a2a;
    --admin-error-bg: #3c1111;
    --admin-error-text: #ff6b6b;
    --admin-error-border: #ff6b6b;
    --admin-warning-bg: #3e3520;
    --admin-warning-text: #d4a843;
    --admin-warning-border: #d4a843;
    --admin-gold: #d4af37;
    --admin-gold-hover: #c5a059;
    --admin-gold-light: #2a2215;
    --admin-navy: #1b2a4a;
    --admin-label-color: #ccc;
    --admin-input-focus-shadow: rgba(212, 175, 55, 0.3);
    --admin-active-subtext: #999;
    --admin-list-border: #333;
}

/* --- Section 3: Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    margin: 0 0 0.5rem 0;
    font-weight: 700;
    line-height: 1.3;
    color: var(--navy);
}

p { margin: 0 0 1rem 0; }

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* --- Section 4: Header --- */
.site-header {
    background: var(--navy);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: var(--max-width);
    margin: 0 auto;
    border-radius: 0 0 8px 8px;
}

.header-flex {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.25rem;
}

.logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 50%;
    background: var(--white);
    padding: 3px;
}

.header-text h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

/* --- Section 5: Theme Toggle Button --- */
.theme-toggle-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    transition: border-color 0.2s ease;
}

.theme-toggle-btn:hover { border-color: var(--gold); }
.theme-icon-dark { display: none; }
.theme-icon-light { display: inline; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* --- Section 6: Featured Study --- */
.featured-study {
    padding: 2rem 0 1rem;
    position: relative;
    z-index: 1;
}

.study-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-subtle);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.featured-label {
    display: inline-block;
    background: var(--gold);
    color: var(--navy);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.study-meta {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    line-height: 1.5;
}

.meta-divider { color: var(--border-color); }
.study-summary { clear: both; }
.study-summary p { font-size: 1.05rem; color: #444; }

/* --- Section 7: Buttons --- */
.study-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--navy);
    color: var(--white);
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}

.btn-primary:hover { background: var(--navy-hover); }

.btn-secondary {
    background: var(--white);
    color: var(--navy);
    border: 2px solid var(--gold);
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: var(--gold);
    color: var(--white);
}

.btn-small { padding: 0.5rem 1rem; font-size: 0.85rem; }

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: var(--navy);
    color: var(--white);
    border-color: var(--navy);
}

/* --- Section 8: Audio Player --- */
.audio-wrapper {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

audio { display: none; }

.custom-audio-player {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.audio-time-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
}

.audio-seek-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius);
    outline: none;
    cursor: pointer;
}

.audio-seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.audio-seek-slider::-webkit-slider-thumb:hover { background: var(--gold-hover); }

.audio-seek-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

/* --- Section 9: Speed Controls --- */
.speed-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
}

.speed-label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.8rem;
}

.speed-control-btn {
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.speed-control-btn.active-speed {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold);
}

.speed-control-btn:hover { border-color: var(--navy); }

/* --- Section 10: Global Form Elements --- */
input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
input[type="number"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 16px;
    background: var(--white);
    color: var(--text-dark);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--navy);
}

/* --- Section 11: Archive --- */
.archive {
    padding: 1rem 0 1.5rem;
    position: relative;
    z-index: 1;
}

.section-heading {
    text-align: center;
    margin-bottom: 2rem;
}

.section-heading h2 { font-size: 1.5rem; }
.section-heading p { color: var(--text-muted); margin-bottom: 0; }

/* --- Section 12: Search Bar --- */
.search-container { margin-bottom: 2rem; }

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.85rem 1rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--white);
    color: var(--text-dark);
    transition: border-color 0.2s;
    display: block;
}

.search-input:focus {
    outline: none;
    border-color: var(--navy);
}

/* --- Section 13: Empty State --- */
.empty-state-container {
    display: flex;
    justify-content: center;
}

.empty-state-card {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.empty-state-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.clear-search-inline {
    color: var(--gold);
    text-decoration: underline;
    font-size: 0.85rem;
    margin-left: 0.5rem;
}

/* --- Section 14: Offline Splash Screen --- */
#offline-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.offline-content {
    text-align: center;
    padding: 2rem;
    max-width: 400px;
}

.offline-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.offline-content h2 { margin-bottom: 1rem; }
.offline-content p { color: var(--text-muted); }

.offline-retry-btn {
    margin-top: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gold);
    color: var(--navy);
    border: none;
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    transition: background 0.2s;
}

.offline-retry-btn:hover { background: var(--gold-hover); }

/* --- Section 15: Archive Grid & Cards --- */
.archive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.archive-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: box-shadow 0.2s ease, border-left 0.2s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.archive-card:hover {
    box-shadow: 0 4px 12px rgba(27, 42, 74, 0.08);
}

.archive-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.archive-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.archive-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: auto;
}

.archive-buttons .btn {
    width: 100%;
    text-align: center;
}

.is-now-playing {
    border-left: 4px solid var(--gold) !important;
}

/* --- Section 16: Accordion / Folder Structure --- */
.archive-accordion {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.accordion-year-header {
    background: var(--navy);
    color: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.accordion-year-header:hover { background: var(--navy-hover); }

.accordion-year-header .accordion-icon {
    transition: transform 0.3s ease;
    font-size: 1rem;
    min-width: 20px;
    text-align: center;
}

.accordion-year-header.active .accordion-icon { transform: rotate(90deg); }

.accordion-year-content {
    display: none;
    padding: 0.75rem 0 0.75rem 1rem;
    margin-top: 0.5rem;
    border-left: 3px solid var(--gold);
    margin-left: 0.5rem;
}

.accordion-month { margin-bottom: 0.5rem; }

.accordion-month-header {
    background: var(--white);
    color: var(--navy);
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.accordion-month-header:hover {
    background: var(--gold-light);
    border-color: var(--gold);
}

.accordion-month-header .accordion-icon {
    transition: transform 0.3s ease;
    font-size: 0.85rem;
    color: var(--gold);
    min-width: 20px;
    text-align: center;
}

.accordion-month-header.active .accordion-icon { transform: rotate(90deg); }

.accordion-month-content {
    display: none;
    padding: 0.75rem 0 0;
}

.accordion-month-content .archive-card { margin-bottom: 0.75rem; }
.accordion-month-content .archive-card:last-child { margin-bottom: 0; }

/* --- Section 17: Floating Now Playing Bar --- */
.floating-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: 100%;
    background: var(--navy);
    color: #fff;
    padding: 0.75rem 1.25rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    display: block;
    overflow: hidden;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 9999;
}

.floating-player.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.floating-player-info {
    overflow: hidden;
}

.floating-player-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: pre-line;
}

.floating-player-controls {
    float: right;
    display: flex;
    gap: 0.5rem;
    margin-left: 0.75rem;
    margin-bottom: 0.25rem;
}

.btn-floating {
    background: var(--gold);
    color: var(--white);
    border: none;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-floating:hover { background: var(--gold-hover); }

/* --- Section 18: Footer --- */
.site-footer {
    background: var(--navy);
    border-top: 3px solid var(--gold);
    text-align: center;
    padding: 1.25rem 0;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 1;
    transition: margin-bottom 0.3s ease;
}

.site-footer.player-active { margin-bottom: 5rem; }
.mobile-break { display: inline; }

.footer-download-link {
    margin: 0;
    padding-top: 0.25rem;
}

.footer-download-link a {
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-download-link a:hover {
    color: #fff;
    text-decoration: underline;
}

@supports (-webkit-touch-callout: none) and (pointer: coarse) {
    .app-download-link { display: none; }
}

/* --- Section 19: Install App Button --- */
.install-app-container {
    text-align: center;
    margin-top: 1rem;
    padding-bottom: 0.5rem;
    display: none;
}

.btn-install-app {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-install-app:hover {
    border-color: var(--gold);
    color: var(--gold);
}

/* ==========================================================
   Section 20: Share & Favorites (App-Only Features)
   ========================================================== */

/* --- Action Row on Cards --- */
.card-action-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* --- Action Buttons (Share + Star) --- */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.btn-action svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.btn-action:hover {
    color: var(--navy);
    border-color: var(--navy);
    background: var(--gold-light);
}

.btn-action:active {
    transform: scale(0.96);
}

/* Star button — active state */
.btn-action-star.is-starred {
    color: var(--gold);
    border-color: var(--gold);
    background: var(--gold-light);
}

.btn-action-star.is-starred:hover {
    color: var(--gold-hover);
    border-color: var(--gold-hover);
}

/* Hide text label on very small screens, icon only */
.btn-action-label {
    display: inline;
}

/* --- Share Toast --- */
#share-toast {
    position: fixed;
    bottom: 5.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--navy);
    color: #fff;
    padding: 0.6rem 1.25rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    z-index: 10000;
    pointer-events: none;
    white-space: nowrap;
}

#share-toast.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* --- Star Filter Chip (App Only) --- */
.star-filter-wrapper {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
}

.star-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.star-filter-btn svg {
    flex-shrink: 0;
    width: 13px;
    height: 13px;
}

.star-filter-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.star-filter-btn.is-active {
    background: var(--gold);
    color: var(--white);
    border-color: var(--gold);
}

.star-filter-btn.is-active:hover {
    background: var(--gold-hover);
    border-color: var(--gold-hover);
}

.star-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.25);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.star-filter-btn:not(.is-active) .star-filter-count {
    background: var(--border-color);
    color: var(--text-muted);
}

/* --- App Tabs (App Only) --- */
.app-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.app-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
    line-height: 1;
}

.app-tab:hover {
    color: var(--navy);
}

.app-tab.is-active {
    color: var(--navy);
    border-bottom-color: var(--gold);
}

/* --- Favorites Panel (App Only) --- */
.favorites-panel {
    padding: 0 0 1.5rem;
}

.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.favorites-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.favorites-item:hover {
    border-color: var(--gold);
    box-shadow: var(--shadow-subtle);
}

.favorites-item-info {
    flex: 1;
    min-width: 0;
}

.favorites-item-info h3 {
    font-size: 1rem;
    margin: 0 0 0.2rem;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorites-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.favorites-item-meta span {
    display: inline;
}

.favorites-item-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color 0.2s ease;
}

.favorites-item:hover .favorites-item-arrow {
    color: var(--gold);
}

.favorites-empty {
    text-align: center;
    padding: 3rem 2rem;
}

.favorites-empty-icon {
    display: block;
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.favorites-empty p {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Filter hiding utility — uses class to avoid
   conflicting with accordion display toggling */
.star-filter-hidden {
    display: none !important;
}

/* --- Section 21: Dark Mode Overrides --- */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4 { color: var(--text-dark); }

[data-theme="dark"] .study-summary p { color: #b0b0b0; }

[data-theme="dark"] .btn-secondary { color: var(--text-dark); border-color: var(--gold); }
[data-theme="dark"] .btn-secondary:hover { color: #1b2a4a; }
[data-theme="dark"] .btn-outline { color: var(--text-dark); }
[data-theme="dark"] .speed-control-btn { color: var(--text-dark); }
[data-theme="dark"] .accordion-month-header { color: var(--text-dark); }

[data-theme="dark"] .accordion-year-header {
    background: #2a3f6f;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .accordion-year-header:hover { background: #354e85; }
[data-theme="dark"] .audio-seek-slider { background: #444; }
[data-theme="dark"] .audio-time-row { color: var(--text-dark); }
[data-theme="dark"] .search-input { background: #2c2c2c; }

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #777; }

[data-theme="dark"] a { color: var(--gold); }

/* Dark Mode: Share & Favorites */
[data-theme="dark"] .btn-action {
    color: var(--text-muted);
    border-color: #444;
}

[data-theme="dark"] .btn-action:hover {
    color: var(--text-dark);
    border-color: var(--text-dark);
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .btn-action-star.is-starred {
    color: var(--admin-gold);
    border-color: var(--admin-gold);
    background: var(--admin-gold-light);
}

[data-theme="dark"] .card-action-row {
    border-top-color: #333;
}

[data-theme="dark"] .star-filter-btn {
    color: var(--text-muted);
    border-color: #444;
}

[data-theme="dark"] .star-filter-btn:hover {
    border-color: var(--admin-gold);
    color: var(--admin-gold);
}

[data-theme="dark"] .star-filter-btn:not(.is-active) .star-filter-count {
    background: #444;
    color: var(--text-muted);
}

[data-theme="dark"] .app-tabs {
    border-bottom-color: #333;
}

[data-theme="dark"] .app-tab {
    color: var(--text-muted);
}

[data-theme="dark"] .app-tab:hover {
    color: var(--text-dark);
}

[data-theme="dark"] .app-tab.is-active {
    color: var(--text-dark);
    border-bottom-color: var(--admin-gold);
}

[data-theme="dark"] .favorites-item {
    background: var(--admin-card-bg);
    border-color: #333;
}

[data-theme="dark"] .favorites-item:hover {
    border-color: var(--admin-gold);
}

[data-theme="dark"] .favorites-item-info h3 {
    color: var(--admin-heading);
}

[data-theme="dark"] .favorites-item-meta {
    color: var(--admin-subtext);
}

[data-theme="dark"] #share-toast {
    background: #333;
    color: var(--text-dark);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

/* ==========================================================
   Section 22: Admin Portal Styles
   ========================================================== */

body.admin-body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

.admin-header {
    background: var(--admin-navy);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 1100px;
    margin: 0 auto;
    border-radius: 0 0 8px 8px;
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* FIX: Bumped selector to .admin-header .header-inner h1 (0,2,1)
   so it beats both the global h1 (0,0,1) and the dark-mode
   [data-theme="dark"] h1 (0,1,1). Uses explicit white instead of
   inherit to guarantee the value regardless of parent chain. */
.admin-header .header-inner h1 {
    margin: 0;
    font-size: 1.25rem;
    color: white;
}

.header-links { display: flex; gap: 1.5rem; align-items: center; }

.header-links a {
    color: var(--admin-gold);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.header-links a:hover { text-decoration: underline; }

.admin-theme-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--radius);
    transition: background 0.2s;
    line-height: 1;
    color: white;
}

.admin-theme-toggle:hover { background: rgba(255, 255, 255, 0.15); }

.admin-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.content-container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.success-msg {
    background: #e6f4ea;
    color: #1e8e3e;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-left: 4px solid #1e8e3e;
}

.error-msg {
    background: var(--admin-error-bg);
    color: var(--admin-error-text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    border-left: 4px solid var(--admin-error-border);
}

.form-card {
    background: var(--admin-card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--admin-card-shadow);
    border: 1px solid var(--admin-card-border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group { margin-bottom: 0; min-width: 0; }
.form-group.full-width { grid-column: 1 / -1; }

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--admin-label-color);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group textarea,
.form-group select {
    background: var(--admin-input-bg);
    color: var(--admin-text);
    border: 1px solid var(--admin-input-border);
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none;
    border-color: var(--admin-gold);
    box-shadow: 0 0 0 2px var(--admin-input-focus-shadow);
}

.file-hint { display: block; margin-top: 0.35rem; font-size: 0.8rem; color: var(--admin-subtext); font-style: italic; }

.delete-checkbox-group {
    display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; padding: 0.5rem;
    background: var(--admin-gold-light); border: 1px solid var(--admin-gold); border-radius: var(--radius);
}

.delete-checkbox-group label {
    display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; cursor: pointer; margin-bottom: 0; font-size: 0.85rem; color: var(--admin-gold);
}

.delete-checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: #d93025; }

.checkbox-group { display: flex; gap: 2rem; align-items: center; padding-top: 1.5rem; flex-wrap: wrap; }

.checkbox-group label { display: flex; align-items: flex-start; gap: 0.5rem; font-weight: 500; cursor: pointer; margin-bottom: 0; line-height: 1.4; }
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--admin-navy); margin-top: 2px; flex-shrink: 0; }

.checkbox-label-text { display: flex; flex-direction: column; }
.checkbox-label-text .label-main { color: var(--admin-label-color); }
.checkbox-label-text .label-sub { font-size: 0.78rem; color: var(--admin-active-subtext); font-weight: 400; }

.btn-submit {
    margin-top: 2rem;
    padding: 0.85rem 2rem;
    background: var(--admin-gold);
    color: var(--admin-navy);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-submit:hover { background: var(--admin-gold-hover); }

/* --- Admin Accordion --- */
.month-group {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-card-border);
    border-radius: 8px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px var(--admin-card-shadow);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
}

.month-summary {
    padding: 1.25rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--admin-heading);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
    user-select: none;
}

.month-summary::-webkit-details-marker { display: none; }

.month-summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.75rem;
    transition: transform 0.2s ease;
    font-size: 0.8rem;
}

.month-group[open] .month-summary::before { transform: rotate(90deg); }
.month-group[open] .month-summary { border-bottom: 1px solid var(--admin-list-border); background: var(--admin-gold-light); }

.study-count-badge {
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--admin-list-border);
    color: var(--admin-subtext);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.study-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 0;
}

.study-item {
    background: var(--admin-bg);
    border: 1px solid var(--admin-list-border);
    border-radius: 6px;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.3s ease;
}

.study-item.is-featured {
    border-color: var(--admin-gold);
    border-left: 4px solid var(--admin-gold);
    box-shadow: 0 2px 8px rgba(197, 160, 89, 0.15);
    background: linear-gradient(to right, var(--admin-gold-light), var(--admin-bg) 40%);
}

.study-info { flex-grow: 1; min-width: 0; }

.study-info h3 {
    margin: 0 0 0.25rem;
    color: var(--admin-heading);
    word-wrap: break-word;
}

body.admin-body .study-meta {
    margin: 0;
    color: var(--admin-subtext);
    font-size: 0.85rem;
    word-wrap: break-word;
}

/* Keep admin actions from overriding public-site actions */
body.admin-body .study-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    vertical-align: middle;
}

.status-published { background: #e6f4ea; color: #1e8e3e; }
.status-draft { background: #fce8e6; color: #d93025; }
.status-featured { background: #fff8e1; color: #8a6d3b; border: 1px solid #c5a059; }

.btn-sm {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.btn-edit { background: #e8f0fe; color: #1a73e8; }
.btn-edit:hover { background: #d2e3fc; }

.btn-publish { background: #e6f4ea; color: #1e8e3e; }
.btn-publish:hover { background: #ceead6; }

.btn-unpublish { background: #fce8e6; color: #d93025; }
.btn-unpublish:hover { background: #f9d0cd; }

.btn-feature { background: #fff8e1; color: #8a6d3b; border: 1px solid #c5a059; }
.btn-feature:hover { background: #f5edda; }

.btn-unfeature { background: #f4f5f7; color: #777; border: 1px solid #ddd; }
.btn-unfeature:hover { background: #e8eaed; }

.btn-delete { background: #f4f5f7; color: #555; }
.btn-delete:hover { background: #d93025; color: white; }

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--admin-subtext);
    background: var(--admin-card-bg);
    border-radius: 8px;
    border: 1px solid var(--admin-card-border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* --- Section 23: Admin Dark Mode --- */
[data-theme="dark"] .status-published { background: #0d3320; color: #4caf50; }
[data-theme="dark"] .status-draft { background: #3c1111; color: #ff6b6b; }
[data-theme="dark"] .status-featured { background: #3e3520; color: #d4a843; border-color: #d4a843; }

[data-theme="dark"] .btn-edit { background: #1a2e44; color: #82b1ff; }
[data-theme="dark"] .btn-edit:hover { background: #253d59; }

[data-theme="dark"] .btn-publish { background: #0d3320; color: #4caf50; }
[data-theme="dark"] .btn-publish:hover { background: #15492d; }

[data-theme="dark"] .btn-unpublish { background: #3c1111; color: #ff6b6b; }
[data-theme="dark"] .btn-unpublish:hover { background: #4d1919; }

[data-theme="dark"] .btn-feature { background: #3e3520; color: #d4a843; border-color: #d4a843; }
[data-theme="dark"] .btn-feature:hover { background: #4f4429; }

[data-theme="dark"] .btn-unfeature { background: #2a2a2a; color: #aaa; border-color: #444; }
[data-theme="dark"] .btn-unfeature:hover { background: #333; }

[data-theme="dark"] .btn-delete { background: #2a2a2a; color: #bbb; }
[data-theme="dark"] .btn-delete:hover { background: #d93025; color: white; }

/* ==========================================================
   Section 24: Mobile Overrides
   ========================================================== */
@media (max-width: 767px) {
    .site-header {
        position: relative;
        top: auto;
        padding: 0.75rem 0;
    }

    .site-header,
    .admin-header {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .header-text h1 { font-size: 1.1rem; }

    .theme-toggle-btn {
        width: 44px;
        height: 44px;
    }

    .section-heading { margin-bottom: 1.5rem; }
    .search-container { margin-bottom: 1.5rem; }

    .study-card { padding: 1.25rem; }
    .featured-label { margin-bottom: 0.75rem; }

    .study-meta {
        margin-bottom: 1rem;
        font-size: 0.85rem;
    }

    .study-actions {
        margin: 1rem 0;
        gap: 0.5rem;
    }

    .audio-wrapper {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .speed-control-btn {
        min-height: 44px;
        padding: 0.5rem 0.75rem;
    }

    .archive-accordion { gap: 0.75rem; }
    .accordion-year-header { padding: 1rem 1.25rem; }
    .accordion-month { margin-bottom: 0.25rem; }
    .accordion-month-header { padding: 0.85rem 1.25rem; }

    .accordion-month-content .archive-card {
        padding: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .archive-card h3 {
        font-size: 1.05rem;
        margin-bottom: 0.25rem;
    }

    .archive-meta {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }

    .archive-buttons { gap: 0.4rem; }
    .archive-buttons .btn { min-height: 44px; font-size: 0.9rem; }

    .btn-floating {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem 1rem;
    }

    body.admin-body .study-item {
        flex-direction: column;
        align-items: flex-start;
    }

    body.admin-body .study-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .header-links { gap: 1rem; }

    /* Mobile: Share & Favorites */
    .card-action-row {
        gap: 0.4rem;
        padding-top: 0.6rem;
        margin-top: 0.75rem;
    }

    .btn-action {
        min-height: 38px;
        padding: 0.5rem 0.75rem;
        font-size: 0.78rem;
    }

    .btn-action svg {
        width: 15px;
        height: 15px;
    }

    .favorites-item {
        padding: 0.85rem 1rem;
    }

    .favorites-item-info h3 {
        font-size: 0.95rem;
    }

    .app-tab {
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    #share-toast {
        bottom: 5rem;
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}

/* ==========================================================
   Section 25: Tablet/Desktop
   ========================================================== */
@media (min-width: 768px) {
    .archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .floating-player {
        bottom: 20px;
        right: 20px;
        left: auto;
        width: auto;
        max-width: 380px;
        margin: 0;
        border-radius: 12px;
        padding: 1rem 1.5rem;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
        padding-bottom: 1rem;
    }

    .floating-player-title { font-size: 1rem; }

    .btn-floating {
        padding: 0.6rem 1.2rem;
        font-size: 1rem;
    }

    .site-footer,
    .site-footer.player-active { margin-bottom: 0; }
    .mobile-break { display: none; }
}

@media (min-width: 1024px) {
    .archive-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ==========================================================
   End of File: styles.css
   Version: 2.24.0
   Folder: assets/css/
   ========================================================== */