/* HubCharge Base Styles - Tesla-inspired Design System with Tailwind Integration */

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */

:root {
  /* Brand Colors - Orange Primary */
  --brand-orange: #ff6b35;
  --brand-orange-light: #ff8555;
  --brand-orange-dark: #e55a2b;
  --brand-orange-subtle: rgba(255, 107, 53, 0.1);
  --brand-orange-glow: rgba(255, 107, 53, 0.2);

  /* Neutral Palette */
  --gray-50: #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;
  --gray-950: #09090b;

  /* Semantic Colors */
  --success: #10b981;
  --success-light: #34d399;
  --success-subtle: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --warning-subtle: rgba(245, 158, 11, 0.1);
  --error: #ef4444;
  --error-light: #f87171;
  --error-subtle: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-light: #60a5fa;
  --info-subtle: rgba(59, 130, 246, 0.1);
}

/* ============================================
   Dark Theme (Default - Tesla-inspired)
   ============================================ */
[data-theme="dark"],
:root {
  /* Backgrounds */
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #141414;
  --bg-elevated: #1a1a1a;
  --bg-overlay: rgba(0, 0, 0, 0.95);

  /* Surfaces */
  --surface-primary: #1a1a1a;
  --surface-secondary: #242424;
  --surface-tertiary: #2e2e2e;
  --surface-hover: #333333;

  /* Borders */
  --border-primary: #2a2a2a;
  --border-secondary: #3a3a3a;
  --border-focus: var(--brand-orange);
  --border-subtle: rgba(255, 255, 255, 0.06);

  /* Text */
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-tertiary: #666666;
  --text-inverse: #000000;
  --text-muted: #888888;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px var(--brand-orange-glow);

  /* Focus Ring */
  /* --ring-color: var(--brand-orange-subtle); */
}

/* ============================================
   Light Theme
   ============================================ */
[data-theme="light"] {
  /* Backgrounds */
  --bg-primary: #ffffff;
  --bg-secondary: #fafafa;
  --bg-tertiary: #f4f4f5;
  --bg-elevated: #ffffff;
  --bg-overlay: rgba(255, 255, 255, 0.95);

  /* Surfaces */
  --surface-primary: #ffffff;
  --surface-secondary: #f4f4f5;
  --surface-tertiary: #e4e4e7;
  --surface-hover: #e4e4e7;

  /* Borders */
  --border-primary: #e4e4e7;
  --border-secondary: #d4d4d8;
  --border-focus: var(--brand-orange);
  --border-subtle: rgba(0, 0, 0, 0.06);

  /* Text */
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-tertiary: #a1a1aa;
  --text-inverse: #ffffff;
  --text-muted: #71717a;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 20px rgba(255, 107, 53, 0.15);

  /* Focus Ring */
  --ring-color: rgba(255, 107, 53, 0.2);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition:
    background-color 200ms ease,
    color 200ms ease;
}

/* Remove default focus outline, we'll add custom ones */
*:focus {
  outline: none;
}

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}

/* Links */
a {
  color: var(--brand-orange);
  text-decoration: none;
  transition: color 150ms ease;
}

a:hover {
  color: var(--brand-orange-light);
}

/* Images */
img,
svg {
  display: block;
  max-width: 100%;
}

/* Form elements inherit font */
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* Remove default button styles */
button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   Animation Keyframes
   ============================================ */

/* Shimmer - Loading skeleton effect */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Pulse - Subtle scaling effect */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Bounce - Vertical bounce */
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* Spin - 360 degree rotation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Glow Pulse - Orange glow effect */
@keyframes glowPulse {
  0%,
  100% {
    box-shadow: 0 0 5px var(--brand-orange-glow);
  }
  50% {
    box-shadow:
      0 0 20px var(--brand-orange-glow),
      0 0 30px var(--brand-orange-glow);
  }
}

/* Gradient Shift - Background animation */
@keyframes gradientShift {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-20px, 20px) scale(1.1);
  }
}

/* Ring Pulse - Focus ring animation */
@keyframes ringPulse {
  0% {
    box-shadow: 0 0 0 0 var(--brand-orange-subtle);
  }
  70% {
    box-shadow: 0 0 0 10px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* ============================================
   Animation Utility Classes
   ============================================ */
.animate-shimmer {
  animation: shimmer 2s infinite linear;
  background: linear-gradient(
    90deg,
    var(--surface-secondary) 25%,
    var(--surface-tertiary) 50%,
    var(--surface-secondary) 75%
  );
  background-size: 200% 100%;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-bounce {
  animation: bounce 1s infinite;
}

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

.animate-fade-in {
  animation: fadeIn 200ms ease-out;
}

.animate-fade-in-up {
  animation: fadeInUp 300ms ease-out;
}

.animate-scale-in {
  animation: scaleIn 200ms ease-out;
}

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

/* ============================================
   Transition Utilities
   ============================================ */
.transition-fast {
  transition-property:
    color, background-color, border-color, text-decoration-color, fill, stroke,
    opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.transition-base {
  transition-property:
    color, background-color, border-color, text-decoration-color, fill, stroke,
    opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

.transition-slow {
  transition-property:
    color, background-color, border-color, text-decoration-color, fill, stroke,
    opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 300ms;
}

/* ============================================
   Backdrop Blur (Glass morphism)
   ============================================ */
.backdrop-blur {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.backdrop-blur-lg {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ============================================
   Responsive Utilities
   ============================================ */
@media (max-width: 640px) {
  html {
    font-size: 14px;
  }
}
