/* ========================================
   LECTURE COMPONENTS
   Uses base.css variables (--primary, --dark, --gray-*, etc.)
   ======================================== */


/* ── Page container ── */

.page-container {
    max-width: 900px;
    margin: 0 auto;
}


/* ── Page header ── */

.page-header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--gray-200);
}

.header-avatar {
    width: 4rem;
    height: 4rem;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    overflow: hidden;
    color: var(--gray-400);
    font-size: 1.25rem;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-avatar.dot {
    background: var(--primary);
    border-radius: 50%;
    color: var(--white);
}

.header-content {
    flex: 1;
}

.header-title {
    font-family: 'PT Serif', Georgia, serif;
    font-size: clamp(1.375rem, 3vw, 1.75rem);
    font-weight: 600;
    margin: 0;
    color: var(--dark);
    line-height: 1.25;
    letter-spacing: 0.02em;
}

.header-subtitle {
    color: var(--gray-500);
    margin: 0.25rem 0 0 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.header-meta {
    margin-left: auto;
    margin-top: 0.25rem;
    color: var(--gray-500);
    font-size: 0.9rem;
    text-align: right;
    flex-shrink: 0;
}


/* ── Back link ── */

.back-button {
    margin-bottom: 1.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--primary);
}

.back-link i {
    font-size: 0.8rem;
}


/* ── Card list ── */

.card-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}


/* ── Card item ── */

.card-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-radius: var(--radius-xl);
    background: var(--white);
    border: 1px solid var(--gray-200);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-base);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.card-item:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.card-item.active,
.card-item.playing {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}


/* ── Card icon ── */

.card-icon {
    width: 3rem;
    height: 3rem;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    flex-shrink: 0;
    font-weight: 600;
    color: var(--gray-500);
    font-size: 0.875rem;
    overflow: hidden;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-item.active .card-icon,
.card-item.playing .card-icon {
    background: var(--primary);
    color: var(--white);
}


/* ── Card content ── */

.card-content {
    flex: 1;
    min-width: 0;
}

.card-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    line-height: 1.3;
}

.card-meta {
    color: var(--gray-500);
    font-size: 0.85rem;
    line-height: 1.3;
}


/* ── Progress bar ── */

.card-progress {
    margin-top: 0.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
    position: relative;
    z-index: 2;
}

.progress-bar-fill.completed {
    background: #407838;
}

.progress-bar-fill.in-progress {
    background: var(--primary);
}

.card-buffer-indicator {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    background: rgba(123, 159, 204, 0.4) !important;
    background-image: linear-gradient(
        45deg,
        rgba(13, 21, 32, 0.05) 25%, transparent 25%,
        transparent 50%, rgba(13, 21, 32, 0.05) 50%,
        rgba(13, 21, 32, 0.05) 75%, transparent 75%, transparent
    ) !important;
    background-size: 1rem 1rem !important;
    animation: progress-bar-stripes 1s linear infinite !important;
    z-index: 1 !important;
    transition: width 0.3s ease-out;
}

.progress-bar-fill.playing {
    background: var(--primary) !important;
    z-index: 2 !important;
}


/* ── Status badges ── */

.card-status {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.status-completed {
    background: rgba(64, 120, 56, 0.15);
    color: #407838;
}

.status-in-progress {
    background: rgba(212, 160, 58, 0.15);
    color: var(--primary);
}

.status-not-started {
    background: rgba(123, 159, 204, 0.1);
    color: var(--gray-400);
}

.listen-count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--gray-400);
    font-size: 0.75rem;
}


/* ── Action buttons ── */

.action-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 14px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-lg);
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    color: var(--gray-600);
    background: rgba(123, 159, 204, 0.1);
}

.download-btn:hover {
    color: #489080;
    background: rgba(48, 112, 104, 0.1);
}

.share-btn:hover {
    color: #7860a8;
    background: rgba(96, 72, 136, 0.1);
}

.favorite-btn {
    background: none;
    border: none;
    color: var(--gray-400);
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.favorite-btn:hover {
    color: #d05048;
    background: rgba(184, 56, 48, 0.1);
}

.favorite-btn.active {
    color: var(--primary);
}

.favorite-btn.active:hover {
    color: var(--primary-light);
}


/* ── Live indicator ── */

.live-indicator {
    color: #d05048;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.live-indicator i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}


/* ── Empty state ── */

.empty-state {
    text-align: center;
    padding: 80px 16px;
    color: var(--gray-400);
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 16px;
    color: var(--gray-300);
}

.empty-state p {
    font-size: 1.1rem;
}


/* ── Lecture page wrapper ── */

.lecture-page {
    padding: 48px 0 80px;
}


/* ── Messages ── */

.lecture-messages {
    max-width: 900px;
    margin: 0 auto 24px;
}

.lecture-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
}

.lecture-message-error {
    background: rgba(184, 56, 48, 0.1);
    color: #d05048;
    border: 1px solid #b83830;
}

.lecture-message-success {
    background: rgba(64, 120, 56, 0.15);
    color: #589850;
    border: 1px solid #407838;
}


/* ── Dark theme ── */

[data-theme="dark"] .card-item {
    background: var(--bg-cream);
    border-color: rgba(229, 184, 74, 0.12);
}

[data-theme="dark"] .card-item:hover {
    border-color: rgba(229, 184, 74, 0.2);
}

[data-theme="dark"] .card-item.active,
[data-theme="dark"] .card-item.playing {
    border-color: var(--primary);
}

[data-theme="dark"] .status-completed {
    background: rgba(104, 160, 96, 0.15);
    color: #88c080;
}

[data-theme="dark"] .status-in-progress {
    color: var(--primary);
}

[data-theme="dark"] .progress-bar-fill.completed {
    background: #68a060;
}


/* ── Animations ── */

@keyframes progress-bar-stripes {
    from { background-position: 1rem 0; }
    to   { background-position: 0 0; }
}


/* ── Responsive ── */

@media (max-width: 768px) {
    .lecture-page {
        padding: 32px 0 60px;
    }

    .page-header {
        margin-bottom: 1.5rem;
    }

    .header-avatar {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1rem;
    }

    .header-title { font-size: 1.125rem; }
    .header-subtitle, .header-meta { font-size: 0.8rem; }

    .back-button { margin-bottom: 1rem; }

    .card-list { gap: 8px; }

    .card-item {
        padding: 12px;
        border-radius: var(--radius-lg);
    }

    .card-icon {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 0.8rem;
    }

    .card-title { font-size: 0.9rem; }
    .card-meta { font-size: 0.8rem; }
    .card-progress { margin-top: 6px; }
    .progress-bar-container { height: 3px; }

    .status-badge {
        padding: 2px 8px;
        font-size: 0.675rem;
    }

    .listen-count { font-size: 0.675rem; }

    .action-btn {
        font-size: 12px;
        min-width: 24px;
        height: 24px;
        padding: 4px;
    }

    .favorite-btn {
        font-size: 14px;
        min-width: 28px;
        height: 28px;
        padding: 4px;
    }

    .empty-state { padding: 50px 16px; }
    .empty-state i { font-size: 2.5rem; }
}
