/* ============================================
   Nombor4D Pro — Mobile-First PWA Styles
   Tema: Bertanggungjawab, jelas, mudah dibaca
   ============================================ */

:root {
  /* Light theme */
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-elevated: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --primary: #ef4444;
  --primary-dark: #dc2626;
  --primary-light: #fee2e2;
  --secondary: #3b82f6;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #b91c1c;
  --success: #10b981;
  --success-light: #d1fae5;
  --info: #06b6d4;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bottom: env(safe-area-inset-bottom, 0);
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-elevated: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --primary: #f87171;
  --primary-dark: #ef4444;
  --primary-light: #7f1d1d;
  --warning: #fbbf24;
  --warning-light: #78350f;
  --success: #34d399;
  --success-light: #064e3b;
  --info: #22d3ee;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

/* Reset */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  padding-bottom: calc(80px + var(--safe-bottom));
  padding-top: calc(56px + var(--safe-top));
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; /* iOS no-zoom */ }

a { color: var(--secondary); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--font-mono); background: var(--bg-elevated); padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

/* Utility */
.hidden { display: none !important; }
.warning-text { color: var(--warning); font-weight: 500; }
.btn-full { width: 100%; }

/* ============================================
   AGE GATE
   ============================================ */
.age-gate {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.age-gate-box {
  background: var(--bg-card);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.age-gate-box .logo { font-size: 2em; margin-bottom: var(--space-3); }
.age-gate-box h1 { font-size: 1.5em; margin-bottom: var(--space-3); }
.age-gate-error { color: var(--danger); margin-top: var(--space-3); min-height: 1.2em; }
.age-gate-disclaimer { margin-top: var(--space-4); color: var(--text-muted); font-size: 0.85em; }

/* ============================================
   HEADER
   ============================================ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  box-shadow: var(--shadow);
  padding-top: var(--safe-top);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 56px;
  padding: 0 var(--space-4);
}
.header-left, .header-right { display: flex; align-items: center; gap: var(--space-2); }
.logo-mini { font-size: 1.5em; }
.app-title { font-weight: 700; font-size: 1.1em; }
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text);
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--border); }
.header-warning {
  background: var(--primary-light);
  color: var(--primary-dark);
  text-align: center;
  padding: var(--space-1) var(--space-4);
  font-size: 0.85em;
}
[data-theme="dark"] .header-warning { color: var(--primary); }

/* ============================================
   MAIN CONTENT
   ============================================ */
.app-main {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-4);
}
.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.tab-content h2 { font-size: 1.5em; margin-bottom: var(--space-2); }
.tab-desc { color: var(--text-muted); margin-bottom: var(--space-4); font-size: 0.95em; }

/* ============================================
   FORMS
   ============================================ */
.form-group { margin-bottom: var(--space-4); }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
  font-size: 0.95em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--space-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); }
.form-group .hint { display: block; color: var(--text-muted); font-size: 0.85em; margin-top: var(--space-1); }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1em;
  transition: transform 0.1s, background 0.2s, box-shadow 0.2s;
  text-align: center;
  min-height: 44px; /* Touch target */
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-elevated); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #d97706; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #991b1b; }

/* ============================================
   RESULTS AREA
   ============================================ */
.results-area { margin-top: var(--space-5); }
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow);
}
.result-card h3 { font-size: 1.1em; margin-bottom: var(--space-2); color: var(--primary); }
.result-card h4 { font-size: 1em; margin: var(--space-3) 0 var(--space-2); }
.result-card p { margin-bottom: var(--space-2); font-size: 0.95em; }
.result-card .number-display {
  font-family: var(--font-mono);
  font-size: 1.5em;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 2px;
  background: var(--bg-elevated);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  text-align: center;
  margin: var(--space-2) 0;
}
.result-card .numbers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.result-card .number-item {
  font-family: var(--font-mono);
  font-size: 1.1em;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  text-align: center;
}
[data-theme="dark"] .result-card .number-item { color: var(--primary); }

.result-card .stat-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95em;
}
.result-card .stat-row:last-child { border-bottom: none; }
.result-card .stat-label { color: var(--text-muted); }
.result-card .stat-value { font-weight: 600; }

.result-card .disclaimer {
  background: var(--warning-light);
  color: var(--warning);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  margin-top: var(--space-3);
}
[data-theme="dark"] .result-card .disclaimer { color: var(--warning); }

.result-card .warning-banner {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  margin-top: var(--space-3);
  border-left: 4px solid var(--primary);
}

.digit-heatmap {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--space-1);
  margin-top: var(--space-2);
}
.digit-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95em;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  position: relative;
}
.digit-cell .freq {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.6em;
  font-weight: 500;
  color: var(--text-muted);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s;
}
.modal-box {
  background: var(--bg-card);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-box h2 { font-size: 1.3em; margin-bottom: var(--space-3); }
.modal-box p { margin-bottom: var(--space-3); }
.modal-buttons { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.modal-buttons .btn { flex: 1; }

.mood-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: var(--space-2); }
.mood-btn {
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.2s;
  min-height: 44px;
}
.mood-btn.selected { background: var(--primary); color: white; }

/* ============================================
   BOTTOM NAV
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  z-index: 100;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  padding-bottom: var(--safe-bottom);
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-2) 0;
  color: var(--text-muted);
  transition: color 0.2s;
  min-height: 56px;
}
.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 1.4em; }
.nav-label { font-size: 0.7em; font-weight: 500; }

/* ============================================
   RESPONSIBLE GAMBLING SECTIONS
   ============================================ */
.responsible-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.responsible-section h3 { font-size: 1.1em; margin-bottom: var(--space-3); }
.befrienders {
  background: var(--warning-light);
  border-color: var(--warning);
}
.befrienders h3 { color: var(--warning); }
.limit-status {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}
.limit-status.ok { background: var(--success-light); color: var(--success); }
.limit-status.warning { background: var(--warning-light); color: var(--warning); }
.limit-status.danger { background: var(--primary-light); color: var(--primary-dark); }

/* ============================================
   EDUCATION CARDS
   ============================================ */
.edu-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--secondary);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}
.edu-card h3 { font-size: 1.05em; margin-bottom: var(--space-2); color: var(--secondary); }
.edu-card p { font-size: 0.95em; margin-bottom: var(--space-2); }
.edu-card p:last-child { margin-bottom: 0; }

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--space-4);
  text-align: center;
  font-size: 0.85em;
  color: var(--text-muted);
  margin-top: var(--space-8);
}
.app-footer p { margin-bottom: var(--space-2); }
.app-footer .version { color: var(--text-light); font-size: 0.8em; margin-top: var(--space-2); }

/* ============================================
   COOLING OFF OVERLAY
   ============================================ */
.cooling-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  text-align: center;
}
.cooling-overlay h1 { font-size: 2em; margin-bottom: var(--space-3); }
.cooling-overlay p { font-size: 1.1em; margin-bottom: var(--space-4); }
.cooling-overlay .timer { font-size: 2.5em; font-weight: 700; color: var(--primary); margin: var(--space-4) 0; font-family: var(--font-mono); }

/* ============================================
   ANALITIS TAB — Data-Driven Analysis
   ============================================ */
.analysis-meta {
  margin: var(--space-3) 0;
}
.analysis-meta-box {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-3);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  color: var(--text-muted);
}

.candidates-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-3) 0;
}
.candidates-table,
.position-table,
.digit-table,
.trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  font-family: var(--font-mono);
}
.candidates-table th,
.candidates-table td,
.position-table th,
.position-table td,
.digit-table th,
.digit-table td,
.trend-table th,
.trend-table td {
  padding: 6px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.candidates-table th,
.position-table th,
.digit-table th,
.trend-table th {
  background: var(--bg-elevated);
  font-weight: 600;
  position: sticky;
  top: 0;
}
.candidates-table .num-cell {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--primary);
}
.candidates-table tr.sig {
  background: var(--success-light);
}
[data-theme="dark"] .candidates-table tr.sig {
  background: rgba(16, 185, 129, 0.15);
}
.position-table .pos-cell {
  font-weight: 600;
}
.trend-table tr.trend-up {
  background: var(--primary-light);
}
.trend-table tr.trend-down {
  background: rgba(59, 130, 246, 0.15);
}
[data-theme="dark"] .trend-table tr.trend-up {
  background: rgba(239, 68, 68, 0.15);
}

/* Compact bottom nav for 7 items */
@media (max-width: 480px) {
  .bottom-nav .nav-btn .nav-label {
    font-size: 0.7em;
  }
  .bottom-nav .nav-btn .nav-icon {
    font-size: 1.1em;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (min-width: 640px) {
  .app-main { padding: var(--space-6); }
  .result-card { padding: var(--space-5); }
  .header-warning { font-size: 0.9em; }
}

@media (min-width: 1024px) {
  body { padding-bottom: 0; padding-top: 0; }
  .app-header { position: sticky; }
  .bottom-nav { display: none; }
  body { padding-top: 0; }
  .app-main { display: grid; grid-template-columns: 1fr; max-width: 900px; }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   NUMEROLOGY FORMULA CARDS
   ============================================ */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.formula-card {
  background: var(--bg-elevated, var(--bg-card));
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.formula-card .formula-name {
  font-size: 0.75em;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.formula-card .formula-value {
  font-family: var(--font-mono);
  font-size: 1.2em;
  font-weight: 700;
  color: var(--primary);
}
.formula-card .formula-desc {
  font-size: 0.8em;
  color: var(--text-muted);
}

/* ============================================
   CUSTOM PICKER
   ============================================ */
.custom-digit-select {
  width: 100%;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
}/* Deploy v2 */
/* 5-nav-fix */
