/* ABOUTME: Shared design system for PEPList UI. */
/* ABOUTME: Clean card light theme with indigo accent and responsive two-column layouts. */

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

:root {
    --bg: #f8f9fb;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --border: #e5e7eb;
    --input-bg: #f9fafb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --success: #22c55e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==================== NAV ==================== */

nav.site-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
}
nav.site-nav .logo {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
    text-decoration: none;
}
nav.site-nav .nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}
nav.site-nav .nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
}
nav.site-nav .nav-links a:hover {
    color: var(--text);
}

/* ==================== LAYOUTS ==================== */

.page {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.layout-two-col {
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1060px;
    margin: 2rem auto;
    gap: 2rem;
    padding: 0 1.5rem;
    align-items: start;
}

.layout-two-col .breadcrumb {
    grid-column: 1 / -1;
}

/* ==================== BREADCRUMB ==================== */

.breadcrumb {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.breadcrumb a {
    color: var(--primary);
    text-decoration: none;
}

/* ==================== BUTTONS ==================== */

.btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--input-bg);
    color: var(--text);
}
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}
.btn-danger:hover {
    background: var(--danger-light);
}
.btn-sm {
    padding: 0.3125rem 0.625rem;
    font-size: 0.75rem;
    border-radius: 6px;
}
.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ==================== CARDS ==================== */

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
}
.card-flush {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* ==================== SIDEBAR ==================== */

.sidebar {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    position: sticky;
    top: 4.5rem;
}
.sidebar-cover {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    object-fit: contain;
}
.sidebar-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.125rem;
}
.sidebar-author {
    font-size: 0.8125rem;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.375rem;
}
.sidebar-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}
.sidebar-stat {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sidebar-actions .btn {
    width: 100%;
    justify-content: center;
}
.sidebar-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.sidebar-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ==================== FEED URL ==================== */

.feed-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 0.375rem;
}
.feed-url-box {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.6875rem;
    color: var(--text);
    background: var(--input-bg);
    padding: 0.5rem 0.625rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    word-break: break-all;
}
.feed-link {
    font-size: 0.6875rem;
    color: var(--primary);
    text-decoration: none;
    margin-top: 0.375rem;
    display: inline-block;
}
.feed-link:hover {
    text-decoration: underline;
}

/* ==================== CURRENT EPISODES (sidebar) ==================== */

.current-eps-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.current-ep {
    font-size: 0.75rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.current-ep:last-child {
    border-bottom: none;
}

/* ==================== FORM FIELDS ==================== */

.field {
    margin-bottom: 1.5rem;
}
.field:last-of-type {
    margin-bottom: 0;
}
.field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.field label .required {
    color: var(--primary);
}
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field textarea,
.field select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    font-size: 0.9375rem;
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: #fff;
}
.field textarea {
    resize: vertical;
    min-height: 80px;
}
.field .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

/* ==================== COVER PICKER ==================== */

.section-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}
.cover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 0.5rem;
}
.cover-option {
    position: relative;
    cursor: pointer;
}
.cover-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.cover-option .cover-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 8px;
    border: 3px solid transparent;
    transition: border-color 0.15s, transform 0.15s;
    object-fit: contain;
}
.cover-option input:checked + .cover-img {
    border-color: var(--primary);
    transform: scale(1.05);
}
.cover-option:hover .cover-img {
    transform: scale(1.05);
}

/* ==================== DIVIDERS ==================== */

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2rem 0;
}

/* ==================== ACTIONS ROW ==================== */

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* ==================== FLASH MESSAGES ==================== */

.flash {
    padding: 0.875rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
}
.flash-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}
.flash-error {
    background: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* ==================== PAGE HEADINGS ==================== */

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.375rem;
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 2rem;
}

/* ==================== SECTION HEADER ==================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.section-title {
    font-size: 1rem;
    font-weight: 700;
}
.section-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--input-bg);
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
}

/* ==================== EPISODE CARDS ==================== */

.episode-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.15s;
}
.episode-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ep-source {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 500;
    margin-bottom: 0.125rem;
}
.ep-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.ep-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.ep-meta a {
    color: var(--primary);
    text-decoration: none;
}
.ep-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ep-note {
    font-size: 0.8125rem;
    color: var(--text);
    background: var(--primary-light);
    padding: 0.375rem 0.625rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
}
.note-input {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 100%;
    margin-bottom: 0.375rem;
}
.ep-actions {
    display: flex;
    gap: 0.375rem;
}

/* ==================== TABS ==================== */

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.tab {
    flex: 1;
    padding: 0.875rem 1rem;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: inherit;
}
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.tab:hover:not(.active) {
    color: var(--text);
}
.tab-body {
    padding: 1.5rem;
}

/* ==================== STEP DOTS ==================== */

.step-dots {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.5rem;
}
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}
.dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}
.dot.done {
    background: var(--success);
}
.dot-line {
    width: 24px;
    height: 2px;
    background: var(--border);
}
.dot-line.done {
    background: var(--success);
}

/* ==================== PODCAST LIST ITEMS ==================== */

.podcast-item {
    display: flex;
    gap: 0.875rem;
    align-items: center;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    cursor: pointer;
}
.podcast-item:last-child {
    border-bottom: none;
}
.podcast-item:hover {
    background: var(--primary-light);
}
.podcast-art {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}
.podcast-meta {
    flex: 1;
    min-width: 0;
}
.podcast-name {
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.podcast-author {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.podcast-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.podcast-action {
    flex-shrink: 0;
}

/* ==================== EPISODE SELECT LIST ==================== */

.feed-banner {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
}
.feed-art {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    flex-shrink: 0;
    object-fit: cover;
}
.feed-info h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.125rem;
}
.feed-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.search-bar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.search-bar input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text);
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}
.ep-count {
    padding: 0.75rem 1.5rem 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}
.episode-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}
.episode-item:last-child {
    border-bottom: none;
}
.episode-item:hover {
    background: rgba(99, 102, 241, 0.03);
}
.episode-item .ep-info {
    flex: 1;
    min-width: 0;
}
.episode-item .ep-action {
    flex-shrink: 0;
    padding-top: 0.125rem;
}
.episode-item.hidden {
    display: none;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}
.results-header {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0.75rem 1.5rem 0;
}
.results-header strong {
    color: var(--text);
}

/* ==================== DANGER ZONE ==================== */

.danger-zone {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
}
.danger-zone p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ==================== DASHBOARD PLAYLIST CARDS ==================== */

.playlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.playlist-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem;
    transition: box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}
.playlist-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.playlist-card-cover {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}
.playlist-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.playlist-card-title a {
    color: var(--text);
    text-decoration: none;
}
.playlist-card-title a:hover {
    color: var(--primary);
}
.playlist-card-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.playlist-card-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .layout-two-col {
        grid-template-columns: 1fr;
        padding: 0 1rem;
        margin: 1rem auto;
    }
    .sidebar {
        position: static;
    }
    .actions {
        flex-direction: column-reverse;
    }
    .actions .btn {
        width: 100%;
        justify-content: center;
    }
    .podcast-item,
    .episode-item {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .feed-banner,
    .search-bar,
    .ep-count,
    .card-footer,
    .results-header {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
