/* ==========================================================================
   HeroUI v3 Design System & Theme Engine (Vanilla CSS)
   ========================================================================== */

:root {
  /* Color Palette - HeroUI Modern Spectrum */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;

  /* Light Theme Default Tokens - Crisp, Clean, Elevated */
  --color-bg: #F8F9FA;
  --color-bg-secondary: #F1F3F5;
  --color-content1: #FFFFFF;
  --color-content2: #EDF0F2;
  --color-content3: #E2E6EA;
  --color-content4: #CED4DA;
  
  --color-foreground: #18191B;
  --color-foreground-muted: #5F656B;
  --color-foreground-subtle: #878E95;
  --color-text: #18191B;
  --color-text-muted: #5F656B;

  --color-divider: rgba(0, 0, 0, 0.08);
  --color-divider-subtle: rgba(0, 0, 0, 0.04);
  --color-border: rgba(0, 0, 0, 0.14);

  /* HeroUI Signature Vibrant Accents */
  --color-primary: #006FEE;
  --color-primary-hover: #005BC4;
  --color-primary-subtle: rgba(0, 111, 238, 0.08);
  --color-secondary: #7828C8;
  --color-secondary-hover: #6020A0;
  --color-success: #17C964;
  --color-success-subtle: rgba(23, 201, 100, 0.12);
  --color-warning: #F5A524;
  --color-warning-subtle: rgba(245, 165, 36, 0.12);
  --color-danger: #F31260;
  --color-danger-subtle: rgba(243, 18, 96, 0.12);

  /* Gradients */
  --grad-hero: linear-gradient(135deg, #006FEE 0%, #7828C8 50%, #FF4ECD 100%);
  --grad-accent: linear-gradient(135deg, #006FEE 0%, #00B8D9 100%);
  --grad-card-glow: radial-gradient(circle at 50% 0%, rgba(0, 111, 238, 0.06) 0%, transparent 70%);

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px rgba(0, 111, 238, 0.18);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Transitions */
  --trans-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --trans-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --trans-bounce: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Theme Tokens (HeroUI Dark Default) */
[data-theme="dark"] {
  --color-bg: #000000;
  --color-bg-secondary: #0A0A0C;
  --color-content1: #121216;
  --color-content2: #18181B;
  --color-content3: #27272A;
  --color-content4: #3F3F46;

  --color-foreground: #ECEDEE;
  --color-foreground-muted: #A1A1AA;
  --color-foreground-subtle: #71717A;
  --color-text: #ECEDEE;
  --color-text-muted: #A1A1AA;

  --color-divider: rgba(255, 255, 255, 0.08);
  --color-divider-subtle: rgba(255, 255, 255, 0.04);
  --color-border: rgba(255, 255, 255, 0.12);

  --color-primary: #006FEE;
  --color-primary-hover: #338EF7;
  --color-primary-subtle: rgba(0, 111, 238, 0.18);
  --color-secondary: #9353D3;
  --color-secondary-hover: #A865E5;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 30px rgba(0, 111, 238, 0.35);
  --grad-card-glow: radial-gradient(circle at 50% 0%, rgba(120, 40, 200, 0.15) 0%, transparent 70%);
}

/* Global Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  background-color: var(--color-bg);
  color: var(--color-foreground);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  color: var(--color-foreground);
  transition: background-color var(--trans-normal), color var(--trans-normal);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

@media (max-width: 640px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* HeroUI Badge / Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  background: var(--color-content2);
  color: var(--color-foreground-muted);
  border: 1px solid var(--color-divider);
  transition: all var(--trans-fast);
}

.chip-primary {
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  border-color: rgba(0, 111, 238, 0.2);
}

.chip-success {
  background: var(--color-success-subtle);
  color: var(--color-success);
  border-color: rgba(23, 201, 100, 0.2);
}

.chip-secondary {
  background: rgba(120, 40, 200, 0.12);
  color: var(--color-secondary);
  border-color: rgba(120, 40, 200, 0.25);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* HeroUI Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--trans-fast);
  user-select: none;
  border: 1px solid transparent;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 26px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: var(--color-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(0, 111, 238, 0.35);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 111, 238, 0.45);
}

.btn-secondary {
  background: var(--grad-hero);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(120, 40, 200, 0.35);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-flat {
  background: var(--color-content2);
  color: var(--color-foreground);
  border: 1px solid var(--color-divider);
}

.btn-flat:hover {
  background: var(--color-content3);
  border-color: var(--color-border);
}

.btn-ghost {
  background: transparent;
  color: var(--color-foreground-muted);
}

.btn-ghost:hover {
  background: var(--color-content2);
  color: var(--color-foreground);
}

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

/* HeroUI Card */
.card {
  position: relative;
  background: var(--color-content1);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--trans-normal);
  overflow: visible;
}

.card-hover:hover {
  transform: translateY(-3px);
  border-color: var(--color-border);
  box-shadow: var(--shadow-lg);
}

.card-glass {
  background: rgba(18, 18, 22, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="light"] .card-glass {
  background: rgba(255, 255, 255, 0.85);
}

/* HeroUI Inputs & Form Controls */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.input-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-foreground-muted);
}

.input, .textarea {
  width: 100%;
  padding: 11px 16px;
  background: var(--color-content2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-foreground);
  font-size: 0.9375rem;
  transition: all var(--trans-fast);
}

.input:focus, .textarea:focus {
  border-color: var(--color-primary);
  background: var(--color-content1);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

/* ==========================================================================
   HeroUI Universal Select & Option Dropdown Styling (Global Standard)
   ========================================================================== */
select, .select {
  width: 100%;
  padding: 11px 40px 11px 16px;
  background-color: var(--color-content2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-foreground);
  font-size: 0.9375rem;
  font-family: inherit;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 14px) center;
  background-size: 16px 16px;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast), background-color var(--trans-fast);
  outline: none;
}

select:hover, .select:hover {
  border-color: var(--color-border);
}

select:focus, .select:focus {
  border-color: var(--color-primary);
  background-color: var(--color-content1);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

select:disabled, .select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Dropdown Option & Optgroup Styling (Eliminates ugly OS/browser defaults) */
select option,
.select option,
optgroup {
  background-color: var(--color-content1, #18181b);
  color: var(--color-foreground, #f4f4f5);
  padding: 10px 14px;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.5;
}

/* Theme-Specific Chevron & Option Colors */
[data-theme="dark"] select,
[data-theme="dark"] .select {
  background-color: var(--color-content2, #27272a);
  color: #f4f4f5;
  border-color: var(--color-divider, rgba(255, 255, 255, 0.15));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d4d4d8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="dark"] select:focus,
[data-theme="dark"] .select:focus {
  background-color: #18181b;
}

[data-theme="dark"] select option,
[data-theme="dark"] .select option,
[data-theme="dark"] optgroup {
  background-color: #18181b !important;
  color: #f4f4f5 !important;
}

[data-theme="light"] select,
[data-theme="light"] .select {
  background-color: #ffffff;
  color: #11181c;
  border-color: rgba(0, 0, 0, 0.15);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

[data-theme="light"] select:focus,
[data-theme="light"] .select:focus {
  background-color: #ffffff;
}

[data-theme="light"] select option,
[data-theme="light"] .select option,
[data-theme="light"] optgroup {
  background-color: #ffffff !important;
  color: #11181c !important;
}

/* ==========================================================================
   AWSM Tools — State-of-the-Art Custom Dropdown Component
   Universal Dropdown Solution across all browsers, devices & themes
   ========================================================================== */

.awsm-native-select-hidden {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  clip: rect(0, 0, 0, 0) !important;
}

.awsm-select-wrapper {
  position: relative;
  width: 100%;
  user-select: none;
}

/* Custom Trigger Button */
.awsm-select-trigger {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background-color: var(--color-content2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  color: var(--color-foreground);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast), background-color var(--trans-fast);
}

.awsm-select-trigger:hover {
  border-color: var(--color-border);
  background-color: var(--color-content2);
}

.awsm-select-trigger:focus,
.awsm-select-wrapper.open .awsm-select-trigger {
  border-color: var(--color-primary);
  background-color: var(--color-content1);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.awsm-select-value-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.awsm-select-label {
  font-weight: 600;
  color: var(--color-foreground);
  font-size: 0.875rem;
  line-height: 1.25;
}

.awsm-select-sublabel {
  font-size: 0.71875rem;
  color: var(--color-foreground-muted);
  line-height: 1.2;
}

.awsm-select-chevron {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-foreground-muted);
  transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.awsm-select-wrapper.open .awsm-select-chevron {
  transform: rotate(180deg);
  color: var(--color-primary);
}

/* Floating Custom Dropdown Menu */
.awsm-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1050;
  background-color: var(--color-content1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 4px 14px rgba(0, 0, 0, 0.2);
  padding: 5px;
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-divider) transparent;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 160ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 160ms cubic-bezier(0.16, 1, 0.3, 1),
              visibility 160ms;
  pointer-events: none;
}

/* Custom Sleek Scrollbar */
.awsm-select-menu::-webkit-scrollbar {
  width: 5px;
}

.awsm-select-menu::-webkit-scrollbar-track {
  background: transparent;
  margin: 6px 0;
}

.awsm-select-menu::-webkit-scrollbar-thumb {
  background-color: var(--color-divider);
  border-radius: 999px;
  transition: background-color var(--trans-fast);
}

.awsm-select-menu::-webkit-scrollbar-thumb:hover {
  background-color: var(--color-foreground-muted);
}

[data-theme="light"] .awsm-select-menu {
  background-color: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

[data-theme="light"] .awsm-select-menu::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.18);
}

.awsm-select-wrapper.open .awsm-select-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Upwards Open State (for dropdowns positioned near viewport bottom) */
.awsm-select-wrapper.open-up .awsm-select-menu {
  top: auto;
  bottom: calc(100% + 6px);
  transform: translateY(0) scale(1);
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.45), 0 -4px 14px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .awsm-select-wrapper.open-up .awsm-select-menu {
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.12), 0 -2px 8px rgba(0, 0, 0, 0.06);
}

/* Custom Dropdown Group Header */
.awsm-select-group-header {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-foreground-muted);
  padding: 8px 10px 4px;
  user-select: none;
}

/* Custom Dropdown Option Items */
.awsm-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  color: var(--color-foreground);
  cursor: pointer;
  transition: background-color var(--trans-fast), color var(--trans-fast);
  outline: none;
}

.awsm-select-item:hover,
.awsm-select-item.focused {
  background-color: var(--color-content2);
}

.awsm-select-item.active {
  background-color: var(--color-primary-subtle);
  color: var(--color-primary);
}

[data-theme="dark"] .awsm-select-item.active {
  background-color: rgba(0, 111, 238, 0.18);
  color: #38bdf8;
}

.awsm-select-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.awsm-select-item-title {
  font-size: 0.84375rem;
  font-weight: 600;
  line-height: 1.3;
}

.awsm-select-item.active .awsm-select-item-title {
  font-weight: 700;
}

.awsm-select-item-desc {
  font-size: 0.71875rem;
  color: var(--color-foreground-muted);
  line-height: 1.25;
}

.awsm-select-item.active .awsm-select-item-desc {
  color: var(--color-primary);
  opacity: 0.85;
}

.awsm-select-item-check {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}

[data-theme="dark"] .awsm-select-item-check {
  color: #38bdf8;
}

.awsm-select-item.active .awsm-select-item-check {
  display: flex;
}

.textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

.code-area {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  tab-size: 2;
  white-space: pre;
}

@media (max-width: 768px) {
  .input, .textarea, .select {
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
  }
  .card {
    padding: 16px 14px;
  }
}

/* HeroUI Tabs */
.tabs-nav {
  display: inline-flex;
  gap: 4px;
  background: var(--color-content2);
  padding: 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-divider);
}

.tab-btn {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-foreground-muted);
  cursor: pointer;
  transition: all var(--trans-fast);
}

.tab-btn:hover {
  color: var(--color-foreground);
}

.tab-btn.active {
  background: var(--color-content1);
  color: var(--color-foreground);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Gradient Text Effect */
.gradient-text {
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

.gradient-text-cyan {
  background: var(--grad-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

/* Hero Glow Backdrop */
.hero-glow-blob {
  position: absolute;
  top: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 95vw);
  max-width: 100%;
  height: 220px;
  background: radial-gradient(ellipse at center, rgba(120, 40, 200, 0.1) 0%, rgba(0, 111, 238, 0.06) 50%, transparent 70%);
  filter: blur(50px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}

[data-theme="dark"] .hero-glow-blob {
  opacity: 1;
  background: radial-gradient(ellipse at center, rgba(120, 40, 200, 0.22) 0%, rgba(0, 111, 238, 0.16) 45%, transparent 70%);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  background: var(--color-content1);
  color: var(--color-foreground);
  border: 1px solid var(--color-divider);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideInUp 200ms ease forwards;
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-content3);
  border-radius: var(--radius-full);
}

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