/* ============================================================
   OCCI Podcasts — Main Stylesheet
   ============================================================ */

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

:root {
    --clr-brand:       #7b4f9e;   /* purple — OCCI accent */
    --clr-brand-dark:  #5e3478;
    --clr-brand-light: #f3eefa;
    --clr-success:     #1e8a44;
    --clr-danger:      #c0392b;
    --clr-warning:     #d68910;
    --clr-info:        #1a6fa8;
    --clr-text:        #1a1a1a;
    --clr-muted:       #6b7280;
    --clr-border:      #e2e5ea;
    --clr-bg:          #f7f8fc;
    --clr-surface:     #ffffff;

    --radius:   8px;
    --shadow:   0 1px 4px rgba(0,0,0,.08);
    --shadow-lg:0 4px 16px rgba(0,0,0,.1);
    --font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono:     'SF Mono', 'Fira Code', monospace;
    --max-w:    1100px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--clr-text);
    background: var(--clr-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a  { color: var(--clr-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1.05rem; font-weight: 600; }

/* ----------------------------------------------------------
   2. Layout
   ---------------------------------------------------------- */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1.25rem; }

/* ----------------------------------------------------------
   3. Header
   ---------------------------------------------------------- */
.site-header {
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    position: sticky; top: 0; z-index: 100;
}
.site-header .container {
    display: flex; align-items: center; justify-content: space-between;
    height: 56px;
}
.site-logo {
    display: flex; align-items: center; gap: .5rem;
    font-weight: 700; font-size: 1rem; color: var(--clr-brand);
    text-decoration: none;
}
.site-logo svg { width: 28px; height: 28px; }
.site-nav { display: flex; align-items: center; gap: 1.25rem; }
.site-nav a {
    color: var(--clr-text); font-size: .9rem; font-weight: 500;
    text-decoration: none; opacity: .8;
}
.site-nav a:hover { opacity: 1; }
.nav-user {
    position: relative; display: flex; align-items: center; gap: .5rem;
    cursor: pointer; font-size: .9rem;
}
.nav-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.nav-avatar-initial {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--clr-brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700;
}
.nav-dropdown {
    display: none; position: absolute; top: 100%; right: 0;
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: .5rem; min-width: 140px;
    box-shadow: var(--shadow-lg); flex-direction: column; gap: .25rem;
}
.nav-user:hover .nav-dropdown { display: flex; }
.nav-dropdown a, .nav-dropdown button {
    display: block; width: 100%; padding: .4rem .6rem;
    border-radius: 4px; text-align: left; cursor: pointer;
    border: none; background: none; font: inherit; color: inherit; font-size: .875rem;
}
.nav-dropdown a:hover, .nav-dropdown button:hover { background: var(--clr-bg); }

/* ----------------------------------------------------------
   4. Main content
   ---------------------------------------------------------- */
.main-content { flex: 1; padding: 2rem 0; }
.site-footer {
    background: var(--clr-surface); border-top: 1px solid var(--clr-border);
    padding: 1rem 0; text-align: center; font-size: .8rem; color: var(--clr-muted);
}

/* ----------------------------------------------------------
   5. Cards
   ---------------------------------------------------------- */
.card {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}
.card-section-title {
    margin-bottom: 1.25rem; padding-bottom: .75rem;
    border-bottom: 1px solid var(--clr-border); font-size: 1rem;
}

/* ----------------------------------------------------------
   6. Buttons
   ---------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .5rem 1rem; border-radius: var(--radius);
    font-weight: 600; font-size: .875rem; line-height: 1;
    border: 1.5px solid transparent; cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
    text-decoration: none;
}
.btn--primary  { background: var(--clr-brand); color: #fff; border-color: var(--clr-brand); }
.btn--primary:hover { background: var(--clr-brand-dark); border-color: var(--clr-brand-dark); text-decoration: none; }
.btn--outline  { background: transparent; color: var(--clr-brand); border-color: var(--clr-brand); }
.btn--outline:hover { background: var(--clr-brand-light); text-decoration: none; }
.btn--danger   { background: var(--clr-danger); color: #fff; border-color: var(--clr-danger); }
.btn--danger:hover { opacity: .9; }
.btn--sm  { padding: .35rem .75rem; font-size: .8rem; }
.btn--xs  { padding: .2rem .55rem; font-size: .75rem; }
.btn--full { width: 100%; }

/* ----------------------------------------------------------
   7. Forms
   ---------------------------------------------------------- */
.form-group  { margin-bottom: 1.1rem; }
.form-row    { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-col    { flex: 1; min-width: 0; }
.form-col--narrow { flex: 0 0 100px; }
.form-col--grow   { flex: 2; }

label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .3rem; }
.form-control {
    display: block; width: 100%; padding: .5rem .75rem;
    border: 1.5px solid var(--clr-border); border-radius: var(--radius);
    font: inherit; font-size: .9rem; background: var(--clr-surface);
    transition: border-color .15s; color: var(--clr-text);
}
.form-control:focus { outline: none; border-color: var(--clr-brand); }
.form-control:disabled { background: var(--clr-bg); color: var(--clr-muted); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint  { font-size: .78rem; color: var(--clr-muted); margin-top: .25rem; }
.form-actions { display: flex; gap: .75rem; margin-top: 1.5rem; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; cursor: pointer; font-weight: 400; }
.checkbox-label input { width: auto; }
.required { color: var(--clr-danger); }
.input-file { display: none; }

/* ----------------------------------------------------------
   8. Alerts
   ---------------------------------------------------------- */
.alert {
    padding: .75rem 1rem; border-radius: var(--radius);
    margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent;
}
.alert--success { background: #d4edda; color: #155724; border-color: #c3e6cb; }
.alert--error   { background: #f8d7da; color: #721c24; border-color: #f5c6cb; }
.alert--warning { background: #fff3cd; color: #856404; border-color: #ffeeba; }
.alert--info    { background: #cce5ff; color: #004085; border-color: #b8daff; }

/* ----------------------------------------------------------
   9. Status badges
   ---------------------------------------------------------- */
.status-badge {
    display: inline-block; padding: .15rem .5rem; border-radius: 999px;
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.status-badge--published, .status-badge--completed { background: #d4edda; color: #155724; }
.status-badge--draft     { background: #e2e5ea; color: #4a5568; }
.status-badge--running   { background: #cce5ff; color: #004085; }
.status-badge--pending   { background: #fff3cd; color: #856404; }
.status-badge--failed    { background: #f8d7da; color: #721c24; }

.badge { display: inline-block; padding: .15rem .5rem; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.badge--explicit { background: #f8d7da; color: #721c24; }
.badge--role     { background: var(--clr-brand-light); color: var(--clr-brand); }

/* ----------------------------------------------------------
   10. Page header
   ---------------------------------------------------------- */
.page-header {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 1.75rem; gap: 1rem; flex-wrap: wrap;
}
.page-header__left { display: flex; align-items: center; gap: 1rem; }
.page-header__art  { width: 72px; height: 72px; border-radius: var(--radius); object-fit: cover; }
.page-header__actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: flex-start; }
.page-subtitle { color: var(--clr-muted); font-size: .9rem; margin-top: .25rem; }
.breadcrumb { font-size: .8rem; color: var(--clr-muted); margin-bottom: .25rem; }
.breadcrumb a { color: var(--clr-muted); }
.breadcrumb a:hover { color: var(--clr-brand); }

/* ----------------------------------------------------------
   11. Podcast grid
   ---------------------------------------------------------- */
.podcast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
.podcast-card {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); overflow: hidden; text-decoration: none;
    color: var(--clr-text); transition: box-shadow .15s;
}
.podcast-card:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.podcast-card__art {
    width: 100%; aspect-ratio: 1/1; object-fit: cover;
    background: var(--clr-brand-light);
}
.podcast-card__art--placeholder {
    display: flex; align-items: center; justify-content: center;
}
.podcast-card__art--placeholder svg { width: 48px; height: 48px; color: var(--clr-brand); opacity: .4; }
.podcast-card__body { padding: .875rem; }
.podcast-card__title { font-size: .95rem; font-weight: 600; margin-bottom: .25rem; }
.podcast-card__meta  { font-size: .78rem; color: var(--clr-muted); }

/* ----------------------------------------------------------
   12. Episode list
   ---------------------------------------------------------- */
.episode-list { display: flex; flex-direction: column; gap: .75rem; }
.episode-row {
    display: flex; align-items: center; gap: 1rem;
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: .875rem 1rem;
}
.episode-row__art {
    width: 56px; height: 56px; border-radius: 6px; flex-shrink: 0; object-fit: cover;
    background: var(--clr-brand-light);
}
.episode-row__art--placeholder {
    display: flex; align-items: center; justify-content: center;
}
.episode-row__art--placeholder svg { width: 28px; color: var(--clr-brand); opacity: .4; }
.episode-row__body { flex: 1; min-width: 0; }
.episode-row__top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .2rem; }
.episode-row__title { font-weight: 600; font-size: .95rem; color: var(--clr-text); }
.episode-row__title:hover { text-decoration: underline; }
.episode-row__meta { font-size: .78rem; color: var(--clr-muted); }
.episode-row__actions { flex-shrink: 0; }

/* ----------------------------------------------------------
   13. Audio player
   ---------------------------------------------------------- */
.audio-player-card {}
.audio-player { width: 100%; display: block; margin-bottom: .5rem; }
.audio-meta { display: flex; gap: 1rem; align-items: center; font-size: .8rem; color: var(--clr-muted); }
.audio-meta-tag {
    background: var(--clr-bg); padding: .2rem .5rem; border-radius: 4px; font-size: .78rem;
}
.current-audio { margin-bottom: 1rem; }

/* ----------------------------------------------------------
   14. Upload zones
   ---------------------------------------------------------- */
.upload-zone {
    border: 2px dashed var(--clr-border); border-radius: var(--radius);
    padding: 1.5rem; text-align: center; cursor: pointer;
    transition: border-color .15s, background .15s;
    display: flex; flex-direction: column; align-items: center; gap: .5rem;
    color: var(--clr-muted);
}
.upload-zone:hover { border-color: var(--clr-brand); background: var(--clr-brand-light); }
.upload-zone svg { width: 36px; height: 36px; opacity: .5; }
.upload-zone small { font-size: .75rem; }

.artwork-upload { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.artwork-preview { width: 100px; height: 100px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--clr-border); }
.artwork-preview-wrap { display: flex; flex-direction: column; gap: .5rem; align-items: center; }

/* ----------------------------------------------------------
   15. Table
   ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse; font-size: .875rem;
    background: var(--clr-surface); border-radius: var(--radius);
    overflow: hidden; border: 1px solid var(--clr-border);
}
.table th {
    background: var(--clr-bg); padding: .65rem 1rem; text-align: left;
    font-weight: 600; font-size: .8rem; color: var(--clr-muted);
    border-bottom: 1px solid var(--clr-border);
}
.table td { padding: .7rem 1rem; border-bottom: 1px solid var(--clr-border); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--clr-bg); }
.td-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table-user { display: flex; align-items: center; gap: .5rem; }
.table-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.table-avatar--initial {
    background: var(--clr-brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700;
}

/* ----------------------------------------------------------
   16. Section headers
   ---------------------------------------------------------- */
.section { margin-top: 2rem; }
.section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem;
}

/* ----------------------------------------------------------
   17. Season tabs
   ---------------------------------------------------------- */
.season-tabs { display: flex; flex-wrap: wrap; gap: .5rem; }
.season-chip {
    display: flex; align-items: center; gap: .5rem;
    background: var(--clr-brand-light); border: 1px solid var(--clr-brand);
    border-radius: 999px; padding: .3rem .75rem; font-size: .8rem;
}
.season-chip__edit { font-size: .72rem; color: var(--clr-brand); }

/* ----------------------------------------------------------
   18. Source tabs (import)
   ---------------------------------------------------------- */
.source-tabs { display: flex; gap: .75rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.source-tab {
    flex: 1; min-width: 150px;
    display: flex; align-items: center;
}
.source-tab input[type="radio"] { display: none; }
.source-tab span {
    flex: 1; display: flex; align-items: center; gap: .5rem;
    padding: .75rem 1rem; border: 2px solid var(--clr-border);
    border-radius: var(--radius); cursor: pointer; font-size: .875rem;
    transition: border-color .15s, background .15s;
}
.source-tab input:checked + span {
    border-color: var(--clr-brand); background: var(--clr-brand-light);
    font-weight: 600;
}
.source-tab span img { width: 20px; height: 20px; }
.source-tab span svg { width: 20px; height: 20px; color: var(--clr-brand); }

/* ----------------------------------------------------------
   19. Progress bar
   ---------------------------------------------------------- */
.progress-section { margin: 1.25rem 0; }
.progress-bar-wrap {
    height: 8px; background: var(--clr-border); border-radius: 999px; overflow: hidden;
}
.progress-bar {
    height: 100%; background: var(--clr-brand);
    border-radius: 999px; transition: width .4s ease;
}
.progress-label { font-size: .8rem; color: var(--clr-muted); margin-top: .4rem; }
.import-status-text { font-size: .85rem; margin-top: .25rem; }
.import-meta { margin-bottom: 1rem; }
.import-log { margin-top: 1rem; }
.import-log pre {
    background: #1a1a1a; color: #e2e8f0; padding: 1rem; border-radius: var(--radius);
    font-size: .75rem; max-height: 300px; overflow-y: auto; white-space: pre-wrap;
    font-family: var(--mono);
}

/* ----------------------------------------------------------
   20. Metadata list
   ---------------------------------------------------------- */
.meta-list {
    display: grid; grid-template-columns: 140px 1fr; gap: .4rem .75rem;
    font-size: .875rem;
}
.meta-list dt { color: var(--clr-muted); font-weight: 500; }

/* ----------------------------------------------------------
   21. Rich content (episode show notes rendered HTML)
   ---------------------------------------------------------- */
.rich-content { line-height: 1.75; }
.rich-content p { margin-bottom: .8rem; }
.rich-content h1, .rich-content h2, .rich-content h3 { margin-top: 1.25rem; margin-bottom: .5rem; }
.rich-content ul, .rich-content ol { margin-left: 1.5rem; margin-bottom: .8rem; }
.rich-content a { color: var(--clr-brand); }
.rich-content blockquote {
    border-left: 4px solid var(--clr-border); padding-left: 1rem; color: var(--clr-muted);
}

/* ----------------------------------------------------------
   22. Danger zone
   ---------------------------------------------------------- */
.danger-zone {
    margin-top: 3rem; border: 1px solid #f5c6cb; border-radius: var(--radius);
}
.danger-zone summary {
    padding: .75rem 1rem; cursor: pointer; font-weight: 600; color: var(--clr-danger);
    font-size: .875rem;
}
.danger-zone__body { padding: 1rem; border-top: 1px solid #f5c6cb; font-size: .875rem; }
.danger-zone__body p { margin-bottom: .75rem; color: var(--clr-muted); }

/* ----------------------------------------------------------
   23. Episode detail
   ---------------------------------------------------------- */
.episode-detail { display: flex; flex-direction: column; gap: 1.25rem; }

/* ----------------------------------------------------------
   24. Auth pages
   ---------------------------------------------------------- */
.auth-wrap {
    display: flex; justify-content: center; align-items: center;
    min-height: calc(100vh - 56px); padding: 2rem;
}
.auth-box {
    background: var(--clr-surface); border: 1px solid var(--clr-border);
    border-radius: var(--radius); padding: 2.5rem; width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
}
.auth-logo { display: flex; justify-content: center; margin-bottom: 1rem; }
.auth-logo svg { width: 56px; height: 56px; color: var(--clr-brand); }
.auth-box h1 { text-align: center; font-size: 1.5rem; margin-bottom: .25rem; }
.auth-subtitle { text-align: center; color: var(--clr-muted); font-size: .875rem; margin-bottom: 1.5rem; }

/* ----------------------------------------------------------
   25. Empty state
   ---------------------------------------------------------- */
.empty-state {
    text-align: center; padding: 4rem 2rem;
    border: 2px dashed var(--clr-border); border-radius: var(--radius);
}
.empty-state svg { width: 56px; height: 56px; color: var(--clr-brand); opacity: .3; margin: 0 auto 1rem; }
.empty-state h2 { margin-bottom: .5rem; }
.empty-state p  { color: var(--clr-muted); margin-bottom: 1.25rem; }
.empty-state-actions { display: flex; gap: .75rem; justify-content: center; }
.empty-state--sm { padding: 2rem; }

/* ----------------------------------------------------------
   26. Error page
   ---------------------------------------------------------- */
.error-page { text-align: center; padding: 4rem 2rem; }
.error-code { font-size: 6rem; font-weight: 800; color: var(--clr-brand); opacity: .2; line-height: 1; }
.error-page h1 { margin-bottom: .5rem; }
.error-page p  { color: var(--clr-muted); margin-bottom: 1.5rem; }

/* ----------------------------------------------------------
   27. Muted hint
   ---------------------------------------------------------- */
.muted-hint { font-size: .85rem; color: var(--clr-muted); margin-bottom: 1rem; }

/* ----------------------------------------------------------
   28. Responsive tweaks
   ---------------------------------------------------------- */
@media (max-width: 640px) {
    .form-row    { flex-direction: column; }
    .form-col    { flex: unset; width: 100%; }
    .form-col--narrow { flex: unset; width: 100%; }
    .page-header { flex-direction: column; }
    .page-header__actions { width: 100%; }
    .source-tabs { flex-direction: column; }
    .podcast-grid { grid-template-columns: repeat(2, 1fr); }
    .meta-list { grid-template-columns: 1fr; }
    .meta-list dt { margin-top: .5rem; }
}
