/* AAS Ujian Online - Updated 2026-06-02 */
/* =============================================
   AKADEMI AKUPUNKTUR SURABAYA — SISTEM UJIAN
   ============================================= */

:root {
  --green: #1a7a3c;
  --green-dark: #0d5c2a;
  --green-light: #e8f5ed;
  --green-mid: #2d9e55;
  --red: #c0392b;
  --red-light: #fdf2f2;
  --gold: #d4890a;
  --gold-light: #fef9e7;
  --blue: #1a56b0;
  --blue-light: #eaf0fb;
  --surface: #f5f7f6;
  --border: #d4e8da;
  --text: #1a1a1a;
  --text-muted: #666;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,0.07);
}

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

html, body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  min-height: 100vh;
}

/* ===== PAGES ===== */
.page { display: none; min-height: 100vh; overflow: hidden; }
.page.active { display: block; overflow: visible; }

/* ===== LOGIN ===== */
.login-bg {
  min-height: 100vh;
  background-color: #052b14;
  background-image: 
    radial-gradient(at 0% 0%, rgba(26, 122, 60, 0.6) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(12, 58, 122, 0.6) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(45, 158, 85, 0.4) 0px, transparent 50%);
  background-attachment: fixed;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  position: relative;
  overflow: hidden;
}

.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 24px;
  padding: 40px 36px;
  width: 100%; max-width: 440px;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3), inset 0 0 0 1px rgba(255,255,255,0.5);
  position: relative;
  z-index: 10;
  animation: slideInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo {
  display: flex; justify-content: center; margin-bottom: 20px;
}
.login-logo img { width: 120px; height: 120px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.logo-fallback {
  width: 84px; height: 84px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-dark), var(--green)); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800;
  box-shadow: 0 8px 16px rgba(26, 122, 60, 0.3);
}

.login-title {
  text-align: center; font-size: 16px; font-weight: 800;
  color: var(--green-dark); margin-bottom: 4px;
  line-height: 1.3;
}
.login-sub {
  text-align: center; font-size: 12px; color: var(--text-muted); margin-bottom: 22px;
}

.role-tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  background: #f0f3f1; border-radius: 12px; padding: 4px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}
.role-tab {
  flex: 1; padding: 10px 6px; border: none; border-radius: 10px;
  background: transparent; cursor: pointer; font-size: 13px;
  font-weight: 700; color: #888; transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.role-tab.active { background: white; color: var(--green); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

/* SVG Eye Icon Animation */
.eye-icon {
  width: 18px; height: 18px; fill: none; stroke: currentColor; 
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: stroke 0.3s, transform 0.3s;
}
.eye-icon-slash {
  stroke-dasharray: 30; stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.3s ease-in-out;
}
.eye-icon.hidden .eye-icon-slash { stroke-dashoffset: 30; }

.login-note { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 14px; }

/* ===== TOPBAR ===== */
.topbar {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 100%);
  color: white; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { height: 45px; width: 45px; object-fit: contain; background: transparent; padding: 0; }
.topbar-title { font-size: 14px; font-weight: 700; }
.topbar-sub { font-size: 11px; opacity: 0.8; }

/* ===== CONTENT ===== */
.content-area { padding: 20px 24px; max-width: 1100px; margin: 0 auto; }

.page-header { margin-bottom: 18px; }
.page-header h2 { font-size: 20px; font-weight: 700; color: var(--text); }
.page-header p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== CARDS ===== */
.card {
  background: var(--white); border-radius: var(--radius);
  border: 0.5px solid var(--border); margin-bottom: 16px;
  box-shadow: var(--shadow); overflow: hidden;
}
.card-head {
  padding: 13px 18px; background: #f3f8f5;
  border-bottom: 0.5px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { font-size: 13px; font-weight: 700; }
.card-body { padding: 16px 18px; }

/* ===== STATS ===== */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-card {
  background: white; border-radius: 12px;
  border: 0.5px solid var(--border); padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.gold { color: var(--gold); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; padding: 9px 14px;
  background: #f3f8f5; font-weight: 600;
  color: #555; font-size: 11px;
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
}
td { padding: 11px 14px; border-bottom: 0.5px solid #f0f0f0; color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:nth-child(even) td { background: #fdfdfd; }
tr:hover td { background: #f0f7f3; }
.empty-row { text-align: center; color: var(--text-muted); padding: 24px; font-size: 12px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: #444; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px; font-size: 13px;
  border: 1.5px solid #d0dfd6; border-radius: 7px;
  background: #fafcfb; outline: none; font-family: inherit;
  transition: border-color 0.2s;
  color: var(--text);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--green); background: white; box-shadow: 0 0 0 3px rgba(26,122,60,0.1); }
.form-group textarea { resize: vertical; min-height: 72px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toggle-group {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 0.5px solid #f0f0f0;
}
.toggle-group label:first-child { margin: 0; font-size: 12px; font-weight: 600; color: var(--text); text-transform: none; letter-spacing: 0; }

/* Toggle Switch */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: #ccc; border-radius: 22px; transition: 0.3s;
}
.slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; left: 2px; bottom: 2px;
  background: white; border-radius: 50%; transition: 0.3s;
}
input:checked + .slider { background: var(--green); }
input:checked + .slider::before { transform: translateX(16px); }

/* ===== BUTTONS ===== */
.btn-primary {
  padding: 10px 22px; font-size: 13px; font-weight: 700;
  background: var(--green); color: white; border: none;
  border-radius: 8px; cursor: pointer; transition: background 0.2s;
  letter-spacing: 0.2px;
}
.btn-primary:hover { background: var(--green-dark); }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-primary.full { width: 100%; padding: 12px; }

.btn-secondary {
  padding: 8px 18px; font-size: 12px; font-weight: 600;
  background: white; color: var(--green); border: 1.5px solid var(--green);
  border-radius: 7px; cursor: pointer; transition: all 0.18s;
}
.btn-secondary:hover { background: var(--green-light); }

.btn-danger {
  padding: 7px 16px; font-size: 12px; font-weight: 600;
  background: white; color: var(--red); border: 1.5px solid var(--red);
  border-radius: 7px; cursor: pointer;
}
.btn-logout {
  padding: 7px 16px; font-size: 12px; font-weight: 600;
  background: rgba(255,255,255,0.15); color: white;
  border: 1px solid rgba(255,255,255,0.3); border-radius: 7px; cursor: pointer;
  transition: background 0.18s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

.btn-submit-exam {
  width: 100%; padding: 12px; font-size: 13px; font-weight: 800;
  background: var(--red); color: white; border: none;
  border-radius: 8px; cursor: pointer; margin-top: auto;
  transition: background 0.2s;
   position: relative;
   z-index: 10;
  display: block;
}
.btn-submit-exam:hover { background: #a93226; }

/* ===== BADGES ===== */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-gold { background: var(--gold-light); color: var(--gold); }
.badge-gray { background: #f0f0f0; color: #555; }
.badge-blue { background: var(--blue-light); color: var(--blue); }

/* ===== ALERTS ===== */
.alert {
  padding: 10px 14px; border-radius: 8px; font-size: 12px; margin-bottom: 12px;
}
.alert-danger { background: var(--red-light); border: 1px solid #f5c6cb; color: #721c24; }
.alert-success { background: var(--green-light); border: 1px solid #c3e6cb; color: #155724; }
.alert-info { background: var(--blue-light); border: 1px solid #b8d4f5; color: #0c3a7a; }
.info-box {
  background: var(--gold-light); border-left: 3px solid var(--gold);
  padding: 10px 14px; border-radius: 0 7px 7px 0; font-size: 11px;
  color: #7a5c00; margin-bottom: 14px; line-height: 1.6;
}
.info-box code { background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 3px; font-size: 11px; }

/* ===== TABS ===== */
.tab-nav {
  display: flex; gap: 4px; margin-bottom: 16px;
  border-bottom: 2px solid var(--border); padding-bottom: 0;
}
.tab-btn {
  padding: 9px 18px; font-size: 12px; font-weight: 600;
  border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all 0.18s; border-radius: 6px 6px 0 0;
}
.tab-btn:hover { color: var(--green); }
.tab-btn.active { color: var(--green); border-bottom-color: var(--green); background: var(--green-light); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== UJIAN LIST ===== */
.ujian-list { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.ujian-item {
  background: white; border: 0.5px solid var(--border); border-radius: 12px;
  padding: 16px 20px; display: flex; align-items: center;
  justify-content: space-between; gap: 14px;
}
.ujian-item.active-exam { border-left: 3px solid var(--green); }
.ujian-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ===== EXAM ===== */
.exam-header {
  background: var(--green-dark); color: white;
  padding: 12px 24px; display: flex;
  align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.exam-title-text { font-size: 13px; font-weight: 700; }
.exam-timer-wrap { text-align: right; }
.timer-label { font-size: 10px; opacity: 0.7; }
.exam-timer { font-size: 22px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.exam-timer.warning { color: #ff6b6b; animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.anticheat-banner {
  background: #fff8e1; border-bottom: 1.5px solid #f0c040;
  padding: 9px 24px; font-size: 11px; color: #7a5c00;
  display: flex; align-items: flex-start; gap: 10px;
}
.ac-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

.exam-body {
  display: flex; gap: 0; min-height: calc(100vh - 140px);
}

.soal-sidebar {
  width: 200px; flex-shrink: 0;
  background: white; border-right: 0.5px solid var(--border);
  padding: 16px; position: sticky; top: 110px;
  height: calc(100vh - 130px);
   display: flex;
   flex-direction: column;
  overflow: hidden;
}
.sidebar-title { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

.soal-grid { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; flex-grow: 1; overflow-y: auto; align-content: flex-start; padding-bottom: 10px;
           }
.soal-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: 1.5px solid #d0d0d0; background: white;
  font-size: 11px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; color: #666;
}
.soal-btn.answered { background: var(--green); border-color: var(--green); color: white; }
.soal-btn.current { border-color: var(--gold); color: var(--gold); font-weight: 800; }
.soal-btn.answered.current { background: var(--gold); border-color: var(--gold); color: white; }

.sidebar-legend { font-size: 10px; color: var(--text-muted); }
.legend-item { display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; }
.legend-dot.answered { background: var(--green); }
.legend-dot.unanswered { background: white; border: 1.5px solid #d0d0d0; }
.legend-dot.current { background: var(--gold); }

.soal-main { flex: 1; padding: 20px 24px; }

.soal-card {
  background: white; border-radius: 10px;
  border: 0.5px solid var(--border); padding: 20px;
  margin-bottom: 16px; box-shadow: var(--shadow);
}
.soal-number { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.soal-text { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 16px; line-height: 1.8; }
.soal-poin { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; font-weight: 600; }

/* Responsive Media in Questions */
#soal-content img, #soal-content video, #soal-content iframe {
  max-width: 100% !important;
  height: auto;
  border-radius: 8px;
}
#soal-content iframe {
  aspect-ratio: 16 / 9;
}

.options { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-radius: 8px;
  border: 2px solid #e8e8e8; cursor: pointer;
  font-size: 16px; transition: all 0.15s;
}
.option-item:hover { border-color: var(--green); background: var(--green-light); }
.option-item.selected { border-color: var(--green); background: var(--green-light); font-weight: 600; }
.option-item.correct { border-color: var(--green); background: #d4edda; }
.option-item.wrong { border-color: var(--red); background: var(--red-light); }
.opt-letter {
  width: 32px; height: 32px; border-radius: 50%; background: #f0f0f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; color: #555; flex-shrink: 0;
}
.selected .opt-letter { background: var(--green); color: white; }
.correct .opt-letter { background: var(--green); color: white; }
.wrong .opt-letter { background: var(--red); color: white; }

.soal-nav-btns {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
}
.soal-counter { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ===== RESULT ===== */
.result-card {
  max-width: 560px; margin: 30px auto;
  background: white; border-radius: 16px;
  border: 0.5px solid var(--border); padding: 32px;
  box-shadow: var(--shadow); text-align: center;
}
.result-header { margin-bottom: 20px; }
.result-header h2 { font-size: 20px; font-weight: 800; margin-top: 8px; }
.result-header p { font-size: 12px; color: var(--text-muted); }

.result-score-circle {
  width: 120px; height: 120px; border-radius: 50%;
  background: var(--green-light); border: 4px solid var(--green);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; margin: 20px auto;
}
.score-number { font-size: 40px; font-weight: 900; color: var(--green); line-height: 1; }
.score-label { font-size: 10px; color: var(--text-muted); }

.result-status { margin: 10px 0 20px; }
.result-stats {
  display: flex; justify-content: center; gap: 30px;
  padding: 16px 0; border-top: 0.5px solid var(--border); border-bottom: 0.5px solid var(--border);
  margin-bottom: 20px;
}
.rs-item { text-align: center; }
.rs-val { font-size: 20px; font-weight: 800; }
.rs-val.green { color: var(--green); }
.rs-val.red { color: var(--red); }
.rs-val.gray { color: #888; }
.rs-label { font-size: 11px; color: var(--text-muted); }

.result-review { text-align: left; margin-bottom: 20px; }
.review-item {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; font-size: 12px;
  border: 1px solid;
}
.review-item.correct { border-color: #c3e6cb; background: #d4edda; }
.review-item.wrong { border-color: #f5c6cb; background: var(--red-light); }
.review-q { font-weight: 600; margin-bottom: 4px; }
.review-a { color: #555; }

.result-actions { display: flex; gap: 10px; justify-content: center; }

/* ===== IMPORT ===== */
.import-tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.import-tab {
  padding: 6px 14px; border: 1.5px solid var(--border); border-radius: 6px;
  background: white; cursor: pointer; font-size: 11px; font-weight: 700;
  color: var(--text-muted); transition: all 0.18s;
}
.import-tab.active { border-color: var(--green); background: var(--green-light); color: var(--green); }

.dropzone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 28px;
  text-align: center; cursor: pointer; background: #fafcfb;
  transition: border-color 0.2s;
}
.dropzone:hover { border-color: var(--green); background: var(--green-light); }
.drop-icon { font-size: 28px; margin-bottom: 8px; }
.dropzone p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.dropzone small { font-size: 10px; color: #aaa; }

/* ===== SOAL PREVIEW ===== */
.soal-preview-list { padding: 0 16px 16px; }
.soal-preview-item {
  background: #fafcfb; border: 0.5px solid var(--border);
  border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
  font-size: 12px;
}
.spi-q { font-weight: 700; margin-bottom: 6px; color: var(--text); }
.spi-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; color: var(--text-muted); }
.spi-ans { margin-top: 6px; font-weight: 700; color: var(--green); font-size: 11px; }

/* ===== MANUAL SOAL INPUT ===== */
.manual-soal-item {
  background: #fafcfb; border: 0.5px solid var(--border);
  border-radius: 9px; padding: 14px; margin-bottom: 10px;
}
.manual-soal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.manual-soal-num { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.manual-soal-del { background: none; border: none; color: var(--red); cursor: pointer; font-size: 12px; }

.opts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }

/* ===== MONITOR ===== */
.cheat-log {
  padding: 12px 16px; max-height: 280px; overflow-y: auto;
  font-size: 11px;
}
.log-entry {
  padding: 6px 0; border-bottom: 0.5px solid #f0f0f0;
  display: flex; gap: 10px;
}
.log-time { color: #aaa; flex-shrink: 0; }
.log-name { font-weight: 700; color: var(--text); flex-shrink: 0; }
.log-event { color: var(--text-muted); }
.log-violation { color: var(--red); font-weight: 700; }
.log-empty { color: var(--text-muted); text-align: center; padding: 20px 0; }

/* ===== SETTINGS ===== */
.setting-list { display: flex; flex-direction: column; }
.setting-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 0.5px solid #f0f0f0;
  gap: 14px;
}
.setting-item:last-child { border-bottom: none; }
.setting-item > div { flex: 1; }
.setting-item strong { font-size: 13px; font-weight: 700; display: block; }
.setting-item p { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-box {
  background: white; border-radius: 14px; padding: 28px;
  max-width: 400px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-box h3 { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
.modal-box p { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.modal-soal-info {
  background: var(--surface); border-radius: 8px; padding: 12px;
  font-size: 12px; margin-bottom: 16px;
}
.modal-actions { display: flex; gap: 10px; }

/* ===== LOADING ===== */
.loading-spinner { 
  text-align: center; 
  padding: 24px; 
  color: var(--text-muted); 
  font-size: 12px;
  animation: fadeIn 0.3s ease-in-out;
}

/* ===== SMOOTH ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Smooth fade for content */
.fade-in {
  animation: fadeIn 0.4s ease-in-out;
}

.fade-out {
  animation: fadeOut 0.3s ease-in-out;
}

.slide-in-up {
  animation: slideInUp 0.5s ease-out;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Better loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(26, 122, 60, 0.2);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

.spinner-large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Smooth transitions for tables and lists */
table tbody, .ujian-list, .cheat-log {
  transition: opacity 0.3s ease-in-out;
}

table tbody.loading, .ujian-list.loading, .cheat-log.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Card smooth appearance */
.card {
  animation: slideInUp 0.4s ease-out;
}

/* Smooth hover effects */
.ujian-item, .option-item, .soal-btn, .btn-primary, .btn-secondary {
  transition: all 0.2s ease-in-out;
}

.ujian-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.btn-primary:active, .btn-secondary:active, .btn-danger:active {
  transform: scale(0.96);
}

/* Toast animation improvement */
#global-toast {
  animation: slideInRight 0.4s ease-out;
}

@keyframes slideInRight {
  from { 
    opacity: 0; 
    transform: translateX(100px);
  }
  to { 
    opacity: 1; 
    transform: translateX(0);
  }
}

/* ===== Log entry short class aliases (used in JS) ===== */
.log-t { color: #aaa; flex-shrink: 0; font-size: 10px; }
.log-n { font-weight: 700; color: var(--text); flex-shrink: 0; }
.log-e { color: var(--text-muted); }
.log-v { color: var(--red); font-weight: 700; }

/* ===== Sidebar Toggle Button (mobile only) ===== */
#sidebar-toggle-btn {
  display: none;
  width: 100%;
  padding: 11px 16px;
  background: var(--green-light);
  border: none;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.3px;
}
#sidebar-toggle-btn:active { background: #d4edda; }

/* Display rules for Submit Buttons */
.mobile-submit-btn { display: none !important; }
.desktop-submit-btn { display: block; }

/* ===== RESPONSIVE — Mobile ===== */
@media (max-width: 768px) {

  /* --- General Layout --- */
  .mobile-submit-btn { display: flex !important; }
  .desktop-submit-btn { display: none !important; }
  .content-area { padding: 10px 10px; }
  .form-grid-2 { grid-template-columns: 1fr; gap: 8px; }

  /* --- Stats Row --- */
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 10px; }

  /* --- Topbar --- */
  .topbar { padding: 8px 12px; }
  .topbar-logo { height: 35px; width: 35px; }
  .topbar-title { font-size: 12px; line-height: 1.2; }
  .topbar-sub { font-size: 10px; }
  .topbar-left { gap: 8px; }
  .btn-logout { padding: 6px 10px; font-size: 11px; }

  /* --- Tab Navigation --- */
  .tab-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 0;
    gap: 2px;
    scrollbar-width: none;
  }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { padding: 8px 12px; font-size: 11px; white-space: nowrap; flex-shrink: 0; }

  /* --- Cards --- */
  .card-head { padding: 10px 12px; }
  .card-body { padding: 10px 12px; }
  .card-head h3 { font-size: 12px; }

  /* --- Tables --- */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 11px; min-width: 480px; }
  th, td { padding: 7px 10px; white-space: nowrap; }

  /* --- Ujian List Items --- */
  .ujian-item { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .ujian-item > div:last-child { width: 100%; justify-content: flex-end; }
  .ujian-meta { font-size: 10px; line-height: 1.5; }

  /* --- EXAM: Header --- */
  .exam-header {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .exam-title-text {
    font-size: 11px;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .exam-timer { font-size: 18px; letter-spacing: 0.5px; }
  .timer-label { font-size: 9px; }
  .anticheat-banner { padding: 6px 12px; font-size: 10px; gap: 6px; }

  /* --- EXAM: Sidebar Mobile Toggle --- */
  #sidebar-toggle-btn { display: block; }
  .exam-body { flex-direction: column; }

  .soal-sidebar {
    width: 100%;
    position: static;
    border-right: none;
    border-bottom: 0.5px solid var(--border);
    padding: 10px 12px;
    max-height: none;
    overflow-y: visible;
    transition: all 0.2s ease;
  }
  .soal-sidebar.collapsed { display: none; }
  .sidebar-title { font-size: 10px; margin-bottom: 8px; }
  .soal-grid { gap: 4px; }
  .soal-btn { width: 34px; height: 34px; font-size: 12px; border-radius: 7px; }
  .sidebar-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
  .legend-item { margin-bottom: 0; font-size: 10px; }
  .btn-submit-exam { margin-top: 10px; padding: 11px; font-size: 12px; }

  /* --- EXAM: Soal Main --- */
  .soal-main { padding: 10px; }
  .soal-card { padding: 14px; }
  .soal-number { font-size: 10px; }
  .soal-text { font-size: 13px; line-height: 1.55; }
  .soal-poin { font-size: 10px; }
  .options { gap: 7px; }
  .option-item { padding: 10px 12px; font-size: 12px; gap: 8px; }
  .opt-letter { width: 22px; height: 22px; font-size: 10px; }
  .soal-nav-btns { padding: 15px 0; gap: 8px; margin-bottom: 130px; }
  .soal-nav-btns .btn-secondary { flex: 1; padding: 12px 10px; font-size: 13px; justify-content: center; }
  .soal-counter { flex: 0 0 auto; font-size: 13px; font-weight: bold; }

  /* --- Result --- */
  .result-card { margin: 20px auto !important; padding: 18px 14px; }
  .result-score-circle { width: 100px; height: 100px; }
  .score-number { font-size: 32px; }
  .result-stats { gap: 14px; padding: 12px 0; }
  .rs-val { font-size: 18px; }
  .result-actions { flex-direction: column; gap: 8px; }
  .result-actions button { width: 100%; }

  /* --- Login --- */
  .login-card { padding: 22px 18px; margin: 8px; }
  .login-title { font-size: 15px; }
  .login-logo img { width: 85px; height: 85px; }

  /* --- Import --- */
  .import-tabs { flex-wrap: wrap; gap: 4px; }
  .import-tab { font-size: 10px; padding: 5px 10px; }

  /* --- Buttons --- */
  .btn-primary { font-size: 12px; padding: 10px 16px; }
  .btn-secondary { font-size: 11px; padding: 7px 12px; }

  /* --- Modal --- */
  .modal-box { padding: 20px 14px; }
  .modal-actions { flex-direction: column; gap: 8px; }
  .modal-actions .btn-primary,
  .modal-actions .btn-secondary { width: 100%; justify-content: center; }

  /* --- Cheat Log --- */
  .cheat-log { font-size: 10px; padding: 8px 12px; }
  .log-entry { gap: 6px; flex-wrap: wrap; }

  /* --- Dropzone --- */
  .dropzone { padding: 18px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .exam-title-text { max-width: 130px; }
  .result-stats { flex-direction: column; align-items: center; gap: 10px; }
  .tab-btn { padding: 7px 10px; font-size: 10px; }
  .topbar-sub { display: none; }
}

/* ANTI-COPY PASTE TINGKAT WEB */
body {
  -webkit-touch-callout: none; /* Disable long press popup on iOS */
  -webkit-user-select: none;   /* Disable text selection Safari */
  -khtml-user-select: none;    /* Disable text selection Konqueror */
  -moz-user-select: none;      /* Disable text selection Firefox */
  -ms-user-select: none;       /* Disable text selection Internet Explorer/Edge */
  user-select: none;           /* Disable text selection Chrome/Opera */
}

/* Izinkan ketik di kolom input/textarea */
input, textarea {
  -webkit-user-select: auto !important;
  -khtml-user-select: auto !important;
  -moz-user-select: auto !important;
  -ms-user-select: auto !important;
  user-select: auto !important;
}
