/* Theme Variables and Color System */

:root {
  /* Clean, neutral light theme */
  --background: 0 0% 98%;      /* pure light gray background */
  --foreground: 220 9% 15%;   /* neutral dark gray text */
  --card: 0 0% 100%;          /* pure white cards */
  --card-foreground: 220 9% 15%; /* consistent neutral text */
  --popover: 0 0% 100%;
  --popover-foreground: 220 9% 15%; /* consistent neutral text */
  --primary: 220 14% 25%;     /* professional dark blue-gray */
  --primary-foreground: 0 0% 100%; /* white text on primary */
  --success: 142 71% 45%;     /* professional green for active states */
  --success-foreground: 0 0% 100%; /* white text on success */
  --secondary: 220 5% 94%;    /* neutral light gray */
  --secondary-foreground: 220 9% 15%; /* neutral text on secondary */
  --muted: 220 5% 91%;        /* neutral muted gray */
  --muted-foreground: 220 8% 40%; /* neutral gray text */
  --accent: 220 13% 91%;      /* subtle blue-gray accent for selection */
  --accent-foreground: 220 14% 25%; /* dark blue-gray text on accent */
  --destructive: 0 72% 51%;   /* clear red */
  --destructive-foreground: 0 0% 100%; /* white text on destructive */
  --border: 220 6% 90%;       /* neutral gray borders */
  --input: 220 5% 96%;        /* neutral input background */
  --ring: 220 14% 25%;
  --radius: 0.5rem;

  /* Tap highlight and selection */
  --tap-highlight: hsl(var(--ring) / 0.20);
  --selection-bg: hsl(var(--ring) / 0.28);
  --selection-fg: hsl(var(--foreground));
}

.dark {
  /* Clean neutral dark theme */
  --background: 220 15% 10%;     /* neutral dark gray background */
  --foreground: 220 10% 96%;     /* neutral white text */
  --card: 220 12% 14%;           /* slightly lighter card */
  --card-foreground: 220 10% 96%;
  --popover: 220 12% 16%;
  --popover-foreground: 220 10% 96%;
  --primary: 217 40% 55%;        /* brighter blue for better contrast in dark mode */
  --primary-foreground: 0 0% 98%;
  --success: 142 71% 45%;        /* consistent green for active states */
  --success-foreground: 0 0% 100%; /* white text on success */
  --secondary: 220 10% 24%;      /* neutral medium gray */
  --secondary-foreground: 220 10% 96%;
  --muted: 220 10% 18%;          /* neutral dark muted */
  --muted-foreground: 220 10% 75%;  /* neutral readable gray */
  --accent: 220 10% 28%;         /* darker blue-gray accent for dark mode */
  --accent-foreground: 220 10% 96%;
  --destructive: 354 65% 53%;    /* clear red */
  --destructive-foreground: 0 0% 98%;
  --border: 220 10% 20%;         /* neutral borders */
  --input: 220 10% 18%;          /* neutral input fields */
  --ring: 217 40% 55%;

  /* Slightly stronger in dark mode */
  --tap-highlight: hsl(var(--ring) / 0.35);
  /* Dark mode selection needs higher opacity */
  --selection-bg: hsl(var(--ring) / 0.50);
  --selection-fg: hsl(var(--foreground));
}

/* Text selection styling */
::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

/* Base body styling */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Light theme background */
.light {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
}

.theme-transitioning .light {
  transition: background-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
              color 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.light {
  background: linear-gradient(180deg,
    hsl(30, 20%, 98%) 0%,     /* warm off-white */
    hsl(30, 15%, 97%) 50%,    /* subtle gradient */
    hsl(30, 12%, 96%) 100%);  /* slightly deeper warm */
  min-height: 100vh;
}

/* Dark theme background */
.dark {
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
  background: linear-gradient(170deg,
    hsl(222, 20%, 8%) 0%,       /* deep navy */
    hsl(222, 20%, 10%) 50%,     /* subtle transition */
    hsl(220, 18%, 11%) 100%);   /* slightly lighter navy */
  min-height: 100vh;
  position: relative;
}

/* Premium subtle grain texture overlay for dark mode */
.dark::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.015;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg width=%2760%27 height=%2760%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Cfilter id=%27noise%27%3E%3CfeTurbulence type=%27fractalNoise%27 baseFrequency=%270.9%27 numOctaves=%274%27 stitchTiles=%27stitch%27/%3E%3C/filter%3E%3Crect width=%27100%25%27 height=%27100%25%27 filter=%27url%28%23noise%29%27 opacity=%271%27/%3E%3C/svg%3E");
}

/* Ensure all content is above the texture overlay */
body > * {
  position: relative;
  z-index: 2;
}

/* Prevent horizontal overflow on mobile */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Theme utilities */

/* Smooth theme transitions - only during theme switch */
.theme-transitioning body,
.theme-transitioning .bg-background,
.theme-transitioning .bg-card,
.theme-transitioning .text-foreground,
.theme-transitioning .border,
.theme-transitioning button,
.theme-transitioning input,
.theme-transitioning textarea {
  transition: background-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
              border-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
              color 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Add to your CSS - smooth transitions for theme changes */
.transition-colors {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
/* Scrollbar Styling */

:root {
  --scrollbar-thumb: hsl(220 13% 85%);
  --scrollbar-track: transparent;
}

.light {
  --scrollbar-thumb: hsl(220 10% 85%);  /* neutral scrollbar */
  --scrollbar-track: transparent;
}

.dark {
  --scrollbar-thumb: hsl(220 10% 40%);
  --scrollbar-track: transparent;
}

/* Custom scrollbar styling */
* {
  scrollbar-width: auto;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

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

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

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

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

/* Scrollbar utility classes */

/* Smart scrollbar behavior for message containers */
.smart-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
  overflow-y: auto;
  /* Prevent artificial overflow */
  box-sizing: border-box;
  min-height: 0;
}

.smart-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.smart-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.smart-scroll::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 0px;
  opacity: 0.7;
}

.smart-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb);
  opacity: 1;
}

/* Use overlay scrolling where supported to avoid layout shift */
@supports (overflow-y: overlay) {
  .smart-scroll {
    overflow-y: overlay;
  }
}

/* Light scrollbar variant */
.scrollbar-light::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.scrollbar-light::-webkit-scrollbar-track {
  background: transparent;
}

.scrollbar-light::-webkit-scrollbar-thumb {
  background-color: rgba(229, 231, 235, 0.5); /* light gray with transparency */
  border-radius: 0px;
}

.scrollbar-light::-webkit-scrollbar-thumb:hover {
  background-color: rgba(209, 213, 219, 0.8); /* slightly darker on hover */
}

/* Enhanced scrollbar styling */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 155, 155, 0.5) transparent;
}

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

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: rgba(155, 155, 155, 0.5);
  border-radius: 0px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: rgba(155, 155, 155, 0.8);
}

/* Hide scrollbar while keeping scroll functionality */
.hide-scrollbar {
  -ms-overflow-style: none;  /* Internet Explorer 10+ */
  scrollbar-width: none;  /* Firefox */
  -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
}

.hide-scrollbar::-webkit-scrollbar {
  display: none;  /* Safari and Chrome */
}

/* Mobile-specific scroll fixes */
@media (max-width: 640px) {
  .hide-scrollbar {
    /* Ensure smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    /* Allow natural overscroll behavior but contain it better */
    overscroll-behavior-y: auto;
    /* Improve scroll momentum handling */
    scroll-behavior: auto;
  }

  /* Add specific styles for message containers on mobile */
  .scroll-container-optimized {
    /* Ensure scroll position is preserved during dynamic content updates */
    contain: layout style;
    /* Prevent scroll anchoring issues */
    overflow-anchor: none;
  }
}
/* Interaction States and Animations */

/* Interaction timing variables */
:root {
  --interaction-duration: 200ms;
  --interaction-duration-fast: 100ms;
  --interaction-easing: cubic-bezier(0.4, 0, 0.2, 1);
  --interaction-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* Focus ring tokens */
  --focus-ring-width: 2px;
  --focus-ring-color: hsl(var(--ring));
  --focus-ring-offset: 2px;
}

/* Touch optimization - prevent delays and zoom */
a, button, input, textarea, select, summary, [role="button"] {
  -webkit-tap-highlight-color: var(--tap-highlight);
  touch-action: manipulation;
}

/* GPU-accelerated transitions */
button, input, textarea, select, a, [role="button"] {
  transition:
    background-color var(--interaction-duration) var(--interaction-easing),
    border-color var(--interaction-duration) var(--interaction-easing),
    box-shadow var(--interaction-duration) var(--interaction-easing),
    transform var(--interaction-duration-fast) var(--interaction-easing);
  will-change: transform;
}

/* Focus management */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Touch device interactions */
@media (hover: none) and (pointer: coarse) {
  button:active, [role="button"]:active {
    transform: scale(0.98);
  }

  .tap-feedback:active {
    background-color: hsl(var(--accent) / 0.18);
  }
}

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

  :root {
    --interaction-duration: 0.01ms;
    --interaction-duration-fast: 0.01ms;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  :root {
    --tap-highlight: hsl(var(--ring) / 0.5);
    --selection-bg: hsl(var(--ring) / 0.6);
  }

  button:focus-visible, input:focus-visible, textarea:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 2px;
  }
}

/* Utility classes for interactions */

/* Performance optimization */
.interaction-layer {
  isolation: isolate;
  transform: translateZ(0);
  contain: layout style paint;
}

/* Loading states */
[aria-busy="true"] {
  cursor: wait;
  position: relative;
}

[aria-busy="true"]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: hsl(var(--background) / 0.7);
  display: grid;
  place-items: center;
  border-radius: inherit;
}

/* Interaction state machine */
[data-interaction-state="idle"] {
  transform: scale(1);
  box-shadow: none;
}

[data-interaction-state="hover"] {
  background: hsl(var(--accent) / 0.05);
}

[data-interaction-state="focus"] {
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.5);
}

[data-interaction-state="active"] {
  transform: scale(0.98);
  box-shadow: inset 0 1px 3px hsl(var(--foreground) / 0.2);
}

[data-interaction-state="disabled"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

[data-interaction-state="loading"] {
  cursor: wait;
  position: relative;
  color: transparent;
}

/* Simple loading spinner */
[data-interaction-state="loading"]::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin: -8px 0 0 -8px;
  border: 2px solid hsl(var(--accent));
  border-radius: 50%;
  border-top-color: transparent;
  animation: spinner 600ms linear infinite;
}

@keyframes spinner {
  to { transform: rotate(360deg); }
}

/* Ripple effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: hsl(var(--accent) / 0.3);
  transition: width 0.6s, height 0.6s;
}

.ripple:active::before {
  width: 300px;
  height: 300px;
}

/* Forgiving interactions */
.icon-button-forgiving {
  position: relative;
  padding: 8px;
}

.icon-button-forgiving::before {
  content: '';
  position: absolute;
  inset: -8px;
  z-index: 1;
}

/* Prevent accidental actions */
form[data-submitting] button[type="submit"] {
  pointer-events: none;
  opacity: 0.6;
}

/* Selection control */
.no-select {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.no-select .selectable {
  -webkit-user-select: text;
  user-select: text;
}

/* Modal backdrop protection */
.modal-backdrop {
  padding: 20px;
}

.modal-content {
  position: relative;
  z-index: 1;
}

/* Platform-specific optimizations */
@supports (-webkit-touch-callout: none) {
  /* iOS specific */
  input, textarea {
    -webkit-user-select: text;
    -webkit-touch-callout: none;
  }

  button {
    -webkit-appearance: none;
  }

  .scroll-container {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}

/* Android adjustments */
@media (hover: none) and (pointer: coarse) and (-webkit-min-device-pixel-ratio: 2), (hover: none) and (pointer: coarse) and (min-resolution: 2dppx) {
  :root {
    --tap-highlight: hsl(var(--ring) / 0.3);
  }
}

/* Desktop with touch support */
@media (hover: hover) and (pointer: coarse) {
  button, [role="button"] {
    transition-duration: 150ms;
    min-height: 36px;
    min-width: 36px;
  }
}
/* Keyboard Navigation Patterns */

/* Screen reader only content */
.sr-only, .sr-announce {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Skip links for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 8px;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Roving tabindex patterns */
[role="toolbar"] [role="button"][tabindex="-1"],
[role="menu"] [role="menuitem"][tabindex="-1"],
[role="tablist"] [role="tab"][tabindex="-1"] {
  outline: none;
}

[role="toolbar"] [role="button"][tabindex="0"]:focus-visible,
[role="menu"] [role="menuitem"][tabindex="0"]:focus-visible,
[role="tablist"] [role="tab"][tabindex="0"]:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Radio group pattern */
[role="radiogroup"] {
  display: flex;
  gap: 8px;
}

[role="radiogroup"]:focus-within {
  box-shadow: 0 0 0 1px hsl(var(--ring) / 0.2);
  border-radius: var(--radius);
}

/* Grid navigation */
[role="grid"] [role="gridcell"][tabindex="-1"] {
  outline: none;
}

[role="grid"] [role="gridcell"][tabindex="0"]:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: -1px;
}

/* List navigation */
[role="listbox"] [role="option"][aria-selected="false"] {
  outline: none;
}

[role="listbox"] [role="option"][aria-selected="true"] {
  background: hsl(var(--accent) / 0.1);
}

[role="listbox"] [role="option"]:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: -2px;
}

/* Keyboard hints */
[data-keyboard-hint]::after {
  content: attr(data-keyboard-hint);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
  margin-bottom: 4px;
}

[data-keyboard-hint]:focus-visible::after {
  opacity: 1;
}

/* Focus trap */
[data-focus-trap="active"] {
  isolation: isolate;
}

[data-focus-trap="active"] [data-focus-trap-start],
[data-focus-trap="active"] [data-focus-trap-end] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Focus within compound components */
.input-group:focus-within {
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.35);
  border-radius: var(--radius);
}

/* Stable focus (prevents layout shift) */
.stable-focus {
  --focus-ring-offset: 3px;
  margin: var(--focus-ring-offset);
}

.stable-focus:focus-visible {
  outline-offset: calc(var(--focus-ring-offset) * -1);
}

/* Tooltip delay behavior */
[data-tooltip] {
  --tooltip-delay: 750ms;
  position: relative;
}

[data-tooltip]:hover ~ [data-tooltip]:hover {
  --tooltip-delay: 0ms;
}
/* Metallic Effects and Premium Styling */
  /* Metallic effect classes */
  .metallic-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg,
      hsl(var(--card)) 0%,
      hsl(var(--card) / 0.95) 50%,
      hsl(var(--card) / 0.9) 100%);
    border: 1px solid hsl(var(--border) / 0.6);
    box-shadow:
      0 4px 6px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .light .metallic-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 50%;
    background: linear-gradient(to bottom,
      rgba(255, 252, 248, 0.5) 0%,   /* warm white highlight */
      rgba(255, 250, 245, 0.2) 50%,
      transparent 100%);
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    pointer-events: none;
  }

  .dark .metallic-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 50%;
    background: linear-gradient(to bottom,
      rgba(255, 255, 255, 0.1) 0%,
      rgba(255, 255, 255, 0.05) 50%,
      transparent 100%);
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    pointer-events: none;
  }

  /* Metallic surfaces */
  .light .metallic-surface {
    background: linear-gradient(135deg,
      hsl(30, 20%, 98%) 0%,      /* warm white */
      hsl(30, 15%, 96%) 50%,     /* soft beige */
      hsl(30, 12%, 94%) 100%);   /* warm gray */
    border: 1px solid hsl(30, 10%, 90%);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.06),
      inset 0 1px 0 rgba(255, 252, 248, 0.6);
  }

  .dark .metallic-surface {
    background: linear-gradient(135deg,
      #4a5568 0%,
      #2d3748 50%,
      #1a202c 100%);
    border: 1px solid rgba(100, 200, 255, 0.15);
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(100, 200, 255, 0.1),
      0 0 20px rgba(100, 200, 255, 0.05);
  }

  /* Hover metallic effect */
  .light .hover-metallic:hover {
    background: linear-gradient(135deg,
      hsl(30, 25%, 99%) 0%,      /* brighter warm white */
      hsl(30, 18%, 97%) 50%,     /* soft warm hover */
      hsl(30, 15%, 95%) 100%);   /* warm depth */
    border-color: hsl(30, 12%, 88%);
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 252, 248, 0.8);
  }

  .dark .hover-metallic:hover {
    background: linear-gradient(135deg,
      #5a6578 0%,
      #4a5568 50%,
      #2d3748 100%);
    border-color: rgba(100, 200, 255, 0.3);
    box-shadow:
      0 6px 12px rgba(0, 0, 0, 0.5),
      inset 0 1px 0 rgba(100, 200, 255, 0.2),
      0 0 25px rgba(100, 200, 255, 0.1);
    transform: translateY(-1px);
  }

  /* Metallic gradients */
  .light .bg-metallic-gradient {
    background: linear-gradient(135deg,
      hsl(30, 25%, 99%) 0%,      /* warm white */
      hsl(30, 20%, 98%) 25%,     /* cream */
      hsl(30, 15%, 96%) 50%,     /* soft beige */
      hsl(30, 12%, 94%) 75%,     /* warm gray */
      hsl(30, 10%, 92%) 100%);   /* deeper warm */
  }

  .dark .bg-metallic-gradient {
    background: linear-gradient(135deg,
      #4a5568 0%,
      #2d3748 25%,
      #1a202c 50%,
      #171923 75%,
      #0f1419 100%);
  }

  /* Metallic button styling */
  .metallic-button {
    position: relative;
    background: linear-gradient(135deg,
      hsl(var(--primary)) 0%,
      hsl(var(--primary) / 0.9) 50%,
      hsl(var(--primary) / 0.8) 100%);
    border: 1px solid hsl(var(--primary) / 0.3);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
  }

  .metallic-button:hover {
    background: linear-gradient(135deg,
      hsl(var(--primary) / 1.1) 0%,
      hsl(var(--primary)) 50%,
      hsl(var(--primary) / 0.9) 100%);
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
  }

  .metallic-button:active {
    transform: translateY(0);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }

  /* Metallic input styling */
  .metallic-input {
    background: linear-gradient(135deg,
      hsl(var(--input)) 0%,
      hsl(var(--input) / 0.95) 50%,
      hsl(var(--input) / 0.9) 100%);
    border: 1px solid hsl(var(--border) / 0.6);
    box-shadow:
      0 1px 2px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .metallic-input:focus {
    background: linear-gradient(135deg,
      hsl(var(--input) / 1.05) 0%,
      hsl(var(--input)) 50%,
      hsl(var(--input) / 0.95) 100%);
    border-color: hsl(var(--ring));
    box-shadow:
      0 0 0 2px hsl(var(--ring) / 0.2),
      0 1px 2px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }

/* Premium styles for light mode */
  .light .bg-gradient-subtle {
    background: linear-gradient(to bottom,
      hsl(30, 20%, 99%),    /* warm white */
      hsl(30, 15%, 97%));   /* soft cream */
  }

  .light .card-premium {
    background: linear-gradient(135deg,
      hsl(0, 0%, 100%) 0%,
      hsl(30, 15%, 99%) 50%,
      hsl(30, 12%, 98%) 100%);
    border: 1px solid hsl(30, 8%, 92%);
    box-shadow:
      0 1px 3px rgba(0, 0, 0, 0.04),
      0 4px 8px rgba(0, 0, 0, 0.02);
  }

  .light .button-premium {
    background: linear-gradient(135deg,
      hsl(200, 90%, 44%) 0%,
      hsl(200, 90%, 42%) 50%,
      hsl(200, 90%, 40%) 100%);
    border: 1px solid hsl(200, 90%, 38%);
    box-shadow:
      0 2px 4px rgba(0, 0, 0, 0.08),
      inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  .light .button-premium:hover {
    background: linear-gradient(135deg,
      hsl(200, 90%, 46%) 0%,
      hsl(200, 90%, 44%) 50%,
      hsl(200, 90%, 42%) 100%);
    box-shadow:
      0 3px 6px rgba(0, 0, 0, 0.12),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }

  .light .input-premium {
    background: hsl(30, 15%, 98%);
    border: 1px solid hsl(30, 8%, 90%);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
  }

  .light .input-premium:focus {
    background: hsl(0, 0%, 100%);
    border-color: hsl(200, 90%, 60%);
    box-shadow:
      0 0 0 3px hsl(200, 90%, 95%),
      inset 0 1px 2px rgba(0, 0, 0, 0.02);
  }

  .light .sidebar-premium {
    background: linear-gradient(180deg,
      hsl(30, 18%, 98%) 0%,
      hsl(30, 15%, 97%) 50%,
      hsl(30, 12%, 96%) 100%);
    border-right: 1px solid hsl(30, 8%, 92%);
  }

/* Premium styles for dark mode */
  .dark .bg-premium-dark {
    background: linear-gradient(135deg,
      hsl(220, 20%, 15%) 0%,
      hsl(220, 18%, 12%) 50%,
      hsl(220, 25%, 8%) 100%);
    position: relative;
  }

  .dark .bg-premium-dark::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 20%,
      rgba(100, 200, 255, 0.03) 0%,
      transparent 50%);
    pointer-events: none;
  }

  .dark .card-premium {
    background: linear-gradient(135deg,
      hsl(220, 22%, 18%) 0%,
      hsl(220, 20%, 15%) 50%,
      hsl(220, 18%, 12%) 100%);
    border: 1px solid rgba(100, 200, 255, 0.12);
    box-shadow:
      0 8px 16px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(100, 200, 255, 0.08),
      0 0 0 1px rgba(255, 255, 255, 0.02);
    position: relative;
  }

  .dark .card-premium::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
      transparent 0%,
      rgba(100, 200, 255, 0.3) 50%,
      transparent 100%);
  }

  .dark .text-glow {
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.3);
  }

  .dark .border-glow {
    border-color: rgba(100, 200, 255, 0.2);
    box-shadow: 0 0 10px rgba(100, 200, 255, 0.1);
  }

  .dark .button-premium {
    background: linear-gradient(135deg,
      hsl(200, 100%, 45%) 0%,
      hsl(200, 100%, 55%) 50%,
      hsl(200, 100%, 40%) 100%);
    border: 1px solid rgba(100, 200, 255, 0.3);
    box-shadow:
      0 4px 8px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2),
      0 0 20px rgba(100, 200, 255, 0.2);
    position: relative;
    overflow: hidden;
  }

  .dark .button-premium::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg,
      transparent 40%,
      rgba(255, 255, 255, 0.1) 50%,
      transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
  }

  .dark .button-premium:hover::before {
    transform: translateX(100%);
  }

  .dark .button-premium:hover {
    background: linear-gradient(135deg,
      hsl(200, 100%, 50%) 0%,
      hsl(200, 100%, 60%) 50%,
      hsl(200, 100%, 45%) 100%);
    box-shadow:
      0 6px 12px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.3),
      0 0 30px rgba(100, 200, 255, 0.3);
    transform: translateY(-1px);
  }

  .dark .input-premium {
    background: linear-gradient(135deg,
      hsl(220, 20%, 18%) 0%,
      hsl(220, 18%, 15%) 50%,
      hsl(220, 22%, 12%) 100%);
    border: 1px solid rgba(100, 200, 255, 0.15);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.3),
      0 0 0 1px rgba(255, 255, 255, 0.02);
  }

  .dark .input-premium:focus {
    border-color: rgba(100, 200, 255, 0.4);
    box-shadow:
      inset 0 2px 4px rgba(0, 0, 0, 0.3),
      0 0 0 2px rgba(100, 200, 255, 0.2),
      0 0 20px rgba(100, 200, 255, 0.1);
  }

  .dark .sidebar-premium {
    background: linear-gradient(180deg,
      hsl(220, 25%, 16%) 0%,
      hsl(220, 22%, 14%) 50%,
      hsl(220, 20%, 12%) 100%);
    border-right: 1px solid rgba(100, 200, 255, 0.1);
    box-shadow:
      4px 0 8px rgba(0, 0, 0, 0.2),
      inset -1px 0 0 rgba(100, 200, 255, 0.05);
  }

  .dark .nav-item-premium {
    background: linear-gradient(135deg,
      transparent 0%,
      rgba(100, 200, 255, 0.03) 50%,
      transparent 100%);
    border: 1px solid transparent;
    transition: all 0.3s ease;
  }

  .dark .nav-item-premium:hover {
    background: linear-gradient(135deg,
      rgba(100, 200, 255, 0.08) 0%,
      rgba(100, 200, 255, 0.05) 50%,
      rgba(100, 200, 255, 0.02) 100%);
    border-color: rgba(100, 200, 255, 0.15);
    box-shadow:
      inset 0 1px 0 rgba(100, 200, 255, 0.1),
      0 2px 4px rgba(0, 0, 0, 0.2);
  }
/* Performance-based Animation Controls */
  /* Applied to root html element by usePerformanceDetection hook */

  /* Normal performance - all animations enabled */
  .performance-normal {
    /* All animations run normally */
  }

  /* Reduced performance - simpler, faster animations */
  .performance-reduced :not(.critical-animation) {
    animation-duration: 0.2s !important;
    transition-duration: 0.15s !important;
  }

  .performance-reduced .animate-pulse:not(.critical-animation),
  .performance-reduced .pulse-optimized:not(.critical-animation) {
    animation: none !important;
    opacity: 1 !important;
  }

  /* Minimal performance - no animations except critical ones */
  .performance-minimal :not(.critical-animation) {
    animation: none !important;
    transition: none !important;
  }

  /* Preserve critical animations in all performance modes */
  .performance-minimal .animate-spin.critical-animation,
  .performance-minimal .animate-spin,
  .performance-reduced .animate-spin.critical-animation,
  .performance-reduced .animate-spin {
    animation: spin 1s linear infinite !important;
  }

  /* Preserve essential UI animations */
  .performance-minimal .tooltip,
  .performance-minimal .dropdown-menu,
  .performance-minimal .modal,
  .performance-minimal .popover {
    animation: inherit !important;
    transition: inherit !important;
  }

  /* Remove will-change and GPU hints in minimal mode for non-critical elements */
  .performance-minimal .gpu-optimized:not(.critical-animation),
  .performance-minimal .transition-gpu:not(.critical-animation) {
    will-change: auto !important;
    transform: none !important;
  }

  /* Instant visibility for animated entrance elements */
  .performance-minimal [class*="animate-"]:not(.critical-animation),
  .performance-reduced [class*="animate-"]:not(.critical-animation) {
    opacity: 1 !important;
  }

  /* Respect user motion preferences globally */
  @media (prefers-reduced-motion: reduce) {
    *:not(.critical-animation),
    *:not(.critical-animation)::before,
    *:not(.critical-animation)::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }

    /* Keep functional animations like spinners */
    .animate-spin,
    .critical-animation {
      animation: spin 1s linear infinite !important;
    }
  }

  /* Spinner animation definition */
  @keyframes spin {
    from {
      transform: rotate(0deg);
    }
    to {
      transform: rotate(360deg);
    }
  }
