/* ========================================
   UTILITYDESK PREMIUM DESIGN SYSTEM
   Inspired by ClearTax, Groww, Zerodha Varsity
   ======================================== */

/* ====== PREMIUM SPACING SYSTEM ====== */
:root {
  /* Spacing Scale (8px base) */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  
  /* Premium Shadows - Multi-layered */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
  
  /* Premium Glow Effects */
  --glow-primary: 0 0 0 3px rgba(59, 130, 246, 0.1);
  --glow-success: 0 0 0 3px rgba(16, 185, 129, 0.1);
  --glow-warning: 0 0 0 3px rgba(245, 158, 11, 0.1);
  --glow-error: 0 0 0 3px rgba(239, 68, 68, 0.1);
  
  /* Premium Gradients */
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  --gradient-mesh: radial-gradient(at 27% 37%, hsla(215, 98%, 61%, 0.15) 0px, transparent 50%),
                   radial-gradient(at 97% 21%, hsla(125, 98%, 72%, 0.1) 0px, transparent 50%),
                   radial-gradient(at 52% 99%, hsla(354, 98%, 61%, 0.1) 0px, transparent 50%),
                   radial-gradient(at 10% 29%, hsla(256, 96%, 67%, 0.1) 0px, transparent 50%),
                   radial-gradient(at 97% 96%, hsla(38, 60%, 74%, 0.1) 0px, transparent 50%),
                   radial-gradient(at 33% 50%, hsla(222, 67%, 73%, 0.1) 0px, transparent 50%),
                   radial-gradient(at 79% 53%, hsla(343, 68%, 79%, 0.1) 0px, transparent 50%);
  
  /* Premium Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Premium Border Radius */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-full: 9999px;
}

/* ====== PREMIUM TYPOGRAPHY ====== */
body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.025em;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: #0f172a;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 600;
  color: #1e293b;
}

/* ====== PREMIUM BUTTONS ====== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.5;
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.btn:hover::before {
  opacity: 1;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  box-shadow: var(--shadow-md), 0 0 0 0 rgba(59, 130, 246, 0);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

.btn-secondary {
  background: white;
  color: #1e293b;
  border: 2px solid #e2e8f0;
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: #64748b;
}

.btn-ghost:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: 1.0625rem;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: 0.875rem;
}

/* ====== PREMIUM CARDS ====== */
.card {
  position: relative;
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  border: 1px solid #e2e8f0;
  transition: all var(--transition-base);
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-mesh);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}

.card:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-4px);
  border-color: #cbd5e1;
}

.card:hover::before {
  opacity: 1;
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #3b82f6;
  font-size: 1.75rem;
  margin-bottom: var(--space-5);
  transition: all var(--transition-base);
}

.card:hover .card-icon {
  transform: scale(1.1) rotate(-5deg);
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: var(--space-3);
  line-height: 1.3;
}

.card-description {
  color: #64748b;
  line-height: 1.6;
  font-size: 0.9375rem;
  margin-bottom: var(--space-5);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: #3b82f6;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
}

.card-link::after {
  content: '→';
  transition: transform var(--transition-fast);
}

.card-link:hover {
  color: #2563eb;
}

.card-link:hover::after {
  transform: translateX(4px);
}

/* ====== PREMIUM INPUTS ====== */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: 1rem;
  line-height: 1.5;
  color: #0f172a;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  outline: none;
}

.input::placeholder {
  color: #94a3b8;
}

.input:hover {
  border-color: #cbd5e1;
}

.input:focus {
  border-color: #3b82f6;
  box-shadow: var(--glow-primary);
}

.input-error {
  border-color: #ef4444;
}

.input-error:focus {
  box-shadow: var(--glow-error);
}

.input-success {
  border-color: #10b981;
}

.input-success:focus {
  box-shadow: var(--glow-success);
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: var(--space-2);
}

/* ====== PREMIUM BADGES ====== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1;
  white-space: nowrap;
}

.badge-primary {
  background: #eff6ff;
  color: #1e40af;
}

.badge-success {
  background: #ecfdf5;
  color: #047857;
}

.badge-warning {
  background: #fffbeb;
  color: #b45309;
}

.badge-error {
  background: #fef2f2;
  color: #b91c1c;
}

.badge-new {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

/* ====== LOADING SKELETONS ====== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 1rem;
  margin-bottom: var(--space-2);
}

.skeleton-title {
  height: 1.5rem;
  width: 60%;
  margin-bottom: var(--space-3);
}

.skeleton-card {
  height: 200px;
}

.skeleton-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
}

/* ====== MICRO-INTERACTIONS ====== */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.hover-scale {
  transition: transform var(--transition-base);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-glow {
  transition: box-shadow var(--transition-base);
}

.hover-glow:hover {
  box-shadow: var(--shadow-lg), var(--glow-primary);
}

.click-scale {
  transition: transform var(--transition-fast);
}

.click-scale:active {
  transform: scale(0.95);
}

/* Ripple Effect */
.ripple {
  position: relative;
  overflow: hidden;
}

.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  width: 100px;
  height: 100px;
  margin-top: -50px;
  margin-left: -50px;
  top: 50%;
  left: 50%;
  transform: scale(0);
  opacity: 1;
  pointer-events: none;
}

.ripple:active::after {
  animation: ripple-effect 0.6s ease-out;
}

@keyframes ripple-effect {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* ====== SUCCESS ANIMATIONS ====== */
.success-checkmark {
  display: inline-block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  position: relative;
  animation: success-bounce 0.6s ease-out;
}

.success-checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 2.5rem;
  font-weight: bold;
  animation: checkmark-draw 0.4s ease-out 0.3s both;
}

@keyframes success-bounce {
  0% { transform: scale(0); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

@keyframes checkmark-draw {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0) rotate(-45deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

/* ====== ERROR STATES ====== */
.error-state {
  text-align: center;
  padding: var(--space-12);
}

.error-icon {
  display: inline-block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  font-size: 2.5rem;
  line-height: 80px;
  margin-bottom: var(--space-6);
  animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: var(--space-3);
}

.error-message {
  color: #64748b;
  font-size: 1rem;
  margin-bottom: var(--space-6);
}

/* ====== EMPTY STATES ====== */
.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
}

.empty-icon {
  display: inline-block;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #94a3b8;
  font-size: 3rem;
  line-height: 120px;
  margin-bottom: var(--space-8);
}

.empty-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: var(--space-3);
}

.empty-message {
  color: #64748b;
  font-size: 1rem;
  max-width: 400px;
  margin: 0 auto var(--space-8);
}

/* ====== PREMIUM HERO SECTION ====== */
.hero-premium {
  position: relative;
  padding: var(--space-20) 0;
  overflow: hidden;
}

.hero-premium::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-mesh);
  animation: mesh-float 20s ease-in-out infinite;
}

@keyframes mesh-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -20px); }
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero-title {
  margin-bottom: var(--space-6);
  animation: fade-up 0.8s ease-out;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: #64748b;
  margin-bottom: var(--space-10);
  animation: fade-up 0.8s ease-out 0.1s both;
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
  animation: fade-up 0.8s ease-out 0.2s both;
}

@keyframes fade-up {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====== RESPONSIVE ADJUSTMENTS ====== */
@media (max-width: 768px) {
  .card {
    padding: var(--space-6);
  }
  
  .hero-premium {
    padding: var(--space-12) 0;
  }
  
  .btn {
    width: 100%;
  }
  
  .hero-actions {
    flex-direction: column;
  }
}

/* ====== DARK MODE SUPPORT ====== */
@media (prefers-color-scheme: dark) {
  .card {
    background: #1e293b;
    border-color: #334155;
  }
  
  .card-title {
    color: #f1f5f9;
  }
  
  .card-description {
    color: #94a3b8;
  }
  
  .input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
  }
  
  .skeleton {
    background: linear-gradient(90deg, #334155 0%, #475569 50%, #334155 100%);
  }
}

/* ====== ACCESSIBILITY ====== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 3px solid #3b82f6;
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .card {
    border-width: 3px;
  }
  
  .btn {
    border: 2px solid currentColor;
  }
}
