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

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 216 50% 17%;
    --card: 0 0% 100%;
    --card-foreground: 216 50% 17%;
    --popover: 0 0% 100%;
    --popover-foreground: 216 50% 17%;
    --primary: 216 50% 17%;
    --primary-foreground: 0 0% 100%;
    --secondary: 216 20% 95%;
    --secondary-foreground: 216 50% 17%;
    --muted: 216 20% 95%;
    --muted-foreground: 216 15% 50%;
    --accent: 43 96% 56%;
    --accent-foreground: 216 50% 17%;
    --destructive: 0 72% 51%;
    --destructive-foreground: 0 0% 100%;
    --border: 216 20% 90%;
    --input: 216 20% 90%;
    --ring: 216 50% 30%;
    --radius: 0.5rem;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
    font-feature-settings: "rlig" 1, "calt" 1;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Selection color */
::selection {
  background-color: rgba(251, 191, 36, 0.2);
  color: #1a2847;
}

/* ===================== */
/* PREMIUM CSS UTILITIES */
/* ===================== */

/* Glassmorphism */
@layer utilities {
  .glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
  }

  .glass-dark {
    background: rgba(13, 20, 36, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* Gradient border */
.gradient-border {
  position: relative;
  background: white;
  border-radius: 1rem;
}

.gradient-border::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: calc(1rem + 2px);
  background: linear-gradient(135deg, #fbbf24, #1a2847, #fbbf24);
  background-size: 300% 300%;
  animation: gradient-shift 4s ease infinite;
  z-index: -1;
}

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

/* Animated counter */
.animate-count {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Toast slide-in */
@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-right {
  animation: slide-in-right 0.3s ease-out;
}

/* Page fade-in */
@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-page-in {
  animation: page-fade-in 0.4s ease-out;
}

/* Stagger children animation */
.stagger-in > * {
  opacity: 0;
  animation: page-fade-in 0.4s ease-out forwards;
}

.stagger-in > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-in > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-in > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-in > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-in > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-in > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-in > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-in > *:nth-child(8) { animation-delay: 0.4s; }

/* Premium glow effect */
.glow-gold {
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.15), 0 0 40px rgba(251, 191, 36, 0.05);
}

.glow-gold-hover:hover {
  box-shadow: 0 0 25px rgba(251, 191, 36, 0.2), 0 0 50px rgba(251, 191, 36, 0.08);
}

/* Dot pattern background */
.dot-pattern {
  background-image: radial-gradient(circle, #d9e0f0 1px, transparent 1px);
  background-size: 24px 24px;
}

/* Subtle grid pattern */
.grid-pattern {
  background-image:
    linear-gradient(rgba(217, 224, 240, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 224, 240, 0.3) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Pulse for live indicators */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.5); }
}

.pulse-dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

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

.shimmer {
  background: linear-gradient(90deg, #f0f3f9 25%, #e2e8f0 50%, #f0f3f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Card hover lift */
.hover-lift {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -5px rgba(13, 20, 36, 0.1), 0 4px 10px -5px rgba(13, 20, 36, 0.04);
}

/* Smooth number transition */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Zebra striping for tables */
.zebra-stripe tbody tr:nth-child(even) {
  background-color: rgba(240, 243, 249, 0.5);
}

/* Focus ring animation */
@keyframes focus-ring {
  0% { box-shadow: 0 0 0 0 rgba(64, 100, 178, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(64, 100, 178, 0); }
  100% { box-shadow: 0 0 0 0 rgba(64, 100, 178, 0); }
}

input:focus, textarea:focus, select:focus {
  animation: focus-ring 0.3s ease-out;
}

/* Signature line */
.signature-line {
  border-bottom: 2px solid #1a2847;
  min-height: 60px;
  font-family: 'Brush Script MT', 'Segoe Script', cursive;
}

/* Spin-up animation for numbers */
@keyframes count-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.count-up {
  animation: count-up 0.6s ease-out;
}
