/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.07);
    --bg-glass: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-start: #6366f1;
    --accent-end: #8b5cf6;
    --accent-cyan: #22d3ee;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html { font-size: 16px; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== APP LAYOUT ===== */
.app-container { max-width: 900px; margin: 0 auto; padding: 0 16px; min-height: 100vh; display: flex; flex-direction: column; }

/* ===== HEADER ===== */
.app-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 0; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    background: rgba(10, 10, 15, 0.85); backdrop-filter: blur(20px);
}
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-size: 1.25rem; font-weight: 700; background: linear-gradient(135deg, var(--accent-start), var(--accent-end)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.header-nav { display: flex; gap: 4px; }
.nav-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 14px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    font-family: var(--font); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition); position: relative;
}
.nav-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-btn.active { color: var(--text-primary); background: var(--bg-card-hover); }
.nav-btn.active::after {
    content: ''; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
    width: 24px; height: 2px; border-radius: 1px;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
}
.error-badge {
    position: absolute; top: 2px; right: 2px;
    background: var(--error); color: #fff; font-size: 0.65rem; font-weight: 700;
    min-width: 16px; height: 16px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* ===== MAIN ===== */
.app-main { flex: 1; padding: 24px 0 80px; }
.reels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 24px;
}
.reel-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.reel-card:focus-within { border-color: var(--border-active); outline: none; }
.reel-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 360px;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #000;
    border: 1px solid var(--border);
}
.reel-preview img,
.reel-preview video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.reel-preview video { opacity: 0; transition: opacity var(--transition); }
.reel-preview.playing video { opacity: 1; }
.reel-preview-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.reel-play-hint {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
}
.reel-play-hint.muted { color: var(--text-muted); }
.reel-info { display: flex; flex-direction: column; gap: 4px; }
.reel-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.reel-url { font-size: 0.75rem; color: var(--text-muted); word-break: break-all; }
.reel-url span {
    color: var(--accent-cyan);
    font-size: 0.65rem;
    font-weight: 700;
    margin-right: 6px;
    text-transform: uppercase;
}
.reel-actions { margin-top: auto; display: flex; gap: 8px; }
.action-btn.full-width { flex: 1; justify-content: center; }

/* Tabs */
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== SUBMIT TAB ===== */
.submit-hero { text-align: center; padding: 60px 0 40px; }
.hero-title { font-size: 2rem; font-weight: 700; margin-bottom: 8px; letter-spacing: -0.02em; }
.hero-subtitle { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 32px; max-width: 500px; margin-inline: auto; }

.submit-form { width: 100%; max-width: 800px; margin: 0 auto; }
.input-container { display: flex; flex-direction: column; gap: 16px; }

.url-bar {
    display: flex; align-items: center; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px; transition: all 0.3s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.url-bar:focus-within { border-color: var(--accent-start); box-shadow: 0 8px 32px rgba(99, 102, 241, 0.15); }

.url-icon { padding: 0 12px; color: var(--text-muted); display: flex; align-items: center; }
.url-input {
    flex: 1; background: transparent; border: none; padding: 12px 8px;
    color: #fff; font-size: 1.1rem; outline: none;
}
.url-input::placeholder { color: var(--text-muted); opacity: 0.5; }

.submit-btn {
    display: flex; align-items: center; gap: 10px;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff; border: none; padding: 12px 24px; border-radius: calc(var(--radius) - 4px);
    font-weight: 600; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.submit-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3); }
.submit-btn:active { transform: translateY(0); }
.submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.form-options { display: flex; gap: 24px; padding: 0 8px; }
.option-group { display: flex; flex-direction: column; gap: 6px; }
.option-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.select-wrapper, .tag-input-wrapper {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 4px 12px; display: flex; align-items: center;
}
#workflow-select {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 0.9rem; outline: none; cursor: pointer; padding: 6px 0;
}
#workflow-select option { background: var(--bg-card); }

.tag-input-wrapper { gap: 4px; }
.tag-hash { color: var(--accent-cyan); font-weight: 700; }
#video-tag {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 0.9rem; outline: none; width: 100px;
}

.platform-icons { display: flex; gap: 8px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.platform-tag {
    padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 500;
    background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border);
}

/* ===== PROCESSING CARD ===== */
.processing-card {
    max-width: 560px; margin: 24px auto 0;
    background: var(--bg-glass); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px; animation: fadeIn 0.4s ease;
}
.processing-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.processing-title { font-weight: 600; font-size: 0.95rem; }
.status-pill {
    padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.status-pill[data-status="pending"] { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-pill[data-status="downloading"] { background: rgba(34, 211, 238, 0.15); color: var(--accent-cyan); }
.status-pill[data-status="transcribing"] { background: rgba(99, 102, 241, 0.15); color: var(--accent-start); }
.status-pill[data-status="summarizing"] { background: rgba(139, 92, 246, 0.15); color: var(--accent-end); }
.status-pill[data-status="ready"] { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.status-pill[data-status="error"] { background: rgba(239, 68, 68, 0.15); color: var(--error); }

.progress-bar { height: 3px; background: var(--bg-card); border-radius: 2px; overflow: hidden; margin-bottom: 12px; }
.progress-fill {
    height: 100%; border-radius: 2px; transition: width 0.5s ease;
    background: linear-gradient(90deg, var(--accent-start), var(--accent-end));
    width: 0%;
}
.processing-logs {
    margin-bottom: 12px;
    max-height: 120px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.log-entry {
    animation: fadeIn 0.2s ease;
}
.processing-url { font-size: 0.8rem; color: var(--text-muted); word-break: break-all; }

/* ===== TAB HEADERS ===== */
.tab-header { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.tab-header h2 { font-size: 1.3rem; font-weight: 700; }
.count-badge {
    padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
    background: var(--bg-card); color: var(--text-secondary);
}
.count-badge.error { background: rgba(239, 68, 68, 0.15); color: var(--error); }
.source-history-header { flex-wrap: wrap; }
.history-filter-group {
    display: flex;
    gap: 4px;
    margin-left: auto;
    padding: 4px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.history-filter-btn,
.error-filter-btn {
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    transition: all var(--transition);
}
.history-filter-btn:hover,
.history-filter-btn.active,
.error-filter-btn:hover,
.error-filter-btn.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ===== VIDEO LIST ===== */
.video-list { display: flex; flex-direction: column; gap: 8px; }
.video-card {
    display: flex; align-items: center; gap: 16px;
    padding: 16px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid var(--border);
    cursor: pointer; transition: all var(--transition);
}
.video-card:hover { background: var(--bg-card-hover); border-color: var(--border-active); transform: translateY(-1px); }
.video-card .vc-icon {
    width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    font-size: 0.75rem; font-weight: 700; color: #fff; text-transform: uppercase;
}
.video-card .ig-bulk-icon {
    background: linear-gradient(135deg, #f97316, #ec4899 55%, #6366f1);
}
.video-card .vc-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    flex-shrink: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
}
.video-card .vc-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.video-card .vc-info { flex: 1; min-width: 0; }
.video-card .vc-title { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.video-card .vc-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.video-card .vc-status { flex-shrink: 0; }
.video-card .vc-status {
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-retry-btn {
    padding: 5px 10px;
    font-size: 0.75rem;
}

/* ===== CHANNELS ===== */
.channels-layout {
    display: grid;
    grid-template-columns: minmax(260px, 320px) 1fr;
    gap: 16px;
    min-height: 560px;
}
.channel-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.channel-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: inherit;
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
    transition: all var(--transition);
}
.channel-card:hover,
.channel-card.active {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
}
.channel-card .vc-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
}
.channel-card-info {
    min-width: 0;
}
.channel-card-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.channel-card-meta {
    margin-top: 3px;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.channel-chat-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.channel-chat-header {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--bg-card);
}
.channel-chat-header h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}
.channel-chat-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.channel-chat-container .chat-messages {
    border-radius: 0;
}

/* ===== ERROR LIST ===== */
.error-list { display: flex; flex-direction: column; gap: 8px; }
.error-card {
    padding: 16px; border-radius: var(--radius);
    background: var(--bg-card); border: 1px solid rgba(239, 68, 68, 0.15);
    transition: all var(--transition);
}
.error-card.resolved { opacity: 0.5; border-color: var(--border); }
.error-card .ec-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.error-card .ec-step { padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; background: rgba(239, 68, 68, 0.15); color: var(--error); text-transform: uppercase; }
.platform-pill {
    padding: 2px 8px; border-radius: 4px; background: rgba(99, 102, 241, 0.1);
    color: var(--accent-start); font-weight: 700; font-size: 0.75rem; text-transform: uppercase;
}
.workflow-badge {
    padding: 2px 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary); font-size: 0.75rem; border: 1px solid var(--border);
}
.detail-tag-badge {
    padding: 2px 8px; border-radius: 4px; background: rgba(34, 211, 238, 0.1);
    color: var(--accent-cyan); font-weight: 700; font-size: 0.75rem; text-transform: uppercase;
}
.detail-tag-badge::before { content: '#'; }
.duration-text { font-size: 0.82rem; color: var(--text-muted); }
.error-card .ec-message { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; word-break: break-word; }
.error-card .ec-url { font-size: 0.75rem; color: var(--text-muted); word-break: break-all; margin-bottom: 10px; }
.error-card .ec-actions { display: flex; gap: 8px; }
.error-card .ec-btn {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary); font-family: var(--font);
    font-size: 0.78rem; cursor: pointer; transition: all var(--transition);
}
.error-card .ec-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.error-card .ec-btn.resolve { border-color: rgba(16, 185, 129, 0.3); color: var(--success); }
.error-card .ec-btn.retry { border-color: rgba(99, 102, 241, 0.3); color: var(--accent-start); }
.error-card .ec-stacktrace {
    margin-top: 8px; padding: 10px; border-radius: var(--radius-sm);
    background: rgba(0,0,0,0.3); font-size: 0.72rem; color: var(--text-muted);
    font-family: 'Courier New', monospace; max-height: 150px; overflow-y: auto;
    white-space: pre-wrap; word-break: break-all; display: none;
}
.error-card .ec-stacktrace.show { display: block; }

/* ===== EMPTY STATES ===== */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state p { margin-top: 12px; font-size: 0.9rem; }

/* ===== DETAIL OVERLAY ===== */
.detail-overlay {
    display: none; position: fixed; inset: 0; z-index: 200;
    background: var(--bg-primary); overflow-y: auto;
    animation: slideIn 0.3s ease;
}
.detail-overlay.active { display: block; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.detail-container { max-width: 900px; margin: 0 auto; padding: 16px; min-height: 100vh; display: flex; flex-direction: column; }

.detail-header { margin-bottom: 20px; }
.back-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px;
    border: none; border-radius: var(--radius-sm); background: var(--bg-card);
    color: var(--text-secondary); font-family: var(--font); font-size: 0.85rem;
    cursor: pointer; transition: all var(--transition); margin-bottom: 16px;
}
.back-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.detail-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.detail-meta { display: flex; gap: 10px; align-items: center; }
.platform-pill {
    padding: 3px 10px; border-radius: 6px; font-size: 0.72rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    color: var(--accent-end);
}
.vc-tag {
    color: var(--accent-cyan);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    background: rgba(34, 211, 238, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
}
.duration-text { font-size: 0.82rem; color: var(--text-muted); }
.uploader-text { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); }
.uploader-text::before { content: 'by '; color: var(--text-muted); font-weight: 400; }
.detail-description { 
    font-size: 0.85rem; color: var(--text-muted); margin-top: 12px; 
    line-height: 1.5; max-height: 42px; overflow: hidden; 
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    transition: all 0.3s ease;
    cursor: pointer;
    white-space: pre-line;
}
.detail-description:hover {
    max-height: 10000px;
    -webkit-line-clamp: unset;
    display: block;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.source-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
}
.source-link-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
    border-color: var(--primary);
}

.vc-cost-badge {
    color: var(--accent-cyan);
    font-weight: 600;
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.2);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.72rem;
    cursor: help;
}

/* Detail tabs */
.detail-tabs { display: flex; gap: 4px; margin-bottom: 20px; padding: 4px; background: var(--bg-card); border-radius: var(--radius-sm); }
.detail-tab {
    flex: 1; padding: 10px; border: none; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    font-family: var(--font); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: all var(--transition); text-align: center;
}
.detail-tab:hover { color: var(--text-primary); }
.detail-tab.active { background: var(--bg-card-hover); color: var(--text-primary); }

.detail-content { display: none; flex: 1; }
.detail-content.active { display: flex; flex-direction: column; }

.content-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 24px; flex: 1;
}

.video-container {
    width: 100%; border-radius: var(--radius); overflow: hidden;
    background: #000; display: flex; align-items: center; justify-content: center;
    aspect-ratio: 16 / 9; border: 1px solid var(--border);
}
#video-player { width: 100%; height: 100%; max-height: 60vh; }

/* Transcript */
.transcript-actions { display: flex; gap: 8px; margin-bottom: 16px; }
.action-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    background: transparent; color: var(--text-secondary);
    font-family: var(--font); font-size: 0.8rem; cursor: pointer;
    transition: all var(--transition);
}
.action-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.transcript-text { font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary); white-space: pre-wrap; }

/* Transcript Segments Styling */
.transcript-segment-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    margin-bottom: 4px;
}
.transcript-segment-row:hover {
    background: var(--bg-card-hover);
    border-left-color: var(--primary);
}
.segment-time-badge {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: calc(var(--radius-sm) - 2px);
    font-family: monospace;
    flex-shrink: 0;
    margin-top: 2px;
}
.segment-text-content {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-secondary);
}
.transcript-segment-row:hover .segment-text-content {
    color: var(--text-primary);
}

/* Summary markdown */
.markdown-content { font-size: 0.9rem; line-height: 1.7; color: var(--text-secondary); }
.markdown-content h1, .markdown-content h2, .markdown-content h3 { color: var(--text-primary); margin: 16px 0 8px; }
.markdown-content h1 { font-size: 1.2rem; }
.markdown-content h2 { font-size: 1.05rem; }
.markdown-content h3 { font-size: 0.95rem; }
.markdown-content p { margin-bottom: 10px; }
.markdown-content ul, .markdown-content ol { margin-left: 20px; margin-bottom: 10px; }
.markdown-content li { margin-bottom: 4px; }
.markdown-content strong { color: var(--text-primary); }
.markdown-content blockquote { border-left: 3px solid var(--accent-start); padding-left: 12px; margin: 10px 0; color: var(--text-muted); }
.markdown-content code { background: rgba(0,0,0,0.3); padding: 2px 6px; border-radius: 4px; font-size: 0.85em; }

/* ===== CHAT ===== */
.chat-container { display: flex; flex-direction: column; flex: 1; min-height: 400px; }
.chat-messages {
    flex: 1; overflow-y: auto; padding: 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    display: flex; flex-direction: column; gap: 12px;
}
.chat-welcome { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.9rem; }
.chat-bubble {
    max-width: 80%; padding: 12px 16px; border-radius: var(--radius);
    font-size: 0.88rem; line-height: 1.6; animation: fadeIn 0.2s ease;
}
.chat-bubble.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff; border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card-hover); color: var(--text-secondary);
    border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-bubble.assistant .markdown-content { font-size: 0.88rem; }

.chat-input-form {
    display: flex; gap: 8px; padding: 12px;
    background: var(--bg-glass); border: 1px solid var(--border);
    border-top: none; border-radius: 0 0 var(--radius) var(--radius);
}
.chat-input {
    flex: 1; padding: 10px 16px; border: none; border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text-primary);
    font-family: var(--font); font-size: 0.9rem; outline: none;
}
.chat-input::placeholder { color: var(--text-muted); }
.chat-send-btn {
    padding: 10px 16px; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    color: #fff; cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.chat-send-btn:hover { transform: translateY(-1px); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .app-header { flex-direction: column; gap: 12px; }
    .hero-title { font-size: 1.5rem; }
    .submit-hero { padding: 32px 0 24px; }
    .input-group { flex-direction: column; }
    .submit-btn { justify-content: center; }
    .nav-btn span { display: none; }
    .nav-btn { padding: 8px 10px; }
    .history-filter-group { width: 100%; margin-left: 0; }
    .history-filter-btn { flex: 1; }
    .video-card { padding: 12px; gap: 12px; }
    .channels-layout { grid-template-columns: 1fr; }
    .channel-chat-panel { min-height: 460px; }
    .detail-title { font-size: 1.1rem; }
    .chat-bubble { max-width: 90%; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 16px; height: 16px; border: 2px solid transparent;
    border-top-color: currentColor; border-radius: 50%;
    animation: spin 0.6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== GOOGLE DRIVE CUSTOM DROPDOWN ===== */
.drive-option-group {
    position: relative;
    flex: 1.5;
    min-width: 260px;
}
.drive-connect-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    width: 100%;
    padding: 6px 0;
    transition: color var(--transition);
}
.drive-connect-btn:hover {
    color: var(--text-primary);
}
.drive-connect-btn svg {
    margin-right: 6px;
    color: var(--accent-cyan);
    animation: pulse 2s infinite;
}
.drive-select-container {
    position: relative;
    width: 100%;
}
.drive-dropdown {
    position: relative;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    transition: all var(--transition);
}
.drive-dropdown:hover, .drive-dropdown.open {
    border-color: var(--border-active);
    background: rgba(255, 255, 255, 0.05);
}
.drive-dropdown-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    color: var(--text-secondary);
    min-height: 34px;
}
.drive-dropdown-trigger span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.drive-arrow {
    font-size: 0.65rem;
    opacity: 0.6;
    transition: transform var(--transition);
    margin-left: 8px;
}
.drive-dropdown.open .drive-arrow {
    transform: rotate(180deg);
}
.drive-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 250;
    flex-direction: column;
    overflow: hidden;
    animation: driveMenuFadeIn 0.18s ease;
}
.drive-dropdown.open .drive-dropdown-menu {
    display: flex;
}
.drive-search-wrapper {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
    padding: 6px 8px;
    gap: 8px;
}
.drive-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    font-family: var(--font);
    padding: 6px;
}
.drive-search-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}
.drive-disconnect-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    font-size: 0.72rem;
    padding: 4px 8px;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
}
.drive-disconnect-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
}
.drive-options-list {
    max-height: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.drive-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    color: var(--text-secondary);
    transition: all var(--transition);
    font-size: 0.85rem;
}
.drive-option:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}
.drive-option.selected {
    background: rgba(34, 211, 238, 0.08);
    color: var(--accent-cyan);
    font-weight: 600;
}
.drive-option-name {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.drive-star-icon {
    color: var(--warning);
    font-size: 0.85rem;
    animation: starPulse 1.5s ease-in-out infinite;
}

@keyframes driveMenuFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes starPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); filter: drop-shadow(0 0 2px var(--warning)); }
    100% { transform: scale(1); }
}

@keyframes pulse {
    0% { opacity: 0.8; }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.8; }
}

/* ===== TIMESTAMP LINKS ===== */
.timestamp-link {
    color: var(--accent-cyan);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    background: rgba(34, 211, 238, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    transition: all var(--transition);
    border: 1px solid rgba(34, 211, 238, 0.15);
}
.timestamp-link:hover {
    background: rgba(34, 211, 238, 0.18);
    border-color: rgba(34, 211, 238, 0.35);
    box-shadow: 0 0 6px rgba(34, 211, 238, 0.25);
    transform: translateY(-1px);
}

