@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Design Tokens */
  --font-mono: 'JetBrains Mono', monospace;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* Restored Pure Neutral Gray Palette from previous step */
  --color-bg: #1e1e1e;
  --color-bg-rgb: 30, 30, 30;
  --color-bg-deep: #121212;
  --color-surface: #252525;
  --color-surface-rgb: 37, 37, 37;
  --color-surface-soft: #2d2d2d;
  --color-border: #333333;
  --color-border-hover: #444444;

  --color-accent: #ffffff;
  --color-accent-rgb: 255, 255, 255;
  --color-accent-dim: #858585;

  --color-text-primary: #dcdcdc;
  --color-text-secondary: #858585;
  --color-text-disabled: #555555;

  /* Aliases for component compatibility */
  --color-text: var(--color-text-primary);
  --color-text-dim: var(--color-text-secondary);

  --color-error: #f48771;
  --color-success: #81b88b;
  --color-warning: #e2c08d;

  /* Curves & Spacing */
  --radius-sm: 6px;
  --radius-md: 12px;
  --spacing-unit: 8px;
  --spacing-sm: 12px;
  --spacing-std: 20px;
  --spacing-lg: 32px;

  /* Animation Tokens - Smooth transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-slow: 0.6s cubic-bezier(0.22, 1, 0.36, 1);

  /* Typography Scale */
  --font-size-base: 13px;
  --font-size-header: 24px;
  --font-size-small: 11px;

  /* Layout constraints */
  --sidebar-width: 240px;
  --header-height: 64px;
}

@media (max-width: 768px) {
  :root {
    --font-size-base: 12px;
    --font-size-header: 20px;
    --font-size-small: 10px;
  }
}

/* Global Reset & Base Styles */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: var(--font-size-base);
  scrollbar-gutter: stable;
}

body {
  font-family: var(--font-mono);
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  min-height: 100dvh;
  /* Dynamic Viewport Height for Mobile */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#root {
  width: 100%;
}

input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* Typography Scale */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-mono);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

p {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition-fast);
}

a:hover {
  opacity: 0.8;
}

/* Utility Classes */

.mono {
  font-family: var(--font-mono);
}

/* Common Page Layout */

.page-layout {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
}

.container-main {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
}

.header-underlined {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 24px;
}

.btn-ghost {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  opacity: 0.7;
  padding: 0 16px;
  /* Removed vertical padding for height control */
  width: 150px;
  height: 33px;
  /* Match input height */
  cursor: pointer;
  font-size: 11px;
  transition: var(--transition-fast);
  font-family: var(--font-mono);
}

.btn-ghost:hover {
  background: var(--color-surface-soft);
  color: var(--color-accent);
  border-color: var(--color-accent-dim);
  opacity: 1;
}

/* Re-use back-btn logic */

.back-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  opacity: 0.7;
  padding: 0 16px;
  /* Removed vertical padding for height control */
  width: 150px;
  height: 33px;
  /* Match input height */
  /* Fixed width for stability */
  cursor: pointer;
  font-size: 11px;
  transition: var(--transition-fast);
  font-family: var(--font-mono);
}

.back-btn:hover {
  background: var(--color-surface-soft);
  color: var(--color-accent);
  border-color: var(--color-accent-dim);
  opacity: 1;
}

.text-error {
  color: var(--color-error);
}

.text-success {
  color: var(--color-success);
}

/* Global Scrollbar */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

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

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

/* Page Entry Animation Container */

.page-fade-in {
  animation: fadeIn var(--transition-smooth);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}/* Global App Styles */
body {
  background: var(--color-bg); /* Use the original theme background */
  overflow-x: hidden;
}

#root {
  display: flex;
  width: 100%;
  min-height: 100vh;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), 
              filter 0.5s ease, 
              border-radius 0.5s ease,
              box-shadow 0.5s ease;
  transform-origin: center center;
  background: var(--color-bg); /* Match body to avoid flicker */
}

body.has-modal #root {
  transform: scale(0.97); /* More subtle recede */
  filter: brightness(0.75); /* Not as dark */
  border-radius: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  overflow: hidden;
}