
@import './styles/base.css';

/* Prevent iOS auto-zoom on input fields - Mobile UX Fix */
@media screen and (max-width: 1024px) {
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="search"],
  select,
  textarea {
    font-size: 16px !important;
  }
}

/* Dropdown Menu Animation Variables */
:root {
  --dropdown-animation-duration: 200ms;
  --dropdown-item-stagger-delay: 30ms;
  --dropdown-easing: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Smooth dropdown menu animations */
[role="menu"],
[data-radix-menu-content] {
  animation-timing-function: var(--dropdown-easing);
  will-change: opacity, transform;
}

/* Menu items stagger effect */
[role="menuitem"] {
  animation-fill-mode: backwards;
}

/* Neo-Automotive Design System - Components */
/* Enhanced Glass Morphism Effects */
.glass {
  @apply bg-white/10 border border-white/20;
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 
    0 8px 32px rgba(31, 38, 135, 0.37),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-dark {
  @apply bg-black/20 border border-white/10;
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Enhanced Neo-Card Component */
.neo-card {
  @apply bg-neo-dark/40 backdrop-blur-xl border border-white/10 rounded-2xl;
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.4),
    0 10px 10px -5px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.neo-card:hover {
  @apply bg-neo-dark/55 border-white/20;
  transform: translateY(-2px);
  box-shadow: 
    0 32px 64px -12px rgba(0, 0, 0, 0.5),
    0 20px 25px -5px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.neo-button {
  @apply relative overflow-hidden rounded-xl font-semibold transition-all duration-300;
  @apply bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600;
  @apply shadow-lg hover:shadow-xl transform hover:-translate-y-0.5;
}

.neo-button::before {
  content: '';
  @apply absolute inset-0 bg-gradient-to-r from-white/20 to-transparent opacity-0;
  @apply transition-opacity duration-300;
}

.neo-button:hover::before {
  @apply opacity-100;
}

/* Premium Gradients */
.gradient-neo-blue {
  background: linear-gradient(135deg, hsl(var(--neo-blue)) 0%, hsl(var(--neo-blue-dark)) 100%);
}

.gradient-neo-orange {
  background: linear-gradient(135deg, hsl(var(--neo-orange)) 0%, hsl(var(--neo-orange-dark)) 100%);
}

.gradient-aurora {
  background: linear-gradient(135deg, hsl(var(--neo-blue)) 0%, hsl(var(--neo-purple)) 50%, hsl(var(--neo-orange)) 100%);
}

/* Animated Backgrounds */
.animate-gradient {
  background-size: 300% 300%;
  animation: gradient-shift 8s ease infinite;
}

/* Shimmer Loading Effect */
.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 2s infinite;
}

/* Premium Shadows */
.shadow-neo {
  box-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.shadow-neo-lg {
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Enhanced Interactive Elements */
.hover-lift {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.25),
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 0 40px -10px rgba(var(--neo-blue-rgb, 59, 130, 246), 0.3);
}

.hover-lift:active {
  transform: translateY(-2px);
  transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Button States */
/* DEPRECATED: Use <Button variant="default"> from @/components/ui/button instead */
/* Migration: <button className="btn-primary"> → <Button variant="default"> */
.btn-primary {
  @apply bg-gradient-to-r from-neo-blue to-neo-blue-dark text-white font-semibold;
  @apply border border-neo-blue/20 rounded-xl px-6 py-3;
  @apply transition-all duration-300 ease-out;
  @apply hover:from-neo-blue-dark hover:to-neo-blue hover:border-neo-blue/40;
  @apply hover:shadow-lg hover:shadow-neo-blue/25 hover:-translate-y-1;
  @apply active:translate-y-0 active:scale-[0.98];
  @apply focus:outline-none focus:ring-2 focus:ring-neo-blue/50 focus:ring-offset-2 focus:ring-offset-background;
}

/* Global Focus Ring Utilities */
.focus-ring {
  @apply focus-visible:outline-none;
  @apply focus-visible:ring-2 focus-visible:ring-neo-blue;
  @apply focus-visible:ring-offset-2 focus-visible:ring-offset-background;
  @apply transition-all duration-200 ease-out;
}

.focus-ring:focus-visible {
  box-shadow: 
    0 0 0 3px hsl(var(--neo-blue)),
    0 0 20px rgba(59, 130, 246, 0.3),
    0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-offset-color);
}

.focus-ring-error {
  @apply focus-visible:outline-none;
  @apply focus-visible:ring-2 focus-visible:ring-red-500;
  @apply focus-visible:ring-offset-2 focus-visible:ring-offset-background;
  @apply transition-all duration-200 ease-out;
}

.focus-ring-error:focus-visible {
  box-shadow: 
    0 0 0 3px hsl(0, 84%, 60%),
    0 0 20px rgba(239, 68, 68, 0.3),
    0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-offset-color);
}

.focus-ring-success {
  @apply focus-visible:outline-none;
  @apply focus-visible:ring-2 focus-visible:ring-green-500;
  @apply focus-visible:ring-offset-2 focus-visible:ring-offset-background;
  @apply transition-all duration-200 ease-out;
}

.focus-ring-success:focus-visible {
  box-shadow: 
    0 0 0 3px hsl(142, 76%, 55%),
    0 0 20px rgba(34, 197, 94, 0.3),
    0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-offset-color);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .focus-ring:focus-visible,
  .focus-ring-error:focus-visible,
  .focus-ring-success:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible,
  button:focus-visible {
    outline: 3px solid currentColor !important;
    outline-offset: 2px !important;
  }
}

@media (forced-colors: active) {
  .focus-ring:focus-visible,
  .focus-ring-error:focus-visible,
  .focus-ring-success:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible,
  button:focus-visible {
    outline: 3px solid CanvasText !important;
    outline-offset: 2px !important;
  }
}

.btn-secondary {
  @apply bg-white/10 text-white font-semibold border border-white/20;
  @apply rounded-xl px-6 py-3 backdrop-blur-md;
  @apply transition-all duration-300 ease-out;
  @apply hover:bg-white/15 hover:border-white/30 hover:-translate-y-1;
  @apply hover:shadow-lg hover:shadow-black/25;
  @apply active:translate-y-0 active:scale-[0.98];
  @apply focus:outline-none focus:ring-2 focus:ring-white/50 focus:ring-offset-2 focus:ring-offset-background;
}

/* Text Gradients */
.text-gradient-neo {
  @apply bg-gradient-to-r from-blue-400 via-purple-500 to-orange-500 bg-clip-text text-transparent;
}

.text-gradient-primary {
  @apply bg-gradient-to-r from-blue-600 to-blue-400 bg-clip-text text-transparent;
}

/* Improved Table Readability */
.neo-table {
  @apply bg-white/10 backdrop-blur-md border border-white/20 rounded-lg overflow-hidden;
}

.neo-table-row {
  @apply border-b border-white/10 transition-colors duration-200;
}

.neo-table-row:hover {
  @apply bg-white/5;
}

/* Better Form Styling */
.neo-form-group {
  @apply space-y-2;
}

.neo-form-label {
  @apply text-white font-medium text-sm;
}

.neo-form-input {
  @apply bg-white/20 border border-white/30 text-white placeholder:text-white/70;
  @apply focus:bg-white/30 focus:border-neo-blue focus:ring-1 focus:ring-neo-blue;
  @apply transition-all duration-200;
}

/* Floating Elements */
.float-gentle {
  animation: float-gentle 6s ease-in-out infinite;
}

@keyframes float-gentle {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Horizontal Scrolling Animation */
@keyframes scroll-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Enhanced Animations */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
}

.animate-fade-in-fast {
  animation: fadeInFast 0.15s ease-out forwards;
}

.animate-slide-up {
  animation: slideUp 0.6s ease-out forwards;
}

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

.animate-scroll-left {
  animation: scroll-left 60s linear infinite;
}

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

@keyframes fadeInFast {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Stagger Animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* Production Polish - Final Touches */
/* Accessibility Improvements */
.focus-ring {
  @apply focus:outline-none focus:ring-2 focus:ring-neo-blue/50 focus:ring-offset-2 focus:ring-offset-background;
}

.focus-ring-light {
  @apply focus:outline-none focus:ring-2 focus:ring-white/50 focus:ring-offset-2 focus:ring-offset-neo-dark;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .text-neo-blue {
    @apply text-blue-500;
  }
  
  .bg-neo-blue {
    @apply bg-blue-600;
  }
  
  .border-white\/20 {
    @apply border-white/50;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .animate-fade-in,
  .animate-scale-in,
  .animate-slide-in-right,
  .animate-hover-lift,
  .animate-bounce-gentle {
    animation: none;
  }
  
  .transition-all,
  .transition-transform,
  .transition-colors {
    transition: none;
  }
  
  .hover\:scale-105:hover,
  .hover\:-translate-y-1:hover,
  .hover\:-translate-y-2:hover {
    transform: none;
  }
}

/* Print Styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  .bg-gradient-to-r,
  .bg-gradient-to-br {
    background: white !important;
    color: black !important;
  }
}

/* Touch Device Optimizations */
@media (pointer: coarse) {
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }
  
  .hover\:scale-105:hover {
    transform: none;
  }
  
  .active\:scale-95:active {
    transform: scale(0.95);
  }
}

/* Enhanced Mobile Touch Optimizations */
@media (max-width: 768px) {
  /* Ensure all interactive elements have proper touch targets */
  button, 
  a, 
  [role="button"], 
  input, 
  select, 
  textarea,
  .touch-target {
    min-height: 44px;
  }
  
  /* Prevent text selection on buttons */
  button, [role="button"] {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Better touch feedback with subtle animation */
  button:active, 
  [role="button"]:active,
  .touch-target:active {
    transform: scale(0.97);
    transition: transform 0.1s ease-out;
  }
  
  /* Disable hover effects on touch devices */
  @media (hover: none) and (pointer: coarse) {
    .hover\:scale-105:hover,
    .hover\:-translate-y-1:hover,
    .hover\:-translate-y-2:hover {
      transform: none;
    }
    
    /* Ensure scroll animation still works on mobile */
    .animate-scroll {
      animation: scroll 30s linear infinite !important;
    }
  }
  
  /* Ensure proper spacing on mobile */
  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Table horizontal scroll indicators */
.table-wrapper {
  position: relative;
}

.table-wrapper::before,
.table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30px;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.table-wrapper::before {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.3), transparent);
  opacity: 0;
}

.table-wrapper::after {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent);
}

.table-wrapper[data-scroll-left="true"]::before {
  opacity: 1;
}

.table-wrapper[data-scroll-right="false"]::after {
  opacity: 0;
}

/* Keyboard navigation improvements */
*:focus-visible {
  outline: 2px solid hsl(var(--neo-blue));
  outline-offset: 2px;
  border-radius: 4px;
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid hsl(var(--neo-blue));
  outline-offset: 2px;
}

/* Infinite Scroll Animation for Deals Banner */
@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

.animate-scroll {
  animation: scroll 30s linear infinite;
}

.animate-scroll:hover {
  animation-play-state: paused;
}

/* 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;
  }
  
  /* Keep scroll animation but slow it down for accessibility */
  .animate-scroll {
    animation: scroll 60s linear infinite !important;
    animation-iteration-count: infinite !important;
  }
  
  /* Disable problematic animations */
  .animate-spin,
  .animate-pulse,
  .animate-bounce {
    animation: none !important;
  }
}

/* Loading States */
.loading-skeleton {
  @apply bg-white/10 animate-pulse rounded;
}

.loading-shimmer {
  position: relative;
  overflow: hidden;
}

.loading-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 2s infinite;
}

/* Enhanced Typography Classes */
.text-display-xs {
  @apply text-2xl font-bold font-display tracking-tight leading-tight;
}

.text-display-sm {
  @apply text-3xl font-bold font-display tracking-tight leading-tight;
}

.text-display-md {
  @apply text-4xl font-bold font-display tracking-tight leading-tight;
}

.text-display-lg {
  @apply text-5xl font-bold font-display tracking-tight leading-tight;
}

.text-display-xl {
  @apply text-6xl font-bold font-display tracking-tight leading-tight;
}

.text-display-2xl {
  @apply text-7xl font-bold font-display tracking-tight leading-tight;
}

.text-heading-xs {
  @apply text-lg font-semibold tracking-tight leading-snug;
}

.text-heading-sm {
  @apply text-xl font-semibold tracking-tight leading-snug;
}

.text-heading-md {
  @apply text-2xl font-semibold tracking-tight leading-snug;
}

.text-heading-lg {
  @apply text-3xl font-semibold tracking-tight leading-snug;
}

.text-body-xs {
  @apply text-xs leading-relaxed;
}

.text-body-sm {
  @apply text-sm leading-relaxed;
}

.text-body {
  @apply text-base leading-relaxed;
}

.text-body-lg {
  @apply text-lg leading-relaxed;
}

/* Enhanced Button Variants */
/* DEPRECATED: Use <Button variant="secondary"> from @/components/ui/button instead */
/* Migration: <button className="btn-glass"> → <Button variant="secondary"> */
.btn-glass {
  @apply bg-white/10 backdrop-blur-md border border-white/20 text-white;
  @apply hover:bg-white/15 hover:border-white/30;
  @apply transition-all duration-300 rounded-xl px-6 py-3 font-semibold;
}

/* DEPRECATED: Use <Button variant="default"> from @/components/ui/button instead */
/* Migration: <button className="btn-neo"> → <Button variant="default"> */
.btn-neo {
  @apply bg-gradient-to-r from-neo-blue to-neo-blue-dark text-white;
  @apply border border-neo-blue/20 rounded-xl px-6 py-3 font-semibold;
  @apply hover:from-neo-blue-dark hover:to-neo-blue hover:border-neo-blue/40;
  @apply hover:shadow-lg hover:shadow-neo-blue/25 hover:-translate-y-1;
  @apply active:translate-y-0 active:scale-[0.98];
  @apply transition-all duration-300;
}

/* Utility Classes for Consistent Spacing */
.space-section {
  @apply py-16 md:py-20 lg:py-24;
}

.space-component {
  @apply py-8 md:py-12 lg:py-16;
}

.space-element {
  @apply py-4 md:py-6 lg:py-8;
}

/* Container Variants */
.container-tight {
  @apply max-w-4xl mx-auto px-4 sm:px-6 lg:px-8;
}

.container-wide {
  @apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8;
}

.container-full {
  @apply w-full px-4 sm:px-6 lg:px-8;
}

/* Enhanced Interactive States */
.interactive {
  @apply transition-all duration-300 hover:scale-105 hover:-translate-y-1;
  @apply active:scale-95 active:translate-y-0;
  @apply focus:outline-none focus:ring-2 focus:ring-neo-blue/50 focus:ring-offset-2;
}

.interactive-subtle {
  @apply transition-all duration-300 hover:scale-[1.02] hover:-translate-y-0.5;
  @apply active:scale-[0.98];
}

/* Force Dark Theme on Dealer Tables - High Contrast Accessibility */
.dealer-table-wrapper table,
.dealer-table-wrapper thead,
.dealer-table-wrapper tbody {
  background-color: transparent !important;
}

.dealer-table-wrapper th {
  background-color: hsl(220 20% 8% / 0.9) !important;
  color: white !important;
  font-weight: 700 !important;
  border-color: hsl(0 0% 100% / 0.3) !important;
}

.dealer-table-wrapper td {
  color: white !important;
  font-weight: 500 !important;
}

.dealer-table-wrapper tr {
  background-color: hsl(220 20% 12% / 0.4) !important;
  border-color: hsl(0 0% 100% / 0.2) !important;
}

.dealer-table-wrapper tr:hover {
  background-color: hsl(220 20% 8% / 0.6) !important;
}
