
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 220 33% 98%;
    --foreground: 222 47% 11%;

    --card: 0 0% 100%;
    --card-foreground: 222 47% 11%;

    --popover: 0 0% 100%;
    --popover-foreground: 222 47% 11%;

    --primary: 222 83% 24%;
    --primary-foreground: 220 33% 98%;

    --secondary: 220 20% 96%;
    --secondary-foreground: 222 47% 11%;

    --muted: 220 20% 96%;
    --muted-foreground: 215 16% 47%;

    --accent: 220 20% 96%;
    --accent-foreground: 222 47% 11%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 210 40% 98%;

    --border: 214 32% 91%;
    --input: 214 32% 91%;
    --ring: 222 84% 48%;

    --radius: 0.75rem;

    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5% 26%;
    --sidebar-primary: 240 6% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 5% 96%;
    --sidebar-accent-foreground: 240 6% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217 91% 60%;
  }

  * {
    @apply border-border;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
  }

  body {
    @apply bg-background text-foreground;
    font-feature-settings: "ss01", "ss02", "cv01", "cv02", "cv03";
    overflow-x: hidden;
  }

  .glass {
    @apply backdrop-blur-lg bg-white/90 border border-white/20 shadow-sm;
  }

  .glass-royal {
    @apply backdrop-blur-lg bg-royal/10 border border-royal/20 shadow-royal;
  }

  .glass-dark {
    @apply backdrop-blur-lg bg-midnight/80 border border-midnight/50 shadow-lg;
  }

  .card-hover {
    @apply transition-all duration-300 hover:shadow-md hover:-translate-y-1;
  }

  .text-balance {
    text-wrap: balance;
  }
  
  /* Image optimization */
  img {
    @apply max-w-full h-auto;
  }
}

@layer components {
  .page-container {
    @apply max-w-[1400px] mx-auto px-4 sm:px-6 md:px-8;
  }

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

  .section-royal {
    @apply py-12 md:py-16 lg:py-20 bg-gradient-royal text-white;
  }

  .section-midnight {
    @apply py-12 md:py-16 lg:py-20 bg-gradient-midnight text-white;
  }

  .heading-xl {
    @apply font-bold text-2xl sm:text-3xl md:text-4xl lg:text-5xl leading-tight text-balance;
  }

  .heading-lg {
    @apply font-bold text-xl sm:text-2xl md:text-3xl leading-tight;
  }

  .heading-md {
    @apply font-semibold text-lg sm:text-xl leading-tight;
  }

  .paragraph {
    @apply text-base text-muted-foreground leading-relaxed;
  }
  
  .royal-card {
    @apply bg-white rounded-xl shadow-royal border border-royal/10 p-4 md:p-6 transition-all duration-300 hover:shadow-elegant;
  }
  
  .royal-badge {
    @apply inline-flex items-center px-2 md:px-3 py-1 rounded-full bg-royal/10 text-royal text-xs md:text-sm font-medium;
  }
  
  .stats-value {
    @apply text-2xl md:text-3xl lg:text-4xl font-bold;
  }
  
  .stats-label {
    @apply text-xs md:text-sm text-muted-foreground;
  }
  
  /* Mobile optimizations */
  .mobile-container {
    @apply px-4 md:px-6;
  }
  
  .mobile-p {
    @apply px-2 md:px-0;
  }
  
  .mobile-stack {
    @apply flex flex-col md:flex-row;
  }
  
  .mobile-full {
    @apply w-full md:w-auto;
  }
  
  .mobile-center {
    @apply text-center md:text-left;
  }
  
  .mobile-stretch {
    @apply w-full md:w-auto;
  }
  
  .mobile-pad {
    @apply p-4 md:p-6;
  }
  
  .mobile-gap {
    @apply gap-3 md:gap-4;
  }
  
  .mobile-text-base {
    @apply text-sm md:text-base;
  }
  
  .mobile-text-lg {
    @apply text-base md:text-lg;
  }
  
  .mobile-text-xl {
    @apply text-lg md:text-xl; 
  }
  
  .mobile-scroll {
    @apply overflow-x-auto flex md:block;
  }
  
  /* Button styles */
  .btn {
    @apply inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 h-10 px-4 py-2;
  }
  
  .btn-primary {
    @apply bg-primary text-primary-foreground hover:bg-primary/90;
  }
  
  .btn-secondary {
    @apply bg-secondary text-secondary-foreground hover:bg-secondary/80;
  }
  
  .btn-outline {
    @apply border border-input bg-background hover:bg-accent hover:text-accent-foreground;
  }
  
  .btn-ghost {
    @apply hover:bg-accent hover:text-accent-foreground;
  }
  
  /* Form elements */
  .form-control {
    @apply block w-full px-3 py-2 bg-background border border-input rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-primary/50 text-sm;
  }
  
  .form-label {
    @apply block text-sm font-medium text-foreground mb-1;
  }
  
  .form-helper {
    @apply text-xs text-muted-foreground mt-1;
  }
  
  .form-group {
    @apply space-y-2 mb-4;
  }
}

/* Animate on scroll utility classes */
.scroll-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Custom animations */
@keyframes float-slow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes float-medium {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-15px); }
}

@keyframes float-fast {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-20px); }
}

@keyframes moveLeftToRight {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes moveRightToLeft {
  0% { transform: translateX(200%); }
  100% { transform: translateX(-100%); }
}

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

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

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

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

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

/* Shadow variations */
.shadow-royal {
  box-shadow: 0 4px 14px 0 rgba(45, 73, 205, 0.1);
}

.shadow-elegant {
  box-shadow: 0 8px 20px 0 rgba(45, 73, 205, 0.15);
}

/* Background gradients */
.bg-gradient-royal {
  background: linear-gradient(135deg, #2D49CD 0%, #1A2980 100%);
}

.bg-gradient-midnight {
  background: linear-gradient(135deg, #0F2027 0%, #203A43 50%, #2C5364 100%);
}

/* For responsive tables */
.responsive-table {
  @apply w-full overflow-x-auto;
}

/* For horizontal mobile scrolling elements */
.horizontal-scroll {
  @apply flex space-x-4 overflow-x-auto py-2 md:py-0 md:overflow-visible md:grid md:grid-cols-3 md:gap-6;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}

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

/* Line clamp utilities */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image optimization classes */
.img-responsive {
  @apply max-w-full h-auto;
}

.img-cover {
  @apply object-cover w-full h-full;
}

.img-contain {
  @apply object-contain w-full h-full;
}

.img-fluid {
  @apply max-w-full h-auto mx-auto;
}

/* Focus outline for accessibility */
.focus-visible:focus {
  @apply outline-none ring-2 ring-primary ring-opacity-50;
}

/* Skip to main content link - accessibility */
.skip-link {
  @apply sr-only focus:not-sr-only focus:absolute focus:top-0 focus:left-0 focus:z-50 focus:p-4 focus:bg-white focus:text-primary;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  .print-only {
    display: block !important;
  }
  
  body {
    font-size: 12pt;
  }
  
  a::after {
    content: " (" attr(href) ")";
  }
}

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