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

:root {
  /* Fonts */
  --font-main: 'PT Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Common Colors */
  --accent-primary: #6C63FF;
  --accent-secondary: #00D2FF;
  --accent-gradient: linear-gradient(135deg, #6C63FF 0%, #00D2FF 100%);
  --accent-gradient-hover: linear-gradient(135deg, #7B73FF 0%, #33DDFF 100%);

  --success: #4ECB71;
  --danger: #FF6B6B;
  --warning: #FFD93D;

  /* LIGHT MODE (Default) - Clean GitHub Style */
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-card: #ffffff;
  --bg-glass: rgba(0, 0, 0, 0.02);
  --border-glass: #d0d7de;

  --text-primary: #1f2328;
  --text-secondary: #656d76;
  --text-muted: #8c959f;

  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.07);
  --shadow-md: 0 3px 6px rgba(140, 149, 159, 0.12);
  --shadow-lg: 0 12px 28px rgba(140, 149, 159, 0.18);
  --shadow-glow: 0 0 15px rgba(108, 99, 255, 0.05);

  /* Editor Colors (Light) */
  --editor-bg: #ffffff;
  --editor-header: #f6f8fa;
  --editor-tab-active: #ffffff;
  --editor-line-numbers: #babbbd;
  --editor-text: #1f2328;
  --editor-indent: 60px;
  /* Unified horizontal offset */

  --syntax-prop: #0550ae;
  --syntax-val: #0a3069;
  --syntax-selector: #953800;
  --syntax-brace: #1f2328;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

[data-theme="dark"] {
  /* DARK MODE */
  --bg-primary: #0a0a1a;
  --bg-secondary: #12122a;
  --bg-card: rgba(25, 25, 60, 0.6);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --border-glass: rgba(255, 255, 255, 0.1);

  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.4);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(108, 99, 255, 0.3);

  /* Editor Colors (Dark) */
  --editor-bg: #1e1e3f;
  --editor-header: #191932;
  --editor-tab-active: #1e1e3f;
  --editor-line-numbers: rgba(255, 255, 255, 0.2);
  --editor-text: #d4d4d4;
  --syntax-prop: #9cdcfe;
  --syntax-val: #ce9178;
  --syntax-selector: #dcdcaa;
  --syntax-brace: #ffd700;
}

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

html {
  scroll-behavior: smooth;
  font-size: 18px;
  /* Unified premium readable scale */
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ========== BACKGROUND EFFECTS ========== */
.bg-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(108, 99, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(0, 210, 255, 0.05) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(108, 99, 255, 0.03) 0%, transparent 50%);
  transition: opacity var(--transition-slow);
}

[data-theme="dark"] .bg-mesh {
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(108, 99, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 80%, rgba(0, 210, 255, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 50% 50%, rgba(108, 99, 255, 0.05) 0%, transparent 50%);
}

/* ========== TYPOGRAPHY ========== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
}

h1 {
  font-size: 3rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 99, 255, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(108, 99, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
  backdrop-filter: blur(10px);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #4ECB71, #36B85C);
  color: white;
  box-shadow: 0 4px 15px rgba(78, 203, 113, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(78, 203, 113, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #FF6B6B, #E55555);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-lg {
  padding: var(--space-lg) var(--space-2xl);
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-sm) var(--space-md);
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 1000;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.theme-toggle-fixed {
  position: fixed;
  top: var(--space-xl);
  right: var(--space-xl);
}

.theme-toggle:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.theme-toggle:active {
  transform: translateY(0);
}

/* ========== CARDS ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  backdrop-filter: blur(20px);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: rgba(108, 99, 255, 0.3);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

/* ========== GLASS PANELS ========== */
.glass-panel {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
}

/* ========== BADGE ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: rgba(108, 99, 255, 0.2);
  color: #6C63FF;
  border: 1px solid rgba(108, 99, 255, 0.3);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(78, 203, 113, 0.3);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(255, 217, 61, 0.3);
}

/* ========== PROGRESS BAR ========== */
.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-normal);
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 480px;
  width: 90%;
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal h2 {
  margin-bottom: var(--space-lg);
}

.modal .form-group {
  margin-bottom: var(--space-md);
}

.modal label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.modal input,
.modal select {
  width: 100%;
  padding: var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  transition: all var(--transition-fast);
  outline: none;
}

.modal input:focus,
.modal select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.2);
}

.modal select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ========== ANIMATIONS ========== */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

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

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

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

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-8px);
  }

  50% {
    transform: translateX(8px);
  }

  75% {
    transform: translateX(-4px);
  }
}

.animate-fade-in {
  animation: fade-in 0.6s ease forwards;
}

.animate-slide-left {
  animation: slide-in-left 0.6s ease forwards;
}

.animate-slide-right {
  animation: slide-in-right 0.6s ease forwards;
}

.animate-scale-in {
  animation: scale-in 0.4s ease forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-shake {
  animation: shake 0.4s ease;
}

.delay-1 {
  animation-delay: 0.1s;
}

.delay-2 {
  animation-delay: 0.2s;
}

.delay-3 {
  animation-delay: 0.3s;
}

.delay-4 {
  animation-delay: 0.4s;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  .btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.75rem;
  }

  .card {
    padding: var(--space-lg);
  }
}