/* ======================================================
   GEODip – styles.css
   Ukur Jurus (Strike) & Miring (Dip)
   Selamat (CSP-compliant) | Lapangan Geologi | JMG Style
   ====================================================== */

/* ---------- ROOT & RESET ---------- */
:root {
  --bg-main: #020617;
  --bg-card: rgba(15, 23, 42, 0.72);
  --bg-metric: rgba(2, 6, 23, 0.65);

  --border-soft: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-accent: #38bdf8;
  --text-warn: #fbbf24;
  --text-ok: #34d399;
  --text-err: #fb7185;

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

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

html {
  height: 100%;
  background-color: var(--bg-main);
}

body {
  margin: 0;
  min-height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- LAYOUT ---------- */
.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 20px 16px 28px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

/* ---------- HEADINGS & TEXT ---------- */
h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.muted {
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 520px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- METRIC CARD ---------- */
.metric {
  padding: 14px 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-metric);
  border: 1px solid var(--border-soft);
}

.metric .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.metric .value {
  margin-top: 6px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric .muted {
  margin-top: 2px;
}

/* ---------- BUTTONS & INPUTS ---------- */
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  align-items: center;
}



button:hover {
  background-color: #13203c;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

input[type="number"] {
  width: 130px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background-color: #0b1224;
  color: var(--text-main);
  font-size: 0.85rem;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--text-accent);
}

/* ---------- STATUS / INFO ---------- */
.warn {
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-warn);
}

.ok {
  color: var(--text-ok);
  font-weight: 600;
}

.err {
  color: var(--text-err);
  font-weight: 600;
}

/* ---------- FOOTER / DISCLAIMER ---------- */
.footer {
  margin-top: 16px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ---------- CODE INLINE ---------- */
code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 0.75rem;
  color: var(--text-accent);
}

/* ---------- FIELD MODE (OPTIONAL) ---------- */
/* Aktifkan dengan tambah class "field" pada body */
body.field {
  --bg-card: rgba(0, 0, 0, 0.85);
  --bg-metric: rgba(0, 0, 0, 0.9);
  --text-main: #ffffff;
  --text-muted: #cbd5f5;
}

/* ================= Brunton Compass ================= */

.compassHeader{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.compassTitle{
  font-weight:800;
  font-size:0.98rem;
  letter-spacing:0.2px;
}

.compassToggle{
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
}

.compassWrap{
  display:flex;
  justify-content:center;
  align-items:center;
  padding: 8px 0 4px;
}

.compassSvg{
  width: min(92vw, 420px);
  height: auto;
  display:block;
}

/* SVG theme */
.ringOuter{
  fill: rgba(255,255,255,.03);
  stroke: rgba(255,255,255,.18);
  stroke-width: 2;
}

.ringInner{
  fill: rgba(255,255,255,.06);
  stroke: rgba(255,255,255,.12);
  stroke-width: 1.5;
}


.tickMinor{ stroke: rgba(255,255,255,.14); stroke-width: 1; }
.tickMajor{ stroke: rgba(255,255,255,.28); stroke-width: 2; }
.tickLabel{ fill: rgba(255,255,255,.65); font-size: 10px; font-weight: 700; letter-spacing: 0.2px; }

.cardinal{ fill: rgba(255,255,255,.92); font-size: 16px; font-weight: 900; }
.degLabel{ fill: rgba(255,255,255,.55); font-size: 10px; font-weight: 700; }

.centerDot{ fill: rgba(255,255,255,.9); }

.strikeLine{
  stroke: rgba(255,255,255,.9);
  stroke-width: 3;
  stroke-linecap: round;
}
.strikeCap{ stroke: rgba(255,255,255,.55); stroke-width: 4; stroke-linecap: round; }

.dipShaft{ stroke: rgba(248,113,113,.95); stroke-width: 3.2; stroke-linecap: round; }
.dipHead{ fill: rgba(248,113,113,.95); }

.readout{ fill: rgba(255,255,255,.92); font-size: 14px; font-weight: 900; letter-spacing: 0.2px; }
.readoutSub{ fill: rgba(255,255,255,.6); font-size: 11px; font-weight: 800; letter-spacing: 0.3px; }


.compassCard{
  margin-top:14px;
  padding: 12px 10px 6px;
  border-top: 1px dashed rgba(255,255,255,.12);
}

.compassSvg{
  background: radial-gradient(circle at center,
    rgba(255,255,255,.06) 0%,
    rgba(255,255,255,.02) 45%,
    rgba(0,0,0,0) 70%);
  border-radius: 50%;
}

@media (orientation: portrait) {
  .compassSvg { max-width: 92vw; }
}
.compassSvg {
  transition: transform 0.25s ease-out;
  transform-origin: 50% 50%;
}

#aiResult {
  white-space: pre-line;
  line-height: 1.5;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}

/* Grid dua lajur khas untuk info sokongan */
.grid-compact {
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}
.metric-small .muted { font-size: .75rem; }

button.secondary {
  opacity: .7;
}

#slopeResult {
  font-size: .85rem;
  border-left: 3px solid #f97316;
  padding-left: .6rem;
}

.metric-wide {
  padding: 1.2rem;
  border-radius: 16px;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.06),
    rgba(255,255,255,.02)
  );
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}

.value.big {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: .00em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;

  white-space: nowrap;
  word-spacing: .15em;
}

.value.big .dir {
  font-size: 1.2rem;
  opacity: .85;
  margin-left: .3rem;
}

.metric-small {
  padding: .6rem .7rem;
  border-radius: 12px;
  background: rgba(255,255,255,.03);
}

.metric-small .value {
  font-size: .95rem;
  font-weight: 500;
}

.metric-small .label {
  letter-spacing: .08em;
  font-size: .65rem;
}

button {
  border-radius: 14px;
  
  appearance: none;
  border: 1px solid var(--border-strong);
  background-color: #0f172a;
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease,
              transform 0.05s ease;
}

#btnStart {
  background: #2563eb;
}

#btnHold {
  background: #0f172a;
  border: 1px solid rgba(255,255,255,.2);
}



#btnAdd {
  background: #16a34a;
    box-shadow: 0 0 0 2px rgba(22,163,74,.25);
}

.hint {
  font-size: .7rem;
  opacity: .6;
  margin-top: .25rem;
}

#toggleSlope:checked ~ #slopeResult {
  background: rgba(249,115,22,.08);
  border-left: 3px solid #f97316;
  padding: .6rem;
  border-radius: 8px;
}

.simpleSymbolCard {
  background: radial-gradient(
    circle at center,
    rgba(255,255,255,.05),
    rgba(0,0,0,.2)
  );
  border-radius: 16px;
}

#slopeResult.active {
  background: rgba(249,115,22,.08);
}

@media (min-width: 900px) {
  .grid-compact {
    max-width: 80%;
  }
}


#btnReset:active {
  background: #7f1d1d;
}

.metric-small .value.ok {
  color: #34d399; /* hijau bila GPS padu */
}

.analysis-block {
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: 12px;
}

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.header-left h1 {
  margin: 0;
}

.header-right {
  flex-shrink: 0;
}

/* ===== BUTANG MULA ===== */
.btn-start {
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  cursor: pointer;
}

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

/* ===== ROW TAMBAH BACAAAN ===== */
.row-add {
  margin-top: 0.75rem;
}

/* ===== BUTANG TAMBAH BESAR ===== */
.btn-add-big {
  width: 100%;
  padding: 0.9rem 1rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 0.9rem;

  background: linear-gradient(135deg, #16a34a, #15803d);
  color: white;
  border: none;

  cursor: pointer;
}

.btn-add-big:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.row-add {
  margin-bottom: 1.2rem; /* ±28px */
}

label.muted {
  margin-top: 0.75rem;
  display: block;
}

/* ================= RECORD LIST (FIELD-GRADE) ================= */

.recordList {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.5rem;

  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.recordList li {
  display: flex;
  align-items: center;
  gap: 0.6rem;

  padding: 0.6rem 0.8rem;
  border-radius: 0.65rem;

  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);

  font-size: 0.95rem;
  color: #e5e7eb;
}

/* nombor bacaan (1., 2., 3.) */
.recordList li::before {
  content: attr(data-index);
  min-width: 1.8rem;
  text-align: right;
  font-weight: 600;
  color: #94a3b8;
}

/* hover ringan */
.recordList li:hover {
  background: rgba(255,255,255,0.07);
}

/* ================= BIG FIELD BUTTONS ================= */

.btn-add-big,
.btn-reset-big {
  width: 100%;
  padding: 0.9rem 1rem;

  font-size: 1.05rem;
  font-weight: 600;
  border-radius: 0.9rem;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;

  border: none;
  cursor: pointer;
}

/* Tambah Bacaan = hijau (confirm action) */
.btn-add-big {
  background: #16a34a;
  color: white;
}

.btn-add-big:disabled {
  background: #14532d;
  opacity: 0.5;
}

/* Baca Semula = biru neutral (reset konteks) */
.btn-reset-big {
  background: #2563eb;
  color: white;
}

.btn-reset-big:disabled {
  background: #1e3a8a;
  opacity: 0.5;
}

/* ===== METRIC UTAMA (JURUS / MIRING) – HIGH VISIBILITY ===== */
.metric-primary {
  background: #ffffff;
  color: #020617; /* teks gelap */
  border: 1px solid rgba(0,0,0,0.15);
  box-shadow:
    0 6px 18px rgba(0,0,0,0.18),
    inset 0 0 0 1px rgba(255,255,255,0.6);
}

/* label kecil */
.metric-primary .label {
  color: #334155;
  font-weight: 700;
}

/* nilai besar (strike / dip) */
.metric-primary .value.big {
  color: #020617;
}

/* teks penerangan bawah */
.metric-primary .muted {
  color: #475569;
}

#map {
  height: 260px;
  width: 100%;
}

/* elak divIcon ada kotak putih / margin */
.strikeIcon {
  background: transparent !important;
  border: none !important;
}

.strikeIcon text {
  paint-order: stroke;
  stroke: #020617;
  stroke-width: 1.5px;
}

.north-arrow {
  padding: 6px;
}

.north-arrow svg {
  transition: transform 0.15s linear;
  transform-origin: 50% 50%;
}

/* ===== ANALISIS CERUN ===== */

.card-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.section-header {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: .5rem;
}

.section-sub {
  font-size: 0.75rem;
  font-weight: 400;
  color: #94a3b8;
  margin-left: .25rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 0.9rem;
  color: #e5e7eb;
  margin-bottom: .5rem;
}

.slope-inputs {
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  padding: .75rem;
  margin-top: .5rem;
}

.input-row {
  margin-bottom: .5rem;
}

.input-row label {
  font-size: 0.75rem;
  color: #cbd5f5;
}

.input-row input {
  width: 100%;
  margin-top: .25rem;
}

.slope-result {
  margin-top: .75rem;
  padding: .6rem .75rem;
  border-radius: 10px;
  font-size: .85rem;
  line-height: 1.4;
  background: rgba(15,23,42,0.6);
  border-left: 4px solid #38bdf8;
}

.slope-result.warn {
  border-left-color: #f97316;
}

.slope-result.ok {
  border-left-color: #22c55e;
}

.hint.subtle {
  font-size: .7rem;
  color: #94a3b8;
  margin-top: .25rem;
}

.ai-card {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(2,6,23,0.55);
  border: 1px solid rgba(255,255,255,0.08);
}

.ai-title {
  font-size: 13px;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 6px;
}

.ai-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ai-list li {
  font-size: 13px;
  padding: 4px 0;
  color: #cbd5f5;
}

.ai-list li.ok { color: #34d399; }
.ai-list li.warn { color: #fbbf24; }
.ai-list li.bad { color: #fb7185; }

.section-divider {
  position: relative;
  margin: 28px 0 18px;
  text-align: center;
}

.section-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    rgba(148,163,184,.4),
    transparent
  );
}

.section-divider span {
  position: relative;
  padding: 0 12px;
  font-size: 12px;
  letter-spacing: .04em;
  color: #94a3b8;
  background: #020617; /* warna bg card */
}

/* khas untuk AI */
.ai-divider span {
  color: #67e8f9;
  font-weight: 600;
}

/* ================= BUTANG ANALISIS AI (BESAR) ================= */
.aiBtn {
  width: 100%;
  min-height: 56px;              /* besar & mudah tekan */
  padding: 14px 18px;
  margin-top: 10px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;

  border-radius: 16px;
  border: 1px solid rgba(103,232,249,.35);

  background: linear-gradient(
    135deg,
    #0ea5e9,
    #38bdf8
  );

  color: #020617;
  box-shadow:
    0 8px 22px rgba(14,165,233,.35),
    inset 0 1px 0 rgba(255,255,255,.35);

  transition: transform .12s ease,
              box-shadow .12s ease,
              filter .12s ease;
}

/* tekan */
.aiBtn:active {
  transform: scale(.98);
  box-shadow:
    0 4px 12px rgba(14,165,233,.25);
}

/* hover (desktop) */
.aiBtn:hover {
  filter: brightness(1.05);
}

/* disabled (jika nanti guna) */
.aiBtn:disabled {
  opacity: .5;
  filter: grayscale(1);
}

/* SECTION CARD BASE */
.section-struct {
  box-shadow: inset 0 0 0 1px rgba(56,189,248,.25);
}

.section-map {
  box-shadow: inset 0 0 0 1px rgba(34,197,94,.25);
}

/* ===== STEREONET CENTERING ===== */
.stereonet-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px 0 20px;
}

/* SVG itu sendiri */
#stereo {
  display: block;
  width: 260px;     /* boleh ubah: 240–280 */
  max-width: 90%;
  height: auto;
}

/* ===== KAD SENARAI BACAAN ===== */
.recordCard {
  background: #ffffff;
  border-radius: 16px;
  padding: 12px 14px;
  margin: 10px 0 18px;
  box-shadow:
    0 10px 25px rgba(0,0,0,.25);
}

/* list asas */
.recordList {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* setiap bacaan */
.recordList li {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #f8fafc;
  color: #020617;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
}

/* nombor automatik (data-index) */
.recordList li::before {
  content: attr(data-index);
  margin-right: 10px;
  color: #64748b;
  font-weight: 500;
}

/* hover ringan */
.recordList li:hover {
  background: #eef2ff;
}