/* css/style.css - Sistem Desain Platform Simulasi Psikotes */

:root {
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-size-base: 16px;
  --font-size-q: 20px;
  --font-size-lg: 24px;
  --font-size-sm: 14px;
  --font-size-xs: 12px;

  /* Palet Warna Mode Terang (Default) */
  --bg-app: #f4f6f8;
  --bg-card: #ffffff;
  --bg-subtle: #eaedf1;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --text-inverse: #ffffff;

  --border-color: #d1d5db;
  --border-focus: #2563eb;

  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --secondary: #4b5563;
  --secondary-hover: #374151;

  --accent-flag: #d97706;
  --accent-flag-bg: #fef3c7;
  --accent-flag-border: #f59e0b;

  --accent-answered: #15803d;
  --accent-answered-bg: #dcfce7;
  --accent-answered-border: #22c55e;

  --accent-current: #2563eb;
  --accent-current-bg: #dbeafe;

  --warn-bg: #fee2e2;
  --warn-text: #b91c1c;
  --warn-border: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);

  --chart-line: #2563eb;
  --chart-bar: #3b82f6;
  --chart-axis: #9ca3af;
  --chart-grid: #e5e7eb;
}

/* Dukungan Otomatis prefers-color-scheme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-app: #111827;
    --bg-card: #1f2937;
    --bg-subtle: #374151;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --text-inverse: #111827;

    --border-color: #4b5563;
    --border-focus: #60a5fa;

    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --secondary: #6b7280;
    --secondary-hover: #9ca3af;

    --accent-flag: #fbbf24;
    --accent-flag-bg: #78350f;
    --accent-flag-border: #f59e0b;

    --accent-answered: #4ade80;
    --accent-answered-bg: #064e3b;
    --accent-answered-border: #22c55e;

    --accent-current: #60a5fa;
    --accent-current-bg: #1e3a8a;

    --warn-bg: #7f1d1d;
    --warn-text: #fecaca;
    --warn-border: #f87171;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);

    --chart-line: #60a5fa;
    --chart-bar: #3b82f6;
    --chart-axis: #6b7280;
    --chart-grid: #374151;
  }
}

/* Override Eksplisit Tema Gelap */
[data-theme="dark"] {
  --bg-app: #111827;
  --bg-card: #1f2937;
  --bg-subtle: #374151;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-inverse: #111827;

  --border-color: #4b5563;
  --border-focus: #60a5fa;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --secondary: #6b7280;
  --secondary-hover: #9ca3af;

  --accent-flag: #fbbf24;
  --accent-flag-bg: #78350f;
  --accent-flag-border: #f59e0b;

  --accent-answered: #4ade80;
  --accent-answered-bg: #064e3b;
  --accent-answered-border: #22c55e;

  --accent-current: #60a5fa;
  --accent-current-bg: #1e3a8a;

  --warn-bg: #7f1d1d;
  --warn-text: #fecaca;
  --warn-border: #f87171;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);

  --chart-line: #60a5fa;
  --chart-bar: #3b82f6;
  --chart-axis: #6b7280;
  --chart-grid: #374151;
}

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

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Container Aplikasi */
.app-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Header Utama */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 24px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  color: var(--primary);
  font-size: 22px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Banner Peringatan Tab Away */
.warn-tab-banner {
  background-color: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-weight: 600;
  text-align: center;
}

/* Utilitas Tampilan */
.view-panel {
  display: block;
}

.hidden {
  display: none !important;
}

/* Komponen Kartu */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.card-badge {
  display: inline-block;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge {
  display: inline-block;
  background-color: var(--primary);
  color: #fff;
  font-size: var(--font-size-xs);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Tombol */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-size: var(--font-size-base);
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--bg-subtle);
}

.btn-sm {
  padding: 6px 12px;
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: 12px 28px;
  font-size: 18px;
}

.btn-block {
  width: 100%;
}

.btn-flag {
  background-color: var(--bg-card);
  color: var(--accent-flag);
  border-color: var(--accent-flag-border);
}

.btn-flag.active {
  background-color: var(--accent-flag-bg);
}

/* TAMPILAN BERANDA */
.hero-section {
  text-align: center;
  margin-bottom: 36px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-main);
}

.hero-desc {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 800px;
  margin: 0 auto;
}

.sim-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.sim-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sim-card h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.card-desc {
  color: var(--text-muted);
  margin-bottom: 16px;
  flex: 1;
}

.card-meta {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 16px;
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 30px;
}

.mod-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
}

.mod-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.mod-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mod-code {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.mod-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.mod-info {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

/* TAMPILAN INSTRUKSI */
.instruction-container {
  max-width: 850px;
  margin: 0 auto;
}

.instruction-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.instruction-title {
  font-size: 24px;
}

.instruction-text {
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 24px;
  padding: 16px;
  background-color: var(--bg-subtle);
  border-radius: 6px;
  border-left: 4px solid var(--primary);
}

.instruction-examples {
  margin-bottom: 24px;
}

.example-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  margin-top: 12px;
}

.example-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--primary);
  margin-bottom: 8px;
}

.example-prompt {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.example-exp {
  font-size: 14px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 8px;
}

.instruction-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.instruction-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* TAMPILAN TES */
.test-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.test-info-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.test-mod-tag {
  font-weight: 700;
  background-color: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: 4px;
}

.test-qnum {
  font-size: 17px;
  font-weight: 600;
}

.test-status-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background-color: var(--bg-subtle);
  border-radius: 6px;
  font-family: monospace;
  font-size: 18px;
  font-weight: 700;
}

.timer-box.warn {
  background-color: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from { opacity: 1; }
  to { opacity: 0.8; }
}

/* Soal & Pilihan */
.standard-q-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 32px 24px;
  margin-bottom: 24px;
  min-height: 280px;
}

.question-prompt {
  font-size: var(--font-size-q);
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 28px;
  color: var(--text-main);
  user-select: text;
}

.question-prompt svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
}

.question-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.opt {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 17px;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font-family: inherit;
}

.opt:hover:not(:disabled) {
  border-color: var(--border-focus);
  background-color: var(--bg-subtle);
}

.opt.selected {
  border-color: var(--primary);
  background-color: var(--accent-current-bg);
  font-weight: 600;
}

.opt:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.opt-key-badge {
  display: inline-block;
  width: 28px;
  height: 28px;
  line-height: 26px;
  text-align: center;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-right: 14px;
  font-weight: 700;
  font-size: 14px;
  background-color: var(--bg-subtle);
}

/* Input Isian */
.question-input-row {
  margin-top: 16px;
}

.input-wrapper {
  display: flex;
  gap: 12px;
}

.form-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 18px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.input-tip {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 8px;
}

/* Navigasi Bawah & Grid */
.test-bottom-nav {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-buttons {
  display: flex;
  justify-content: space-between;
}

.nav-grid-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.grid-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
}

.qcell {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.qcell:hover:not(:disabled) {
  border-color: var(--border-focus);
}

.qcell.current {
  border-width: 2px;
  border-color: var(--primary);
  background-color: var(--accent-current-bg);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.qcell.answered {
  background-color: var(--accent-answered-bg);
  border-color: var(--accent-answered-border);
  color: var(--accent-answered);
}

.qcell.flagged {
  border-color: var(--accent-flag-border);
  background-color: var(--accent-flag-bg);
  color: var(--accent-flag);
  position: relative;
}

.qcell.flagged::after {
  content: "•";
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 12px;
  color: var(--accent-flag);
}

.qcell:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* KRAEPELIN */
.kr-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 20px;
}

.kr-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.kr-column-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 260px;
  margin: 0 auto;
  gap: 8px;
}

.kr-pair {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 22px;
  font-weight: 700;
}

.kr-input {
  width: 50px;
  height: 50px;
  font-size: 24px;
  text-align: center;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-card);
  color: var(--text-main);
}

.kr-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* MEMORY WORD GRID */
.me-memorize-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.me-notice {
  text-align: center;
  margin-bottom: 20px;
}

.me-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.me-cat-card {
  background-color: var(--bg-subtle);
  border-radius: 6px;
  padding: 16px;
  border-top: 3px solid var(--primary);
}

.me-cat-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--primary);
}

.me-word-list {
  list-style: none;
  font-size: 15px;
  line-height: 1.8;
}

.me-word-list li {
  padding: 2px 0;
}

.me-word-list strong {
  color: var(--primary);
  font-size: 17px;
}

/* DISC */
.disc-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
}

.disc-table th, .disc-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-color);
}

.disc-table th {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.disc-radio-col {
  width: 90px;
  text-align: center;
}

.disc-radio-col input {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* PAPI */
.papi-options-box {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.papi-choice-card {
  padding: 18px 24px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  background-color: var(--bg-card);
  transition: all 0.15s;
  font-size: 18px;
}

.papi-choice-card:hover {
  border-color: var(--primary);
}

.papi-choice-card.selected {
  border-color: var(--primary);
  background-color: var(--accent-current-bg);
  font-weight: 600;
}

/* TAMPILAN HASIL */
.results-header-card {
  text-align: center;
}

.results-subtext {
  color: var(--text-muted);
  margin-top: 6px;
}

.results-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 18px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
}

.stat-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  background-color: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.results-table th, .results-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.results-table th {
  background-color: var(--bg-subtle);
  font-size: 13px;
  font-weight: 700;
}

.priority-banner {
  background-color: var(--bg-card);
  border-left: 5px solid var(--warn-border);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.priority-banner h3 {
  font-size: 16px;
  color: var(--warn-text);
  margin-bottom: 6px;
}

.review-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 12px;
}

.review-q {
  font-weight: 600;
  margin-bottom: 8px;
}

.review-ans {
  font-size: 14px;
  margin-bottom: 4px;
}

.review-exp {
  font-size: 13px;
  color: var(--text-muted);
  background-color: var(--bg-subtle);
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 8px;
}

.chart-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}

.chart-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* Footer Platform */
.app-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  border-top: 1px solid var(--border-color);
}

.footer-disclaimer {
  font-size: 13px;
  color: var(--text-muted);
}
