/* ============================================
   🎓 DATHOC - style.css (DARK THEME UNIFIED)
   ============================================ */

/* ===== 🎨 Design Tokens ===== */
:root {
    /* Colors */
    --primary: #00f0ff;
    --primary-rgb: 0, 240, 255;
    --secondary: #7b2fff;
    --secondary-rgb: 123, 47, 255;
    --accent: #ff2d95;
    --dark: #0a0a1a;
    --card-bg: rgba(15, 15, 40, 0.9);
    --text-primary: #e0e0ff;
    --text-secondary: rgba(224, 224, 255, 0.6);
    --text-muted: rgba(224, 224, 255, 0.3);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(0, 240, 255, 0.15);
    
    /* View Badge */
    --view-orange: #ff6b35;
    --view-orange-light: #ff8c42;
    --view-orange-rgb: 255, 107, 53;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-accent: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    --gradient-view: linear-gradient(135deg, var(--view-orange), var(--view-orange-light));
    
    /* Shadows & Glow */
    --glow-primary: 0 0 20px rgba(var(--primary-rgb), 0.2);
    --glow-secondary: 0 5px 20px rgba(var(--secondary-rgb), 0.3);
    --shadow-card: 0 10px 40px rgba(var(--primary-rgb), 0.15);
    --shadow-view: 0 2px 8px rgba(var(--view-orange-rgb), 0.4);
    
    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 30px;
    
    /* Typography */
    --font-sans: 'Space Grotesk', 'Rajdhani', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Orbitron', monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.95rem;
    --font-size-md: 1.05rem;
    --font-size-lg: 1.35rem;
    --font-size-xl: 2rem;
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== ♻️ Reset & Base ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: var(--font-sans);
    background: var(--dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== 🌌 Background ===== */
.bg-animation {
    position: fixed; inset: 0; z-index: -1;
    background: 
        radial-gradient(circle at 20% 50%, rgba(var(--secondary-rgb), 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(var(--primary-rgb), 0.1) 0%, transparent 50%),
        linear-gradient(180deg, rgba(10, 10, 26, 0.95) 0%, var(--dark) 100%);
}

/* ===== 🎯 Header & Tabs ===== */
.main-header { max-width: 1400px; margin: 0 auto; padding: 10px 20px; margin-bottom: 15px; }
.header-top { display: flex; justify-content: space-between; align-items: center; gap: 15px; flex-wrap: wrap; }
.header-left { flex: 1; min-width: 300px;  align-items: center; gap: 15px; }
.site-title {
    font-family: var(--font-mono); font-size: 1.5rem; font-weight: 900;
    display: flex; align-items: center; gap: var(--spacing-sm); white-space: nowrap;
}
.site-title i { font-size: 1.8rem; color: var(--primary); }

/* Search Input */
.search-container { position: relative; max-width: 350px; flex: 0 1 350px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-container input {
    width: 100%; padding: 6px 12px 6px 35px; height: 36px;
    background: rgba(15, 15, 40, 0.6); border: 2px solid var(--border-accent);
    border-radius: var(--radius-md); color: #fff; font-size: 0.85rem; outline: none;
    transition: all var(--transition-normal);
}
.search-container input:focus { border-color: var(--primary); box-shadow: var(--glow-primary); }
.search-container input::placeholder { color: var(--text-muted); }

/* Header Stats & Tabs */
.header-right { display: flex; gap: var(--spacing-sm); align-items: stretch; }
.stat-card {
    background: rgba(15, 15, 40, 0.6); border: 2px solid rgba(var(--secondary-rgb), 0.2);
    border-radius: var(--radius-md); padding: 8px 15px; flex-direction: column;
    align-items: center; gap: 2px; min-width: 100px; transition: all var(--transition-normal);
}
.stat-card:hover { border-color: var(--secondary); transform: translateY(-2px); box-shadow: var(--glow-secondary); }
.stat-card i { font-size: 1.2rem; color: var(--secondary); }
.stat-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--primary); }

.tab-card { cursor: pointer; }
.tab-card.active { background: rgba(var(--primary-rgb), 0.1); border-color: var(--primary); box-shadow: var(--glow-primary); }

/* ===== 🔍 Search Dropdown (ĐÃ SỬA SANG DARK THEME) ===== 
.search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--card-bg); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md); box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 500px; overflow-y: auto; z-index: 1000; display: none; margin-top: 5px;
    backdrop-filter: blur(10px);
}
.search-dropdown.active { display: block; }
.search-filters { padding: 8px 16px; border-bottom: 1px solid var(--border-subtle); display: flex; gap: 8px; }
.filter-btn {
    padding: 4px 12px; border: 1px solid var(--border-subtle); border-radius: 16px;
    background: rgba(255,255,255,0.05); color: var(--text-secondary); cursor: pointer; font-size: 12px;
}
.filter-btn.active { background: rgba(var(--primary-rgb), 0.2); color: var(--primary); border-color: var(--primary); }

.search-result-item { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: background 0.2s; }
.search-result-item:hover { background: rgba(var(--primary-rgb), 0.1); }
.search-result-item:last-child { border-bottom: none; }

.result-type { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; margin-right: 8px; }
.result-type.course { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.result-type.skill { background: rgba(16, 185, 129, 0.2); color: #34d399; }

.result-title { font-weight: 600; color: #fff; margin-bottom: 4px; }
.result-snippet { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.result-snippet mark { background: rgba(var(--primary-rgb), 0.3); color: var(--primary); padding: 1px 3px; border-radius: 2px; }

.search-loading, .search-empty { text-align: center; padding: 20px; color: var(--text-muted); }
*/
/* ===== 🔍 Search Dropdown — LIGHT MODE (NỀN TRẮNG MỜ, CHỮ ĐEN) ===== */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    
    /* ✅ NỀN TRẮNG MỜ — không phải đen! */
    background: rgba(255, 255, 255, 0.95);
    
    /* Viền mỏng xám nhạt + bóng nhẹ */
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 8px;
    
    /* Không cần backdrop-filter trong light mode — bỏ đi hoặc để transparent */
    backdrop-filter: none;
}

.search-dropdown.active {
    display: block;
}

/* Vùng filter — nền trắng, viền mỏng */
.search-filters {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.95); /* cùng nền với dropdown */
}

.filter-btn {
    padding: 6px 14px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.7);
    color: #4b5563; /* xám đậm — dễ đọc trên nền trắng */
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.filter-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
}

.filter-btn.active {
    background: rgba(6, 182, 212, 0.08); /* cyan mờ */
    color: #0891b2; /* xanh đậm, dễ đọc */
    border-color: rgba(6, 182, 212, 0.3);
    font-weight: 600;
}

/* ✅ Từng hàng kết quả — rõ ràng, có khoảng cách */
.search-result-item {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1f2937; /* chữ đen đậm */
}

.search-result-item:hover {
    background: rgba(6, 182, 212, 0.05);
    /* Không cần border-left — trong light mode, nền hover đủ rõ rồi */
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Tag loại (course / skill) — giữ màu nhưng làm nổi bật trên nền trắng */
.result-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 10px;
    letter-spacing: 0.2px;
}

.result-type.course {
    background: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.result-type.skill {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Tiêu đề & mô tả — rõ ràng, không chìm */
.result-title {
    font-weight: 600;
    color: #111827; /* đen đậm */
    margin-bottom: 4px;
    font-size: 14px;
}

.result-snippet {
    font-size: 13px;
    color: #4b5563; /* xám đậm — đủ tương phản */
    line-height: 1.5;
}

.result-snippet mark {
    background: rgba(6, 182, 212, 0.15);
    color: #0891b2;
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Trạng thái trống / loading */
.search-loading,
.search-empty {
    text-align: center;
    padding: 30px;
    color: #6b7280; /* xám nhạt */
    font-style: italic;
}

/* ===== 🖼️ Preview Section ===== */
.preview-section {
    background: linear-gradient(135deg, rgba(15,15,40,0.95), rgba(10,10,26,0.98));
    border-radius: var(--radius-lg); padding: 20px; margin-bottom: 30px;
    border: 1px solid rgba(0, 255, 255, 0.1);
}
.preview-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.preview-icon {
    font-size: 1.8rem; color: var(--primary); width: 50px; height: 50px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(var(--primary-rgb), 0.1); border-radius: var(--radius-md);
}
.preview-title { font-size: 1.4rem; font-weight: 700; color: #fff; }
.preview-desc { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 15px; }

.preview-slide {
    position: relative; width: 100%; max-width: 1280px; margin: 0 auto 15px;
    aspect-ratio: 16/9; background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(138, 43, 226, 0.1));
    border-radius: 8px; border: 2px solid rgba(0, 212, 255, 0.3); overflow: hidden;
}
.preview-slide-content {
    width: 100%; height: 100%; padding: 40px 60px; display: flex; flex-direction: column;
    justify-content: center; overflow-y: auto; color: var(--text-primary); font-size: 2.95rem;
}
.preview-slide-content h1, .preview-slide-content h2 { color: var(--primary); margin-bottom: 20px; }
.preview-slide-content p, .preview-slide-content li { font-size: 2.1rem; color: rgba(255, 255, 255, 0.9); }
.preview-slide-content strong { color: #00ff88; }

.preview-btn {
    position: absolute; bottom: 20px; right: 20px;
    background: linear-gradient(135deg, #00d4ff, #8a2be2); color: white; border: none;
    padding: 12px 30px; border-radius: 25px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; gap: 8px; box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}
.preview-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 212, 255, 0.6); }

/* ===== 📦 Content Grid & Topic Cards ===== */
.content { max-width: 1400px; margin: 0 auto; padding: var(--spacing-xl) var(--spacing-lg); }
.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 15px; }

.topic-card {
    position: relative; background: rgba(255, 255, 255, 0.05); border-radius: 10px; padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1); transition: all var(--transition-normal); cursor: pointer;
    opacity: 0; transform: translateY(20px); animation: fadeInUp var(--transition-slow) forwards;
}
.topic-card:hover { transform: translateY(-5px); border-color: var(--primary); box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3); }

.view-count-badge {
    position: absolute; top: -10px; right: 15px; background: var(--gradient-view); color: white;
    padding: 4px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600;
    display: flex; align-items: center; gap: 4px; box-shadow: var(--shadow-view); z-index: 10;
}
.topic-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-right: 70px; }
.topic-id {
    font-family: var(--font-mono); font-size: var(--font-size-xs); padding: 4px 12px;
    background: rgba(var(--primary-rgb), 0.1); border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 6px; color: var(--primary); font-weight: 700;
}
.topic-icon { font-size: 1.5rem; color: var(--secondary); }
.topic-title { font-size: 1.1rem; font-weight: 600; color: #fff; margin-bottom: var(--spacing-xs); }
.topic-desc { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 12px; }

/* Topic Footer (ĐÃ SỬA SANG DARK THEME) */
.topic-footer { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.skill-code {
    font-size: 11px; color: var(--primary); font-family: var(--font-mono);
    background: rgba(var(--primary-rgb), 0.1); border: 1px solid rgba(var(--primary-rgb), 0.2);
    padding: 2px 8px; border-radius: 4px;
}

/* ===== 📅 Instructor Schedule ===== */
.instructor-schedule {
    background: rgba(255, 255, 255, 0.05); border-radius: 15px; padding: 25px; margin-bottom: 30px;
    backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.1);
}
.schedule-title { color: #fff; font-size: 1.5rem; display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.schedule-wrapper { overflow-x: auto; }
.busy-bar {
    position: absolute; top: 6px; bottom: 6px; border-radius: 6px; display: flex; align-items: center;
    justify-content: center; color: #fff; font-size: 0.8rem; font-weight: 500; cursor: pointer;
}
.busy-bar.support { background: linear-gradient(90deg, #4facfe, #00f2fe); }
.busy-bar.class { background: linear-gradient(90deg, #43e97b, #38f9d7); }
.busy-bar.meeting { background: linear-gradient(90deg, #fa709a, #fee140); }

/* ===== 🏷️ Section Headers & Badges (ĐÃ SỬA SANG DARK THEME) ===== */
.topics-section { margin-bottom: 40px; }
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-title { font-size: 24px; font-weight: 700; color: #fff; margin: 0; } /* Sửa từ #1f2937 */

.section-badge { padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.section-badge.basic { background: rgba(16, 185, 129, 0.15); color: #34d399; border-color: rgba(16, 185, 129, 0.3); }
.section-badge.advanced { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
.section-badge.live { background: rgba(46, 125, 50, 0.15); color: #4caf50; border-color: rgba(46, 125, 50, 0.3); animation: pulse-green 2s infinite; }

/* ===== 💬 Chat Buttons ===== */
.chat-buttons { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.chat-btn, .preview-chat-btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg,#00d4ff,#8a2be2); color: white; border: none;
    padding: 12px 20px; border-radius: 25px; cursor: pointer; font-weight: 600;
    transition: all var(--transition-normal);
}
.chat-btn:hover, .preview-chat-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4); }
.preview-chat-btn.active-chat { background: linear-gradient(135deg, #28a745, #20c997); animation: pulse-green 2s infinite; }

/* ===== 📊 STATS DASHBOARD (ĐỔI TÊN CLASS ĐỂ TRÁNH XUNG ĐỘT) ===== */
.stats-dashboard-section { max-width: 1200px; margin: 40px auto; padding: 0 20px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 20px; }

/* Đổi từ .stat-card thành .chart-card */
.chart-card {
    background: var(--card-bg); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
    padding: 20px; transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.chart-card:hover { transform: translateY(-5px); border-color: var(--primary); }
.chart-card--wide { grid-column: span 2; }

.chart-card__title {
    font-size: 1rem; font-weight: 600; color: var(--text-primary);
    margin: 0 0 15px 0; border-bottom: 1px solid var(--border-subtle); padding-bottom: 10px;
}
.chart-card__body { position: relative; height: 250px; width: 100%; }

/* CanvasJS Override */
.canvasjs-chart-credit { display: none !important; } /* Ẩn chữ tín dụng của CanvasJS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 cột bằng nhau */
    grid-template-rows: auto auto;

}

.chart-card {
    background: #1e293b;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 300px; /* Chiều cao tối thiểu */
}

.chart-card--wide {
    grid-column: span 2; /* Chiếm 2 cột */
    min-height: 400px; /* Cao hơn cho chart timeline */
}

.chart-card__body {
    height: calc(100% - 40px); /* Trừ chiều cao title */
    min-height: 250px;
}

/* Đảm bảo chart canvas responsive */
.chart-card__body canvas,
.chart-card__body div {
    width: 100% !important;
    height: 100% !important;
}

/* Responsive cho mobile */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: 1fr; /* 1 cột trên mobile */
    }
    
    .chart-card--wide {
        grid-column: span 1;
    }
}

@media (min-width: 1025px) and (max-width: 1440px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 cột trên tablet */
    }
    
    .chart-card--wide {
        grid-column: span 2;
    }
}

/* ===== 🎬 Animations ===== */
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
}

/* ===== 📱 Responsive ===== */
@media (max-width: 968px) {
    .header-top { flex-direction: column; }
    .header-left, .header-right { width: 100%; }
    .search-container { max-width: 100%; flex: 1 !important; }
    .topics-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .chart-card--wide { grid-column: span 1; }
    .chart-card__body { height: 200px; }
    .preview-slide-content { padding: 20px 30px; font-size: 1.5rem; }
}