/* ===== สไตล์กลางยุค 2026 (Bento UI & Glassmorphism) ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, box-shadow 0.3s ease;
}

:root {
    --bg-gradient: linear-gradient(135deg, #f3f0ff 0%, #fff0f5 50%, #e6fffa 100%);
    --card-bg: rgba(255, 255, 255, 0.75);
    --card-border: rgba(255, 255, 255, 0.6);
    --text-main: #1e1b4b;
    --text-muted: #64748b;
    
    /* โทนสีพาสเทลพรีเมียม 2026 */
    --pastel-pink: #ffd6ff;
    --pastel-purple: #e7c6ff;
    --pastel-blue: #bbf7d0;
    --pastel-mint: #c7f9cc;
    --primary-purple: #6c5ce7;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-main);
    padding: 30px 20px;
    line-height: 1.5;
    
    /* ปรับปรุงโครงสร้างหลักแบบแนวตั้งเพื่อให้แยกบล็อกหน้าจอได้อิสระ */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* บังคับซ่อนสถานะให้เด็ดขาด ป้องกันการแสดงผลซ้อนกัน */
.hidden {
    display: none !important;
}

/* ===== การจัดวาง Bento Box Layout ===== */
.card, .auth-box {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--card-border);
    box-shadow: 0 10px 40px rgba(108, 92, 231, 0.04), 0 2px 8px rgba(0, 0, 0, 0.01);
    padding: 30px;
    width: 100%;
}

.card:hover, .auth-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 50px rgba(108, 92, 231, 0.08);
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    font-size: 13.5px;
    font-weight: 600;
    color: #475569;
    display: block;
    margin-bottom: 8px;
}

.form-group label i {
    color: var(--primary-purple);
    margin-right: 6px;
}

input, select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    font-size: 15px;
    background: rgba(248, 250, 252, 0.6);
    color: var(--text-main);
}

input:focus, select:focus {
    border-color: var(--primary-purple);
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.12);
    outline: none;
}

/* ===== ระบบปุ่มกดดีไซน์ล้ำสมัย ===== */
button, .btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    filter: brightness(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, #6c5ce7, #818cf8);
    color: white;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.2);
}

.btn-add, .btn-approve {
    background: #d1fae5;
    color: #065f46;
}

.btn-cancel, .btn-logout {
    background: #fee2e2;
    color: #991b1b;
}
.btn-logout { width: auto; padding: 10px 24px; border-radius: 30px; margin-top: 0; }

/* ===== หน้าจอเข้าสู่ระบบ (index.html) ===== */
.auth-box {
    max-width: 400px;
    text-align: center;
    margin: 80px auto 0 auto;
}

.auth-box .logo-icon {
    font-size: 54px;
    background: linear-gradient(135deg, #6c5ce7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.auth-box h2 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.auth-box .subtitle { color: var(--text-muted); font-size: 14px; margin-bottom: 30px; }

.password-toggle {
    position: absolute; right: 16px; bottom: 12px; cursor: pointer; color: var(--text-muted); font-size: 18px; background: transparent; border: none; padding: 4px; z-index: 2; width: auto;
}

.password-hint { font-size: 12.5px; color: #ef4444; margin-top: 8px; display: flex; align-items: center; gap: 6px; font-weight: 600; }
.password-hint.valid { color: #10b981; }

/* ===== หน้าจอห้องเรียน (index.html) และ แดชบอร์ดแอดมิน (admin.html) ===== */
.container { 
    max-width: 1200px; 
    width: 100%;
}

.header {
    display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 2px solid rgba(108, 92, 231, 0.06); gap: 12px;
}
.header h2 { font-size: 24px; font-weight: 800; }
.header .user-badge { background: #e0f2fe; padding: 6px 16px; border-radius: 30px; font-size: 13.5px; color: #0369a1; font-weight: 700; }

/* แยกสไตล์ Grid ของบทเรียน และสไตล์ Grid ของระบบแอดมินหลังบ้านออกจากกัน */
.course-grid {
    display: grid; 
    grid-template-columns: 1fr 2.4fr; 
    gap: 30px; 
    margin-top: 30px;
    width: 100%;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
    width: 100%;
    max-width: 1300px;
}

.card-full { grid-column: 1 / -1; }

@media (max-width: 900px) {
    .course-grid, .grid-layout { grid-template-columns: 1fr; gap: 20px; }
}

.course-list { background: rgba(255, 255, 255, 0.4); border-radius: 20px; padding: 20px 10px; }
.course-list h3, .card h2 { font-size: 17px; font-weight: 700; padding-bottom: 15px; border-bottom: 2px solid rgba(108, 92, 231, 0.06); display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }

.course-item {
    padding: 16px; background: #ffffff; margin-bottom: 12px; border-radius: 16px; cursor: pointer; border-left: 5px solid var(--primary-purple); font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01); display: flex; align-items: center; gap: 10px;
}
.course-item:hover { background: #f4f3ff; transform: translateX(6px); }
.course-item .course-badge { background: #eef2f6; color: #475569; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; }

/* เครื่องเล่นวิดีโอ 2026 */
.video-viewer { background: rgba(255, 255, 255, 0.4); border-radius: 20px; padding: 20px; }
.video-wrapper { position: relative; padding-top: 56.25%; background: #000000; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.15); }
.video-wrapper video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 20px; }
.note, .no-course-msg { color: var(--text-muted); font-size: 13px; margin-top: 15px; display: flex; align-items: center; gap: 6px; }
.no-course-msg { padding: 25px 20px; color: #dc2626; background: rgba(239, 68, 68, 0.05); border-radius: 16px; font-weight: 600; }

/* ===== ส่วนตารางแอดมิน ===== */
.table-wrap { overflow-x: auto; margin-top: 10px; border-radius: 16px; border: 1px solid rgba(0,0,0,0.02); }
table { width: 100%; border-collapse: collapse; background: #ffffff; }
th, td { padding: 14px 18px; text-align: left; }
th { background: #f8fafc; color: #475569; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
tr:not(:last-child) td { border-bottom: 1px solid #f1f5f9; }
tr:hover td { background: #f8fafc; }
td code { background: #f1f5f9; padding: 4px 8px; border-radius: 8px; font-size: 12.5px; color: #334155; }

.badge-container { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { background: #f0fdf4; color: #166534; padding: 6px 14px; border-radius: 30px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #bbf7d0; }
.badge i { cursor: pointer; color: #ef4444; }
.badge i:hover { color: #b91c1c; }
.empty-row td { color: var(--text-muted); text-align: center; padding: 30px; font-style: italic; }
select[multiple] { height: 130px; padding: 8px; }
select[multiple] option { padding: 8px 12px; border-radius: 10px; margin-bottom: 4px; }
.hint-text { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.page-title { text-align: center; font-size: 32px; font-weight: 800; margin-bottom: 40px; display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 25px; letter-spacing: -0.5px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 20px; }