/* ==========================================================================
   1. KHỞI TẠO BIẾN (VARIABLES) & RESET HỆ THỐNG
   ========================================================================== */
:root {
    --primary: #0f172a;       
    --accent: #0091df;        /* Xanh dương chuẩn theo phổ màu Logo ACV */
    --accent-gradient: linear-gradient(135deg, #0072bc 0%, #00a651 100%); /* Phối xanh ACV hiện đại */
    --bg: #f8fafc;            
    --card: #ffffff;          
    --text: #334155;          
    --text-muted: #64748b;
    --success: #10b981;       
    --danger: #ef4444;
    --warning: #f59e0b;
    --border: #e2e8f0;        
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow-sm: 0 4px 6px -1px rgba(0,0,0,0.02);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; 
}

body { 
    background: var(--bg); 
    color: var(--text); 
    line-height: 1.6;
    font-size: clamp(14px, 1.2vw, 16px);
    padding-bottom: 60px; 
}

.container { 
    width: 100%; 
    max-width: 1340px; 
    margin: 0 auto; 
    padding: 0 4%; 
}

/* ==========================================================================
   2. THANH ĐIỀU HƯỚNG CHUNG (HEADER & NAVBAR)
   ========================================================================== */
header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky; 
    top: 0; 
    z-index: 1000;
    border-bottom: 1px solid var(--border);
}

.navbar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    height: 85px; 
}

/* Khối bọc thực thể Logo nhận diện trên Header */
.brand-header-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.header-logo-img {
    height: 45px;
    width: auto;
    object-fit: contain;
}

.logo-text-group {
    display: flex;
    flex-direction: column;
}

.logo-text-top {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.3px;
}

.logo-text-bottom {
    font-size: 11px;
    font-weight: 600;
    color: #0072bc;
    letter-spacing: 0.5px;
}

.user-widget { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    background: #f1f5f9; 
    padding: 6px 6px 6px 16px; 
    border-radius: 30px; 
}

.avatar { 
    width: 36px; 
    height: 36px; 
    background: linear-gradient(135deg, #0072bc 0%, #0091df 100%); 
    color: white; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    border-radius: 50%; 
    font-weight: 700; 
    font-size: 14px; 
}

.btn-logout { 
    background: #ffffff; 
    color: var(--danger); 
    padding: 8px 16px; 
    border-radius: 20px; 
    text-decoration: none; 
    font-weight: 600; 
    font-size: 13px; 
    box-shadow: var(--shadow-sm); 
    transition: var(--transition); 
}

.btn-logout:hover { 
    background: #fee2e2; 
}

/* ==========================================================================
   3. GIAO DIỆN TRANG ĐĂNG NHẬP
   ========================================================================== */
.auth-body-bg {
    background: radial-gradient(circle at top right, #eff6ff 0%, #e2e8f0 100%);
    min-height: 100vh;
}

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-box {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 30px 40px -10px rgba(0, 0, 0, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-img {
    width: 120px;
    height: auto;
    margin-bottom: 16px;
    object-fit: contain;
}

.auth-header h2 {
    color: #0f172a;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.auth-header h2 span {
    color: #0072bc;
    font-weight: 600;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--primary);
}

.form-control {
    width: 100%;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    color: #0f172a;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.25s ease;
}

.form-control:focus {
    border-color: #0072bc;
    background: #ffffff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 114, 188, 0.12);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #0072bc 0%, #0091df 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 6px -1px rgba(0, 114, 188, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 114, 188, 0.3);
    opacity: 0.95;
}

.auth-error {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fee2e2;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

.auth-footer {
    margin-top: 35px;
    text-align: center;
    border-top: 1px dashed var(--border);
    padding-top: 20px;
}

.auth-footer p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* ==========================================================================
   4. LƯỚI KHÓA HỌC & TRANG CHỦ HỌC VIÊN
   ========================================================================== */
.welcome-banner {
    margin: 40px 0 20px 0;
}

.welcome-banner h1 {
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.8px;
}

.filter-tabs {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
}

.tab-btn {
    padding: 8px 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border-radius: 20px;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.grid-courses {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.course-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
}

.course-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.course-img-wrapper {
    width: 100%;
    height: 200px;
    background: #cbd5e1;
    position: relative;
    overflow: hidden;
}

.course-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.course-card:hover .course-img-wrapper img {
    transform: scale(1.05);
}

.course-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(4px);
    color: white;
    padding: 4px 12px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.course-body {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ĐÃ HOÀN THIỆN ĐỒNG BỘ 3 THUỘC TÍNH - KHÔNG CÒN LỖI ĐỎ TRONG VS CODE */
.course-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    line-height: 1.4;
    min-height: 52px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 25px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.course-price {
    font-size: 16px;
    color: #0072bc;
    font-weight: 800;
}

.btn-action {
    display: block;
    text-align: center;
    padding: 14px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-enroll-now {
    background: linear-gradient(135deg, #0072bc 0%, #0091df 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 114, 188, 0.2);
}

.btn-enroll-now:hover {
    box-shadow: 0 8px 20px rgba(0, 114, 188, 0.3);
    transform: translateY(-1px);
}

.btn-go-course {
    background: #dcfce7;
    color: #15803d;
}

.btn-go-course:hover {
    background: #bbf7d0;
}

/* ==========================================================================
   5. KHÔNG GIAN HỌC TẬP (WORKSPACE CHUẨN COURSERA)
   ========================================================================== */
.classroom-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 40px 0;
}

.video-player-container {
    background: #000000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 16/9;
    margin-bottom: 25px;
    box-shadow: var(--shadow-md);
}

.video-player-container video {
    width: 100%;
    height: 100%;
    display: block;
}

.moodle-sidebar {
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 25px;
    box-shadow: var(--shadow-md);
    height: fit-content;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #0072bc;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    margin-bottom: 10px;
    background: #f8fafc;
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.material-item:hover, .material-item.active {
    background: #eff6ff;
    border-left-color: #0072bc;
    color: #0072bc;
    font-weight: 600;
}

/* ==========================================================================
   6. HỆ THỐNG TRANG QUẢN TRỊ (ADMIN & TEACHER PANELS)
   ========================================================================== */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-top: 30px;
}

.admin-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 30px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.admin-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
    text-align: left;
}

.data-table th {
    background: #f8fafc;
    color: var(--text-muted);
    padding: 16px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin { background: #fee2e2; color: #991b1b; }
.badge-teacher { background: #fef3c7; color: #92400e; }
.badge-student { background: #e0f2fe; color: #0369a1; }
.badge-success { background: #dcfce7; color: #15803d; }

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

/* ==========================================================================
   7. CHUYỂN ĐỔI RESPONSIVE CHO CÁC MÀN HÌNH LỚN
   ========================================================================== */
@media (min-width: 768px) {
    .form-grid-2 { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 992px) {
    .classroom-layout { grid-template-columns: 2.7fr 1.3fr; }
    .admin-grid { grid-template-columns: 1fr 2fr; } 
}

@media (max-width: 480px) {
    .user-widget span { display: none; }
    .auth-box { padding: 25px 20px; }
}
/* ==========================================================================
   8. GIAO DIỆN CHATBOT TRỢ LÝ HỌC TẬP THÔNG MINH
   ========================================================================== */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 114, 188, 0.4);
    z-index: 2000;
    transition: var(--transition);
}
.chatbot-toggle:hover {
    transform: scale(1.1) rotate(15deg);
}

.chatbot-window {
    position: fixed;
    bottom: 105px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 500px;
    background: var(--card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.chatbot-window.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.chat-header {
    background: var(--accent-gradient);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.chat-header h4 { font-size: 16px; font-weight: 700; }
.chat-header p { font-size: 12px; opacity: 0.8; }

.chat-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.chat-msg {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
}
.msg-bot {
    background: white;
    color: var(--text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}
.msg-user {
    background: #0072bc;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 20px;
    background: #f8fafc;
    border-top: 1px dashed var(--border);
}
.suggest-btn {
    background: white;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #0072bc;
    cursor: pointer;
    transition: var(--transition);
}
.suggest-btn:hover {
    background: #eff6ff;
    border-color: #0072bc;
}

.chat-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    background: white;
}
.chat-input {
    flex-grow: 1;
    border: 1px solid var(--border);
    padding: 10px 14px;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
}
.chat-input:focus { border-color: #0072bc; }
.chat-send {
    background: var(--accent);
    color: white;
    border: none;
    padding: 0 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
/* ==========================================================================
   9. GIAO DIỆN DASHBOARD THỐNG KÊ ĐỘNG (BENTO STATS)
   ========================================================================== */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius-md);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-blue { background: #e0f2fe; color: #0072bc; }
.icon-green { background: #dcfce7; color: #15803d; }
.icon-purple { background: #f3e8ff; color: #7e22ce; }

.stat-info h3 {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}