/* Professional minimalist dark theme */
:root {
  --color-background: #f7f8fa; /* page background */
  --color-background-soft: #ffffff; /* card backgrounds */
  --color-background-mute: #f3f4f6; /* subtle surfaces */
  --color-card: #ffffff;
  --color-card-border: #eaecf0;
  --color-border: #e6e9ee;
  --color-border-hover: #d6d9df;
  --color-heading: #0f1724;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-accent: #007aff; /* Apple-like blue */
  --color-accent-hover: #0064d6;
  --color-accent-bg: rgba(0, 122, 255, 0.08);
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, 0.08);
  --spacing-xs: 0.5rem;
  --spacing-sm: 0.75rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.25rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Compatibility aliases used by some components */
  --border: var(--color-border);
  --border-hover: var(--color-border-hover);
  --text-primary: var(--color-heading);
  --text-secondary: var(--color-text-muted);
  --surface: var(--color-card);
  --surface-hover: var(--color-background-mute);
  --surface-secondary: var(--color-background-soft);
  --color-primary: var(--color-accent);
  --color-primary-alpha: var(--color-accent-bg);
  --border-radius: var(--radius-md);
}

/* Icon utilities: consistent sizing, stroke/fill behavior, and spacing */
svg.icon {
  width: var(--icon-size, 18px);
  height: var(--icon-size, 18px);
  display: inline-block;
  vertical-align: middle;
  color: inherit;
}

svg.icon [stroke] {
  stroke: currentColor !important;
  stroke-width: 1.5 !important;
  vector-effect: non-scaling-stroke;
}

svg.icon [fill]:not([fill="none"]) {
  fill: currentColor !important;
}

/* smaller variant */
.icon--sm {
  --icon-size: 14px;
}
.icon--lg {
  --icon-size: 20px;
}

/* spacing when icon appears inside buttons */
.button-secondary svg.icon {
  margin-right: var(--spacing-xs);
}

.reset-btn svg.icon,
.copy-icon.icon {
  margin: 0;
}

/* Dark theme: follow system preference */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #0f1419;
    --color-background-soft: #1a1f26;
    --color-background-mute: #1e242c;
    --color-card: #111214;
    --color-card-border: #121417;
    --color-border: #1f2730;
    --color-border-hover: #2e3440;
    --color-heading: #ffffff;
    --color-text: #d8dee9;
    --color-text-muted: #9ca3af;
    --color-accent: #5e81ac;
    --color-accent-hover: #4c6b91;
    --color-accent-bg: rgba(94, 129, 172, 0.08);
    --color-success: #a3be8c;
    --color-warning: #ebcb8b;
    --color-error: #bf616a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}

/* Manual overrides when user explicitly chooses theme */
.theme-dark {
  --color-background: #0f1419;
  --color-background-soft: #1a1f26;
  --color-background-mute: #1e242c;
  --color-card: #111214;
  --color-card-border: #121417;
  --color-border: #1f2730;
  --color-border-hover: #2e3440;
  --color-heading: #ffffff;
  --color-text: #d8dee9;
  --color-text-muted: #9ca3af;
  --color-accent: #5e81ac;
  --color-accent-hover: #4c6b91;
  --color-accent-bg: rgba(94, 129, 172, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.theme-light {
  --color-background: #f7f8fa;
  --color-background-soft: #ffffff;
  --color-background-mute: #f3f4f6;
  --color-card: #ffffff;
  --color-card-border: #eaecf0;
  --color-border: #e6e9ee;
  --color-border-hover: #d6d9df;
  --color-heading: #0f1724;
  --color-text: #111827;
  --color-text-muted: #6b7280;
  --color-accent: #007aff;
  --color-accent-hover: #0064d6;
  --color-accent-bg: rgba(0, 122, 255, 0.08);
  --shadow-sm: 0 4px 10px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  font-weight: normal;
}

body {
  min-height: 100vh;
  color: var(--color-text);
  background: var(--color-background);
  transition:
    color 0.2s ease,
    background-color 0.2s ease;
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  width: 100%;
  min-height: 100vh;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: var(--color-background);
}

:root {
  --sidebar-width: 260px;
  --content-max-width: 1100px;
}

/* Typography */
h1 {
  color: var(--color-heading);
  font-weight: 700;
  font-size: 2.5rem;
  letter-spacing: -0.025em;
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

h2 {
  color: var(--color-heading);
  font-weight: 600;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

h3,
h4 {
  color: var(--color-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--spacing-md);
}

/* Navigation */
nav.nav {
  display: flex;
  gap: var(--spacing-xs);
  justify-content: center;
  margin-bottom: var(--spacing-2xl);
  background: var(--color-card);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  box-shadow: var(--shadow-md);
}

nav.nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  white-space: nowrap;
}

nav.nav a.router-link-exact-active {
  background: var(--color-accent);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

nav.nav a:hover:not(.router-link-exact-active) {
  background: var(--color-background-mute);
  color: var(--color-text);
}

/* Form Elements */
input[type="number"],
input[type="text"],
select {
  background: var(--color-background-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.95rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  width: 100%;
}

input[type="number"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-bg);
}

input[type="checkbox"] {
  accent-color: var(--color-accent);
  width: 1.1rem;
  height: 1.1rem;
}

button {
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--spacing-md) var(--spacing-xl);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

button:hover {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-background-soft);
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-hover);
}

/* Responsive Design */
@media (max-width: 768px) {
  #app {
    padding: var(--spacing-lg) var(--spacing-md);
  }

  nav.nav {
    gap: 0;
    padding: var(--spacing-xs);
  }

  nav.nav a {
    font-size: 0.85rem;
    padding: var(--spacing-sm);
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  #app {
    padding: var(--spacing-md) var(--spacing-sm);
  }
}
