/* ==========================================================================
   Neon Pulse Calculator - Base Styles (v3.0 - Enhanced)
   ========================================================================== */

/* ===== CSS Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ===== CSS Custom Properties (Design Tokens) ===== */
:root {
  /* Colors - Primary Palette */
  --color-bg-primary: #060a1e;
  --color-bg-secondary: #0f1433;
  --color-bg-tertiary: #1a2048;

  /* Neon Colors */
  --color-neon-cyan: #00f5ff;
  --color-neon-purple: #b24bff;
  --color-neon-pink: #ff3c8e;
  --color-neon-blue: #4d7cff;
  --color-neon-green: #00ff88;
  --color-neon-orange: #ff9f43;
  --color-neon-yellow: #ffe066;

  /* Glass Colors */
  --color-glass-white: rgba(255, 255, 255, 0.04);
  --color-glass-border: rgba(255, 255, 255, 0.08);
  --color-glass-hover: rgba(255, 255, 255, 0.07);

  /* Text Colors */
  --color-text-primary: #f0f0f5;
  --color-text-secondary: rgba(255, 255, 255, 0.65);
  --color-text-muted: rgba(255, 255, 255, 0.4);

  /* Status Colors */
  --color-success: #00ff88;
  --color-error: #ff4757;
  --color-warning: #ffa502;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--color-neon-cyan), var(--color-neon-purple));
  --gradient-secondary: linear-gradient(135deg, var(--color-neon-purple), var(--color-neon-pink));
  --gradient-button: linear-gradient(135deg, #00f5ff 0%, #b24bff 50%, #ff3c8e 100%);
  --gradient-bg: 
    radial-gradient(ellipse at 20% 0%, rgba(0, 245, 255, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(178, 75, 255, 0.06) 0%, transparent 50%),
    linear-gradient(160deg, #060a1e 0%, #0f1433 50%, #0a0e27 100%);

  /* Typography */
  --font-family-primary: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-family-display: 'Outfit', 'Cairo', sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --font-size-xs: clamp(0.7rem, 0.7vw + 0.45rem, 0.8rem);
  --font-size-sm: clamp(0.8rem, 0.8vw + 0.5rem, 0.9rem);
  --font-size-base: clamp(0.9rem, 1vw + 0.4rem, 1.05rem);
  --font-size-lg: clamp(1.05rem, 1.2vw + 0.5rem, 1.25rem);
  --font-size-xl: clamp(1.2rem, 1.5vw + 0.4rem, 1.6rem);
  --font-size-2xl: clamp(1.4rem, 2vw + 0.4rem, 2rem);
  --font-size-3xl: clamp(1.8rem, 2.5vw + 0.5rem, 2.5rem);
  --font-size-display: clamp(2.2rem, 3.5vw + 0.8rem, 3.5rem);

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Spacing */
  --space-2xs: clamp(0.125rem, 0.25vw, 0.25rem);
  --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --space-sm: clamp(0.4rem, 0.8vw, 0.65rem);
  --space-md: clamp(0.6rem, 1.2vw, 0.85rem);
  --space-lg: clamp(0.85rem, 1.8vw, 1.25rem);
  --space-xl: clamp(1.2rem, 2.5vw, 1.75rem);
  --space-2xl: clamp(1.75rem, 3.5vw, 2.5rem);
  --space-3xl: clamp(2.5rem, 5vw, 4rem);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-neon-cyan: 0 0 15px rgba(0, 245, 255, 0.3), 0 0 30px rgba(0, 245, 255, 0.15);
  --shadow-neon-purple: 0 0 15px rgba(178, 75, 255, 0.3), 0 0 30px rgba(178, 75, 255, 0.15);
  --shadow-neon-pink: 0 0 15px rgba(255, 60, 142, 0.3), 0 0 30px rgba(255, 60, 142, 0.15);

  /* Transitions */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 220ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 380ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 450ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-index */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* PC Mode */
  --pc-mode-width: 420px;
  --pc-mode-scale: 1;
}

/* ===== Base Styles ===== */
body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background: var(--gradient-bg);
  background-attachment: fixed;
  direction: rtl;
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--font-size-2xl);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Numbers - Monospace */
.mono,
input[type="number"],
input[type="text"].calc-display {
  font-family: var(--font-family-mono);
}

::selection {
  background: var(--color-neon-purple);
  color: var(--color-text-primary);
}

:focus-visible {
  outline: 2px solid var(--color-neon-cyan);
  outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg-secondary); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb { background: var(--gradient-primary); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--color-neon-cyan); }

/* Remove number input arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] { -moz-appearance: textfield; }
