/**
 * AI Daily Report - 主樣式表
 * 現代化、暗色主題設計
 */

/* =====================================================
   CSS 變數
   ===================================================== */
:root {
    /* 主色調 */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;

    /* 強調色 */
    --accent: #f59e0b;
    --success: #22c55e;
    --warning: #eab308;
    --error: #ef4444;

    /* 暗色主題 */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-hover: #1f2937;

    /* 文字顏色 */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* 邊框 */
    --border-color: #334155;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* 陰影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

    /* 字體 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* 過渡 */
    --transition: all 0.3s ease;
}

[data-theme="light"] {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --accent: #f59e0b;
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --bg-primary: #f8fafc;
    --bg-secondary: #eef2ff;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 6px 12px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 14px 24px rgba(15, 23, 42, 0.16);
    --shadow-glow: 0 0 18px rgba(79, 70, 229, 0.2);
}

/* =====================================================
   基礎重置
   ===================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* =====================================================
   佈局
   ===================================================== */
.container {
    max-width: 95%;
    /* Wider container for YouTube style */
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* =====================================================
   Header
   ===================================================== */
.header {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    font-size: 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.nav a:hover,
.nav a.active {
    color: var(--text-primary);
    background: var(--bg-hover);
    text-decoration: none;
}

.theme-toggle {
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* =====================================================
   Hero Section
   ===================================================== */
.hero {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, transparent 100%);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
}

.hero-date {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    color: var(--text-secondary);
}

.hero-date .date {
    color: var(--primary-light);
    font-weight: 600;
}

.filter-tabs {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    -webkit-overflow-scrolling: touch;
}

.filter-btn {
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: var(--bg-hover);
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* =====================================================
   Stats Bar
   ===================================================== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* =====================================================
   Report Cards
   ===================================================== */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    /* Responsive Grid */
    gap: 1.5rem;
}

.js .reveal {
    opacity: 0;
    transform: translateY(16px);
}

.js .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
    animation: fadeInUp 0.6s ease forwards;
}

.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition);
}

.report-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.report-card:hover::before {
    opacity: 1;
}

.report-card.featured {
    border-color: var(--accent);
}

.report-card.featured::before {
    background: var(--accent);
    opacity: 1;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.report-category {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.report-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.report-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.report-title a {
    color: var(--text-primary);
}

.report-title a:hover {
    color: var(--primary-light);
    text-decoration: none;
}

.report-summary {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.report-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    margin-top: auto;
    /* Push footer to bottom */
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.report-source {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.report-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.btn:hover {
    background: var(--primary);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-glow);
}

/* =====================================================
   AI Comment Section
   ===================================================== */
.ai-comment {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-top: 1rem;
}

.ai-comment-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--primary-light);
}

.ai-comment-content {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* =====================================================
   Pagination
   ===================================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition);
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary-light);
    text-decoration: none;
}

.pagination .active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer a {
    color: var(--text-secondary);
}

.back-to-top {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: var(--transition);
    z-index: 900;
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* =====================================================
   Loading State
   ===================================================== */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(16px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   Empty State
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* =====================================================
   響應式設計
   ===================================================== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .header-inner {
        flex-direction: column;
        gap: 1rem;
    }

    .header-actions {
        flex-direction: column;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .report-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .report-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}

/* --- Podcast Player Modal --- */
.podcast-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    /* JS toggles this */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.podcast-modal.active {
    display: flex;
    opacity: 1;
}

.podcast-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 600px;
    height: 80vh;
    border-radius: 1rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.podcast-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-header);
    position: relative;
}

.podcast-info h3 {
    margin: 0.5rem 0 0.25rem;
    font-size: 1.2rem;
    color: var(--text-main);
}

.podcast-tag {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    font-weight: 700;
}

.podcast-status {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.script-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    /* Monospaced for script feel */
    font-size: 0.95rem;
    line-height: 1.6;
    background: var(--bg-main);
}

/* Script Lines */
.script-line {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.script-line:hover {
    background: var(--bg-hover);
}

.script-line.active {
    background: var(--bg-hover);
    border-left-color: var(--primary);
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.script-line .speaker {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.script-line.alex .speaker {
    color: #3b82f6;
}

/* Blue for Alex */
.script-line.jamie .speaker {
    color: #ec4899;
}

/* Pink for Jamie */

.podcast-controls {
    padding: 1.5rem;
    background: var(--bg-header);
    border-top: 1px solid var(--border);
}

.audio-settings {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.audio-setting {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.audio-setting select,
.audio-setting input[type="range"] {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    padding: 0.35rem 0.5rem;
}

.audio-setting input[type="range"] {
    width: 140px;
    padding: 0;
}

.progress-container {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s linear;
}

.control-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.play-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}

.play-btn:active {
    transform: scale(0.95);
}

.btn-audio {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
}
