* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    padding: 20px 12px 40px;
    color: #1e293b;
}

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

h1 {
    text-align: center;
    font-size: clamp(1.4rem, 4vw, 2rem);
    color: #0f172a;
    margin-bottom: 20px;
    line-height: 1.3;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.user-info { font-size: 0.95rem; color: #334155; }
.user-info a { color: #1e40af; text-decoration: none; font-weight: 600; }
.user-info a:hover { text-decoration: underline; }

.btn {
    display: inline-block;
    padding: 9px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.btn-primary { background: #1e40af; color: white; }
.btn-primary:hover { background: #1e3a8a; }
.btn-outline { background: white; color: #1e40af; border: 2px solid #1e40af; }
.btn-outline:hover { background: #eff6ff; }
.btn-danger { background: #dc2626; color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: #16a34a; color: white; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-xs { padding: 4px 10px; font-size: 0.8rem; }

/* Grid khóa học */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 20px;
}

.course-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}
.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,.12);
}
.course-card h3 {
    text-align: center;
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    padding: 14px 12px 10px;
    color: #1e40af;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #e2e8f0;
    overflow: hidden;
}
.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.thumb .placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #64748b;
    font-weight: 600;
    font-size: 1.1rem;
}
.course-meta {
    padding: 12px 16px 16px;
    font-size: 0.9rem;
    color: #475569;
}

/* Trang khóa học */
.course-header {
    background: white;
    border-radius: 16px;
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.course-header h1 { text-align: left; margin-bottom: 8px; font-size: 1.5rem; }
.course-header p { color: #64748b; margin-bottom: 12px; }

.video-section {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    margin-bottom: 28px;
}
.video-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #0f172a;
}
.video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}
.video-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
    gap: 10px;
}
.video-title { font-weight: 600; color: #1e293b; }

/* Fullscreen */
.fullscreen-view {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #0f172a;
    flex-direction: column;
}
.fullscreen-view.active { display: flex; }
.fs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1e293b;
    color: white;
}
.fs-embed { flex: 1; position: relative; }
.fs-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Danh sách buổi học */
.lessons-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    overflow: hidden;
}
.lessons-box h2 {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.15rem;
    color: #1e40af;
}
.lesson-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background .15s;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item:hover { background: #f8fafc; }
.lesson-item.active { background: #eff6ff; border-left: 4px solid #1e40af; }
.lesson-item.locked { cursor: not-allowed; opacity: 0.7; }
.lesson-item.locked:hover { background: transparent; }

.lesson-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e0f2fe;
    color: #1e40af;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.lesson-item.active .lesson-num { background: #1e40af; color: white; }
.lesson-item.locked .lesson-num { background: #f1f5f9; color: #94a3b8; }

.lesson-info { flex: 1; }
.lesson-info .title { font-weight: 600; color: #1e293b; }
.lesson-info .meta { font-size: 0.85rem; color: #64748b; margin-top: 2px; }

.lock-icon { color: #94a3b8; font-size: 1.1rem; }

/* Form */
.form-box {
    max-width: 420px;
    margin: 40px auto;
    background: white;
    border-radius: 16px;
    padding: 32px 28px;
    box-shadow: 0 8px 30px rgba(0,0,0,.1);
}
.form-box h2 { text-align: center; margin-bottom: 24px; color: #1e40af; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: #334155; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    font-size: 1rem;
    transition: border .2s;
    font-family: inherit;
}
.form-group textarea { min-height: 90px; resize: vertical; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    outline: none; border-color: #1e40af;
}
.form-error { background: #fef2f2; color: #b91c1c; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.form-success { background: #f0fdf4; color: #15803d; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; }
.form-footer { text-align: center; margin-top: 20px; font-size: 0.95rem; color: #64748b; }
.form-footer a { color: #1e40af; font-weight: 600; }

/* Admin */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    margin-bottom: 24px;
}
.admin-table th, .admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}
.admin-table th {
    background: #f8fafc;
    color: #1e40af;
    font-weight: 600;
    font-size: 0.9rem;
}
.admin-table tr:hover td { background: #f8fafc; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #b45309; }
.badge-approved { background: #dcfce7; color: #15803d; }
.badge-banned { background: #fee2e2; color: #b91c1c; }

.admin-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,.06);
    padding: 20px 24px;
    margin-bottom: 24px;
}
.admin-card h2 {
    font-size: 1.2rem;
    color: #1e40af;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.admin-tabs a {
    padding: 8px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    background: white;
    color: #64748b;
    border: 1.5px solid #e2e8f0;
}
.admin-tabs a.active, .admin-tabs a:hover {
    background: #1e40af;
    color: white;
    border-color: #1e40af;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 20px; color: #1e40af; font-size: 1.2rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.notice {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* Footer hỗ trợ & liên hệ */
.site-footer {
    margin-top: 48px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    padding: 28px 24px 24px;
    text-align: center;
}
.footer-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 20px;
}
.footer-title i { margin-right: 8px; }
.footer-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 28px 40px;
    margin-bottom: 18px;
}
.footer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}
.footer-item > i {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #eff6ff;
    color: #1e40af;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.footer-item strong {
    display: block;
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 2px;
}
.footer-item span {
    font-size: 1rem;
    color: #1e293b;
    font-weight: 600;
}
.footer-item a {
    color: #1e40af;
    text-decoration: none;
}
.footer-item a:hover { text-decoration: underline; }
.footer-note {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.5;
    border-top: 1px solid #e2e8f0;
    padding-top: 16px;
    margin-top: 4px;
}

@media (max-width: 768px) {
    .grid { grid-template-columns: 1fr; gap: 20px; }
    body { padding: 16px 10px 32px; }
    .course-header h1 { font-size: 1.25rem; }
    .admin-table { font-size: 0.85rem; }
    .admin-table th, .admin-table td { padding: 8px 10px; }
    .footer-grid { gap: 18px 24px; }
    .site-footer { padding: 22px 16px 20px; }
}
