:root {
    --primary: #0B132B;
    --secondary: #00E5FF;
    --secondary-hover: #00B8D4;
    --bg-light: #F4F7FB;
    --panel-bg: #FFFFFF;
    --text-dark: #1C2541;
    --border-color: #E2E8F0;
    --success: #00E676;
    --danger: #FF1744;
    --warning: #FFEA00;
    --glow: 0 0 10px rgba(0, 229, 255, 0.4);
}

* { box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 0; padding: 0; }
body { background-color: var(--bg-light); color: var(--text-dark); display: flex; height: 100vh; overflow: hidden; }

.text-center { text-align: center; }
.mt-3 { margin-top: 15px; }
.mt-2 { margin-top: 10px; }

.sidebar { 
    width: 260px; background: var(--primary); color: white; display: flex; flex-direction: column; flex-shrink: 0; 
    transition: transform 0.3s ease; z-index: 100;
}
.sidebar .brand { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar h2 { color: var(--secondary); letter-spacing: 1px; margin-bottom: 5px;}
.menu-list { list-style: none; padding: 0; margin: 0; flex-grow: 1; overflow-y: auto;}
.menu-item { padding: 15px 20px; color: #a0aec0; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.9rem; transition: 0.2s;}
.menu-item i { width: 25px; color: var(--secondary); }
.menu-item:hover, .menu-item.active { background: rgba(0, 229, 255, 0.1); color: white; border-left: 4px solid var(--secondary); text-shadow: 0 0 5px var(--secondary); }

.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.top-header { 
    padding: 15px 20px; background: white; border-bottom: 1px solid var(--border-color); 
    display: flex; justify-content: space-between; align-items: center; font-weight:bold; color: var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02); z-index: 10;
}
.menu-toggle-btn { display: none; background: none; border: none; font-size: 1.5rem; color: var(--primary); cursor: pointer; }

.content-section { display: none; height: 100%; flex-direction: column; overflow-y: auto; padding: 20px;}
.content-section.active { display: flex; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 20px; }
.stat-card { background: var(--panel-bg); padding: 20px; border-radius: 10px; border-bottom: 3px solid var(--secondary); box-shadow: 0 4px 6px rgba(0,0,0,0.05); transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--glow); }
.stat-val { font-size: 2rem; font-weight: bold; color: var(--primary); margin: 5px 0; }
.stat-label { font-size: 0.75rem; color: #64748b; text-transform: uppercase; letter-spacing: 1px; }

.panel { background: var(--panel-bg); padding: 20px; border-radius: 10px; border: 1px solid var(--border-color); margin-bottom:20px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }
.panel-title { font-size: 1.1rem; font-weight: bold; color: var(--primary); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center;}

.table-responsive { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
th, td { padding: 12px; border-bottom: 1px solid var(--border-color); text-align: left; font-size: 0.85rem;}
th { background: #f8fafc; color: #475569; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.5px;}
tr:hover { background: rgba(0, 229, 255, 0.02); }

.btn { padding: 10px 18px; border: none; border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: bold; color: white; transition: all 0.2s; text-transform: uppercase; letter-spacing: 0.5px;}
.btn i { margin-right: 5px; }
.btn-blue { background: var(--secondary); color: var(--primary); } 
.btn-blue:hover { background: var(--secondary-hover); box-shadow: var(--glow); }
.btn-green { background: var(--success); } .btn-green:hover { background: #00C853; box-shadow: 0 0 10px rgba(0, 230, 118, 0.4); }
.btn-red { background: var(--danger); } .btn-red:hover { background: #D50000; box-shadow: 0 0 10px rgba(255, 23, 68, 0.4); }
.btn-gray { background: #64748b; } .btn-gray:hover { background: #475569; }

.quiz-toolbar { background: white; padding: 12px 20px; display: flex; justify-content: space-between; border-radius: 8px; border: 1px solid var(--border-color); font-weight: bold; margin-bottom: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.quiz-area { display: flex; flex-direction: row; gap: 20px; }
.quiz-left { flex: 2.5; background: white; border-radius: 10px; border: 1px solid var(--border-color); padding: 15px; display: flex; flex-direction: column; }
.quiz-right { flex: 1; min-width: 320px; background: white; border-radius: 10px; border: 1px solid var(--border-color); padding: 15px; overflow-y: auto; max-height: calc(100vh - 120px); }
.quiz-image-container { width: 100%; height: 75vh; min-height: 500px; background: #0B132B; display: flex; align-items: center; justify-content: center; border-radius: 8px; overflow: hidden; margin-bottom: 15px; position: relative;}
.quiz-image-container img { max-width: 100%; max-height: 100%; object-fit: contain; }

.ep-section { background: #f8fafc; border: 1px solid var(--border-color); padding: 15px; border-radius: 8px; margin-bottom: 15px; }
.ep-title { font-weight: bold; font-size: 0.8rem; margin-bottom: 10px; color: var(--primary); text-transform: uppercase; border-bottom: 2px solid var(--secondary); padding-bottom: 5px; display: inline-block;}
.radio-toolbar { display: flex; flex-wrap: wrap; gap: 5px; }
.radio-toolbar input[type="radio"] { display: none; }
.radio-toolbar label { 
    display: inline-block; background-color: #fff; border: 1px solid var(--border-color); 
    padding: 8px 14px; font-size: 0.85rem; font-weight: bold; cursor: pointer; border-radius: 6px; color: #475569; transition: all 0.2s;
}
.radio-toolbar label:hover { border-color: var(--secondary); box-shadow: 0 0 5px rgba(0,229,255,0.2); }
.radio-toolbar input[type="radio"]:checked + label { background-color: var(--secondary); color: var(--primary); border-color: var(--secondary); box-shadow: var(--glow); }

.grid-ep2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(11, 19, 43, 0.8); z-index: 1000; align-items: center; justify-content: center; overflow-y: auto; padding: 20px; backdrop-filter: blur(3px);}
.modal-overlay.active { display: flex; }
.modal-content { background: white; padding: 25px; border-radius: 10px; width: 100%; max-width: 600px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); margin: auto; border-top: 4px solid var(--secondary);}
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 0.8rem; font-weight: bold; color: var(--primary); margin-bottom: 5px; text-transform: uppercase;}
.form-control { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 6px; font-size: 0.9rem; transition: border 0.3s; background: #f8fafc;}
.form-control:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 5px rgba(0,229,255,0.3); background: white;}

.profile-avatar-container { width: 110px; height: 110px; border-radius: 50%; background: #e2e8f0; display: flex; align-items: center; justify-content: center; overflow: hidden; margin: 0 auto 15px; position: relative; border: 3px solid var(--secondary); cursor: pointer; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.profile-avatar-container img { width: 100%; height: 100%; object-fit: cover; }
.profile-avatar-overlay { position: absolute; bottom: 0; background: rgba(0,0,0,0.6); color: white; width: 100%; text-align: center; padding: 5px 0; font-size: 0.75rem; font-weight: bold; opacity: 0; transition: opacity 0.3s; }
.profile-avatar-container:hover .profile-avatar-overlay { opacity: 1; }
.header-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; border: 2px solid var(--secondary); }

.q-nav-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; background: white; padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
.q-nav-box { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 6px; border: 2px solid var(--border-color); font-size: 0.85rem; font-weight: bold; cursor: pointer; color: #64748b; transition: all 0.2s; background: #f8fafc; }
.q-nav-box:hover { border-color: var(--secondary); background: white; }
.q-nav-box.answered { background: #dcfce7; color: #166534; border-color: #22c55e; box-shadow: 0 2px 5px rgba(34, 197, 94, 0.2); }
.q-nav-box.active { border-color: var(--secondary); box-shadow: 0 0 10px rgba(0,229,255,0.4); background: white; color: var(--primary); transform: translateY(-2px); }

@media (max-width: 850px) {
    .menu-toggle-btn { display: block; }
    .sidebar { position: fixed; height: 100%; left: -260px; box-shadow: 5px 0 15px rgba(0,0,0,0.3); }
    .sidebar.show { left: 0; }
    .quiz-area { flex-direction: column; }
    .quiz-left { flex: none; height: auto; }
    .quiz-image-container { height: 350px; }
    .quiz-right { flex: none; max-height: none; overflow-y: visible; }
    .grid-ep2 { grid-template-columns: 1fr; }
    .top-header { font-size: 0.9rem; }
    .panel-title { flex-direction: column; align-items: flex-start; gap: 10px; }
    .panel-title button { width: 100%; }
}