/* ============================================================
   Matematika SMA — components.css (NEO-BRUTALISM)
   Tombol, badge, panel simulasi, slider, kalkulator, tabel,
   profil, dan form feedback email.
   ============================================================ */

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font: inherit;
  font-weight: 900;
  font-size: 0.96rem;
  letter-spacing: 0.2px;
  padding: 11px 22px;
  border-radius: 12px;
  border: var(--bw) solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.13s, box-shadow 0.13s, background 0.13s, color 0.13s;
  line-height: 1.2;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); text-decoration: none; }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: 2px 2px 0 var(--ink); transform: none; }

.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }

.btn-accent { background: var(--yellow); color: var(--ink); }
.btn-accent:hover { background: #f7c948; }

.btn-secondary { background: var(--paper); color: var(--ink); }
.btn-secondary:hover { background: var(--sky-soft); }

.btn-ghost { background: transparent; color: var(--ink); border-width: 2.5px; box-shadow: none; }
.btn-ghost:hover { background: var(--sky-soft); box-shadow: none; transform: none; }
.btn-ghost:active { transform: scale(0.97); }

.btn-success { background: var(--green); color: var(--ink); }
.btn-success:hover { background: #2fb968; }

.btn-sm { padding: 7px 15px; font-size: 0.85rem; border-radius: 10px; }
.btn-lg { padding: 15px 30px; font-size: 1.04rem; }
.btn-block { width: 100%; }

/* ---------- Badge & chip ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 900;
  padding: 4px 13px;
  border-radius: 999px;
  letter-spacing: 0.4px;
  border: 2.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  text-transform: uppercase;
}
.badge-indigo { background: var(--sky-soft); color: var(--navy); }
.badge-green { background: var(--green-soft); color: #0b7a44; }
.badge-amber { background: var(--yellow-soft); color: #8a6d00; }
.badge-gray { background: var(--bg); color: var(--gray); }
.badge-pink { background: var(--pink-soft); color: #9d174d; }

/* ---------- Panel Simulasi ---------- */
.sim-panel {
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 18px 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.sim-canvas-wrap { position: relative; background: #fff; }
.sim-canvas-wrap canvas { width: 100%; height: 340px; touch-action: none; }
.sim-canvas-wrap.scene canvas { height: 260px; }
.sim-note {
  position: absolute;
  top: 10px; left: 10px;
  background: var(--navy);
  color: #dbeafe;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 13px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  pointer-events: none;
}
.sim-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  padding: 14px 16px;
  border-top: var(--bw) solid var(--ink);
  background: var(--sky-soft);
  align-items: flex-end;
}
.sim-control { min-width: 150px; flex: 1; }
.sim-control label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 900;
  color: var(--ink);
  margin-bottom: 5px;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sim-control label .val {
  color: var(--ink);
  font-family: var(--mono);
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 0 8px;
}
.sim-control select, .sim-control input[type="number"] {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 8px 10px;
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  background: #fff;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 8px;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 7px;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}
.sim-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  border-top: var(--bw) solid var(--ink);
  background: var(--paper);
}
.readout-chip {
  background: var(--navy);
  color: #dbeafe;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  box-shadow: 2.5px 2.5px 0 var(--ink);
  padding: 8px 14px;
  font-size: 0.86rem;
  line-height: 1.45;
  font-weight: 600;
}
.readout-chip b { color: var(--yellow); font-family: var(--mono); }
.readout-chip.good { background: var(--green); color: var(--ink); }
.readout-chip.good b { color: var(--ink); }
.readout-chip.warn { background: var(--yellow); color: var(--ink); }
.readout-chip.warn b { color: var(--ink); }
.sim-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.sim-hint {
  padding: 10px 16px 14px;
  font-size: 0.85rem;
  color: var(--gray);
  font-weight: 600;
}

/* ---------- Kartu pertanyaan pemantik ---------- */
.prompt-question {
  font-size: 1.24rem;
  font-weight: 900;
  color: var(--ink);
  line-height: 1.55;
  margin: 6px 0 18px;
  background: var(--pink-soft);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  transform: rotate(-0.4deg);
}
textarea.notes {
  width: 100%;
  min-height: 120px;
  font: inherit;
  font-weight: 600;
  padding: 14px 16px;
  border: 2.5px dashed var(--ink);
  border-radius: var(--radius-sm);
  background: var(--sky-soft);
  resize: vertical;
  color: var(--ink);
}
textarea.notes:focus { outline: 3px solid var(--yellow); border-style: solid; }
.hint-reveal {
  margin-top: 18px;
  border: var(--bw) solid var(--ink);
  border-left: 8px solid var(--green);
  background: var(--green-soft);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  display: none;
}
.hint-reveal.show { display: block; animation: fadeUp 0.3s ease; }
.hint-reveal h4 { color: #0b7a44; font-size: 0.95rem; margin-bottom: 6px; }
.hint-reveal p { font-size: 0.95rem; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; margin: 12px 0; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: #fff;
  border: var(--bw) solid var(--ink);
}
table.data th, table.data td {
  border: 2px solid var(--ink);
  padding: 9px 13px;
  text-align: left;
}
table.data th { background: var(--sky); color: var(--ink); font-weight: 900; }
table.data tr:nth-child(even) td { background: var(--sky-soft); }

/* ---------- Profil ---------- */
.profile-head {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}
.profile-avatar {
  width: 76px; height: 76px;
  border-radius: 18px;
  border: var(--bw) solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
  font-family: var(--font-display);
  box-shadow: var(--shadow-sm);
  transform: rotate(-3deg);
}
.profile-head input[type="text"] {
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 9px 14px;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  width: min(280px, 100%);
}
.profile-head input[type="text"]:focus { outline: 3px solid var(--yellow); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 30px; }
.stat-block {
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-block:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.stat-block .sb-ico {
  display: inline-grid;
  place-items: center;
  width: 46px; height: 46px;
  border-radius: 12px;
  border: var(--bw) solid var(--ink);
  box-shadow: 2.5px 2.5px 0 var(--ink);
  background: var(--sky);
  margin-bottom: 8px;
  transform: rotate(-3deg);
}
.stat-block:nth-child(2) .sb-ico { background: var(--yellow); }
.stat-block:nth-child(3) .sb-ico { background: var(--pink-soft); }
.stat-block:nth-child(4) .sb-ico { background: var(--green-soft); }
.stat-block .sb-value { font-size: 1.7rem; font-weight: 900; font-family: var(--font-display); color: var(--navy); margin: 4px 0 2px; }
.stat-block .sb-label { font-size: 0.72rem; color: var(--gray); font-weight: 900; letter-spacing: 0.5px; }

.rec-list { display: grid; gap: 12px; }
.rec-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  text-decoration: none !important;
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s, box-shadow 0.14s;
}
.rec-item:hover { transform: translate(3px, -2px); box-shadow: var(--shadow); text-decoration: none; }
.rec-item .rec-ico {
  width: 44px; height: 44px;
  min-width: 44px;
  border-radius: 11px;
  border: var(--bw) solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  font-weight: 900;
}
.rec-item.k10 .rec-ico { background: var(--k10-soft); }
.rec-item.k11 .rec-ico { background: var(--k11-soft); }
.rec-item.k12 .rec-ico { background: var(--k12-soft); }
.rec-item .rec-title { font-weight: 900; color: var(--ink); font-size: 0.95rem; }
.rec-item .rec-sub { font-size: 0.8rem; color: var(--gray); font-weight: 600; }
.rec-item .rec-go { margin-left: auto; color: var(--blue-dark); font-weight: 900; display: inline-flex; align-items: center; gap: 5px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray);
  font-weight: 600;
  border: 2.5px dashed var(--ink);
  border-radius: var(--radius);
  background: var(--paper);
}
.empty-state .es-ico { font-size: 2.4rem; margin-bottom: 10px; }

/* ---------- Form feedback email ---------- */
.feedback-card {
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin-bottom: 44px;
}
.feedback-card h2 { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin-bottom: 6px; }
.feedback-card .fb-head-ico {
  display: inline-grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--pink-soft);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow-sm);
  transform: rotate(-3deg);
}
.feedback-card .fb-sub { color: var(--gray); font-weight: 600; margin-bottom: 18px; font-size: 0.94rem; }
.feedback-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.feedback-field { display: flex; flex-direction: column; gap: 6px; }
.feedback-field.full { grid-column: 1 / -1; }
.feedback-field label { font-size: 0.76rem; font-weight: 900; letter-spacing: 0.5px; text-transform: uppercase; }
.feedback-field input, .feedback-field select, .feedback-field textarea {
  font: inherit;
  font-weight: 600;
  padding: 10px 13px;
  border: 2.5px solid var(--ink);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.feedback-field textarea { min-height: 110px; resize: vertical; }
.feedback-field input:focus, .feedback-field select:focus, .feedback-field textarea:focus {
  outline: 3px solid var(--yellow);
}
.fb-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.fb-note { font-size: 0.8rem; color: var(--gray); font-weight: 600; }
@media (max-width: 640px) { .feedback-grid { grid-template-columns: 1fr; } }

/* ---------- Kalkulator floating ---------- */
.calc-fab {
  position: fixed;
  right: 18px; bottom: 18px;
  width: 58px; height: 58px;
  border-radius: 16px;
  border: var(--bw) solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 90;
  transition: transform 0.14s, box-shadow 0.14s;
}
.calc-fab:hover { transform: translate(-2px, -2px) rotate(-4deg); box-shadow: 6px 6px 0 var(--ink); }
.calc-fab:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.calc-fab:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.calc-panel {
  position: fixed;
  right: 18px; bottom: 88px;
  width: min(302px, calc(100vw - 36px));
  background: var(--paper);
  border: var(--bw) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 95;
  display: none;
  overflow: hidden;
}
.calc-panel.open { display: block; animation: fadeUp 0.2s ease; }
.calc-display {
  background: var(--navy);
  color: #dbeafe;
  padding: 14px;
  text-align: right;
  font-family: var(--mono);
  word-break: break-all;
  border-bottom: var(--bw) solid var(--ink);
}
.calc-display .cd-expr { font-size: 0.78rem; color: #93c5fd; min-height: 1.2em; }
.calc-display .cd-val { font-size: 1.45rem; font-weight: 700; min-height: 1.5em; color: var(--yellow); }
.calc-modes {
  display: flex;
  gap: 6px;
  padding: 10px 10px 0;
}
.calc-mode {
  font: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 4px 14px;
  border-radius: 8px;
  border: 2.5px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.calc-mode.active { background: var(--navy); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.calc-keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  padding: 10px;
}
.calc-keys button {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  padding: 10px 0;
  border: 2.5px solid var(--ink);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
}
.calc-keys button:hover { background: var(--sky-soft); }
.calc-keys button:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--ink); }
.calc-keys button.op { background: var(--sky); color: var(--ink); }
.calc-keys button.fn { background: var(--pink-soft); color: #9d174d; font-size: 0.8rem; }
.calc-keys button.eq { background: var(--blue); color: #fff; }
.calc-keys button.clr { background: var(--red-soft); color: #b91c1c; }

/* ---------- Kartu skor ringkas di profil ---------- */
.history-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.history-bar .hb-name { width: 230px; min-width: 150px; font-size: 0.9rem; font-weight: 800; }
.history-bar .progress { flex: 1; }
.history-bar .hb-score {
  width: 86px;
  text-align: right;
  font-weight: 900;
  font-size: 0.9rem;
  font-family: var(--font-display);
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .history-bar .hb-name { width: 128px; font-size: 0.78rem; }
  .sim-canvas-wrap canvas { height: 270px; }
}
