/* =========================================================
  AtomLab Interaktif - base.css
  ---------------------------------------------------------
  File ini berisi fondasi desain global:
  - CSS variables / design tokens
  - reset dasar
  - typography
  - button dasar
  - utility class dasar
  - accessibility helpers
========================================================= */

:root {
  /* ---------- Color System ---------- */
  --color-white: #ffffff;
  --color-black: #020617;

  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  --color-slate-950: #020617;

  --color-blue-50: #eff6ff;
  --color-blue-100: #dbeafe;
  --color-blue-200: #bfdbfe;
  --color-blue-300: #93c5fd;
  --color-blue-400: #60a5fa;
  --color-blue-500: #3b82f6;
  --color-blue-600: #2563eb;
  --color-blue-700: #1d4ed8;
  --color-blue-800: #1e40af;
  --color-blue-900: #1e3a8a;

  --color-green-50: #f0fdf4;
  --color-green-100: #dcfce7;
  --color-green-500: #22c55e;
  --color-green-600: #16a34a;
  --color-green-700: #15803d;

  --color-yellow-50: #fefce8;
  --color-yellow-100: #fef9c3;
  --color-yellow-300: #fde047;
  --color-yellow-400: #facc15;
  --color-yellow-500: #eab308;

  --color-orange-50: #fff7ed;
  --color-orange-100: #ffedd5;
  --color-orange-500: #f97316;
  --color-orange-600: #ea580c;
  --color-orange-700: #c2410c;

  --color-red-50: #fef2f2;
  --color-red-100: #fee2e2;
  --color-red-500: #ef4444;
  --color-red-600: #dc2626;
  --color-red-700: #b91c1c;

  --color-purple-50: #faf5ff;
  --color-purple-100: #f3e8ff;
  --color-purple-300: #d8b4fe;
  --color-purple-500: #a855f7;
  --color-purple-600: #9333ea;

  /* ---------- Semantic Colors ---------- */
  --app-bg: #eef4ff;
  --app-bg-soft: #fffde7;
  --text-main: var(--color-slate-950);
  --text-muted: var(--color-slate-500);
  --text-soft: var(--color-slate-400);

  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: var(--color-white);
  --surface-soft: rgba(255, 255, 255, 0.62);
  --surface-dark: rgba(2, 6, 23, 0.86);

  --border-soft: rgba(15, 23, 42, 0.12);
  --border-medium: rgba(15, 23, 42, 0.22);
  --border-strong: rgba(15, 23, 42, 0.72);

  --primary: var(--color-blue-600);
  --primary-hover: var(--color-blue-700);
  --primary-soft: var(--color-blue-100);

  --success: var(--color-green-600);
  --success-soft: var(--color-green-100);

  --warning: var(--color-yellow-400);
  --warning-soft: var(--color-yellow-100);

  --danger: var(--color-red-600);
  --danger-soft: var(--color-red-100);

  --accent-orange: var(--color-orange-600);
  --accent-purple: var(--color-purple-600);

  /* ---------- Particle Colors ---------- */
  --proton-color: var(--color-orange-500);
  --proton-dark: var(--color-orange-700);
  --neutron-color: #4b5563;
  --neutron-dark: #111827;
  --electron-color: var(--color-blue-700);
  --electron-dark: var(--color-blue-900);

  /* ---------- Gradients ---------- */
  --gradient-page:
    radial-gradient(circle at 10% 10%, rgba(96, 165, 250, 0.24), transparent 30%),
    radial-gradient(circle at 90% 0%, rgba(250, 204, 21, 0.22), transparent 30%),
    linear-gradient(135deg, #edf5ff 0%, #fffdf0 100%);

  --gradient-dark:
    radial-gradient(circle at 12% 6%, rgba(37, 99, 235, 0.38), transparent 30%),
    radial-gradient(circle at 88% 86%, rgba(250, 204, 21, 0.22), transparent 34%),
    linear-gradient(135deg, #020617 0%, #111827 100%);

  --gradient-primary: linear-gradient(135deg, var(--color-blue-600), #38bdf8);
  --gradient-success: linear-gradient(135deg, #10b981, var(--color-green-500));
  --gradient-warning: linear-gradient(135deg, var(--color-orange-500), #f59e0b);
  --gradient-danger: linear-gradient(135deg, var(--color-red-500), var(--color-orange-500));

  /* ---------- Typography ---------- */
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --font-display: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;

  --leading-tight: 1.1;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* ---------- Spacing ---------- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* ---------- Radius ---------- */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 999px;

  /* ---------- Shadows ---------- */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.16);
  --shadow-xl: 0 28px 70px rgba(15, 23, 42, 0.22);

  /* ---------- Motion ---------- */
  --duration-fast: 120ms;
  --duration-normal: 180ms;
  --duration-slow: 260ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* ---------- Layout ---------- */
  --header-height: 72px;
  --container-max: 1560px;
  --side-panel-width: 430px;
  --z-header: 50;
  --z-modal: 100;
  --z-drag: 999;
}

/* =========================================================
  Reset & Global Base
========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-main);
  background: var(--gradient-page);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.is-modal-open {
  overflow: hidden;
}

img,
svg,
canvas,
video {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

button,
[role="button"] {
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
}

input,
textarea,
select {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

dialog {
  padding: 0;
  border: 0;
}

::selection {
  color: var(--color-white);
  background: var(--primary);
}

/* =========================================================
  Typography Helpers
========================================================= */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  letter-spacing: -0.035em;
}

h1 {
  font-size: clamp(var(--text-5xl), 8vw, 6rem);
  font-weight: 900;
}

h2 {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: 850;
}

h3 {
  font-size: var(--text-xl);
  font-weight: 850;
}

p {
  color: var(--text-muted);
}

strong,
b {
  font-weight: 850;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  color: var(--color-blue-100);
  font-size: var(--text-sm);
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.section-description {
  max-width: 68ch;
  color: var(--text-muted);
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
}

/* =========================================================
  Buttons
========================================================= */

.btn,
.icon-button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 42px;
  border-radius: var(--radius-lg);
  padding: 0.65rem 1rem;
  color: var(--text-main);
  background: var(--color-slate-100);
  box-shadow: var(--shadow-sm);
  font-weight: 850;
  text-align: center;
  white-space: nowrap;
  user-select: none;
  transition:
    transform var(--duration-fast) var(--ease-out),
    filter var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out);
}

.btn:hover,
.icon-button:hover,
.small-button:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
  box-shadow: var(--shadow-md);
}

.btn:active,
.icon-button:active,
.small-button:active {
  transform: translateY(0);
}

.btn-primary,
.btn.btn-primary {
  color: var(--color-white);
  background: var(--gradient-primary);
}

.btn-success,
.btn.btn-success {
  color: var(--color-white);
  background: var(--gradient-success);
}

.btn-warning,
.btn.btn-warning {
  color: var(--color-white);
  background: var(--gradient-warning);
}

.btn-danger,
.btn.btn-danger {
  color: var(--color-white);
  background: var(--gradient-danger);
}

.btn-outline,
.btn.btn-outline {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-soft);
  box-shadow: none;
}

.icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-full);
}

.small-button {
  width: 40px;
  min-width: 40px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: var(--text-xl);
}

/* =========================================================
  Form Base
========================================================= */

input[type="number"],
input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-xs);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out),
    background-color var(--duration-fast) var(--ease-out);
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
  background: var(--color-white);
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

label {
  cursor: pointer;
}

/* Remove number input spinner where possible, custom controls can be added in symbol.css */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
}

/* =========================================================
  Shared Surfaces & Utilities
========================================================= */

.glass-surface {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

.solid-surface {
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
}

.hidden,
[hidden] {
  display: none !important;
}

.is-invisible {
  visibility: hidden !important;
}

.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--accent-orange);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================================================
  Focus Style
========================================================= */

:focus-visible {
  outline: 4px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

button:focus-visible,
[role="button"]:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 4px solid rgba(37, 99, 235, 0.35);
  outline-offset: 3px;
}

/* =========================================================
  Scrollbar
========================================================= */

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.06);
}

::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.35);
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.55);
}

/* =========================================================
  Reduced Motion Support
========================================================= */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
  Print Base
========================================================= */

@media print {
  body {
    color: #000;
    background: #fff;
  }

  .app-header,
  .particle-tray-row,
  .header-actions,
  .main-tabs,
  .btn,
  .icon-button,
  .small-button {
    display: none !important;
  }

  .glass-surface,
  .solid-surface {
    box-shadow: none;
    border-color: #999;
  }
}
