/* Font loaded via preload in index.html for non-blocking delivery */
/* Desktop CLS stabilization - lock all layout dimensions */

/* CRITICAL: Inline essential resets to reduce TBT */
@tailwind base;
@tailwind components;
@tailwind utilities;

/* OPTIMIZATION: Containment for critical sections */
.contain-layout { contain: layout style; }
.contain-paint { contain: paint layout; }

/* Desktop-specific CLS locks & INP optimization */
@media(min-width:1024px){
  .max-w-6xl{max-width:1200px!important}
  .max-w-5xl{max-width:1000px!important}
  section{contain:layout style}
  .card-soft,.card-hover{contain:paint layout}
  /* Micro-interaction optimization */
  button,a,input,textarea{touch-action:manipulation;will-change:transform}
  button:active,a:active{transform:scale(0.98)}
  /* Hover states instant response */
  .card-hover:hover{transition-duration:0.15s}
  /* Font smoothing for crisp desktop text */
  body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}
}

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 0 0% 4%;
    --card: 0 0% 97%;
    --card-foreground: 0 0% 4%;
    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 4%;
    --primary: 0 0% 4%;
    --primary-foreground: 0 0% 100%;
    --secondary: 0 0% 96%;
    --secondary-foreground: 0 0% 4%;
    --muted: 0 0% 96%;
    --muted-foreground: 0 0% 45%;
    --accent: 0 0% 96%;
    --accent-foreground: 0 0% 4%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 91%;
    --input: 0 0% 91%;
    --ring: 0 0% 4%;
    --radius: 0.75rem;

    --gold: #D4AF37;
    --gold-light: #F0CC55;
    --gold-dim: #A88B20;
    --font-inter: 'Inter', sans-serif;
  }
}

@layer base {
  * { @apply border-border outline-ring/50; }
  body { @apply bg-background text-foreground font-inter; }
}

/* CRM responsive grids */
@media (min-width: 768px) {
  .lead-detail-grid {
    grid-template-columns: minmax(0, 1fr) 320px !important;
  }
  .dashboard-charts-grid {
    grid-template-columns: 1fr 300px !important;
  }
  .dashboard-bottom-grid {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #f5f5f5; }
::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* Cards */
.card-soft {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 24px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.05), 0 0 0 0 transparent;
}
.card-soft-dark {
  background: #111;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 24px;
}

/* Section separators */
.section-dark { background: #0b0b0b; color: #fff; }
.section-light { background: #ffffff; color: #0b0b0b; }
.section-gray { background: #f5f5f5; color: #0b0b0b; }

/* Gold accent */
.gold-pill {
  background: rgba(212,175,55,0.1);
  color: #A88B20;
  border: 1px solid rgba(212,175,55,0.25);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 12px;
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, #D4AF37 0%, #F0CC55 50%, #D4AF37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Pill button */
.btn-primary {
  background: #0b0b0b;
  color: #fff;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  padding: 0 28px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
}
.btn-primary:hover { background: #1a1a1a; transform: translateY(-2px) scale(1.01); box-shadow: 0 6px 24px rgba(0,0,0,0.22); }
.btn-primary:active { transform: translateY(0) scale(0.99); }

.btn-secondary {
  background: transparent;
  color: #0b0b0b;
  border: 1.5px solid rgba(0,0,0,0.14);
  border-radius: 16px;
  font-weight: 600;
  font-size: 15px;
  padding: 0 28px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn-secondary:hover { border-color: rgba(0,0,0,0.3); background: rgba(0,0,0,0.03); transform: translateY(-1px); }

.btn-gold {
  background: #D4AF37;
  color: #000;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  padding: 0 28px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(212,175,55,0.25);
}
.btn-gold:hover { background: #c9a430; transform: translateY(-2px) scale(1.01); box-shadow: 0 6px 20px rgba(212,175,55,0.35); }
.btn-gold:active { transform: translateY(0) scale(0.99); }

/* Badge chip */
.tag-chip {
  background: #f0f0f0;
  color: #555;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
}

/* Step number */
.step-num {
  font-size: 11px;
  font-weight: 700;
  color: #aaa;
  letter-spacing: 0.1em;
}

/* Heading sizes - Revolut style - mobile-first */
.display-xl { font-size: clamp(32px, 7vw, 88px); font-weight: 900; line-height: 1.1; letter-spacing: -0.03em; }
.display-lg { font-size: clamp(28px, 6vw, 68px); font-weight: 900; line-height: 1.15; letter-spacing: -0.025em; }
.display-md { font-size: clamp(24px, 4vw, 48px); font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.display-sm { font-size: clamp(18px, 3vw, 32px); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }

/* Hover card lift */
.card-hover { transition: transform 0.25s ease, box-shadow 0.25s ease; }
.card-hover:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.09); }

/* Focus rings - accessibility */
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #D4AF37;
  outline-offset: 2px;
}

/* Pulse glow text */
.pulse-text {
  color: rgba(0,0,0,0.75);
  font-weight: 700;
  animation: pulseOpacity 2.5s ease-in-out infinite;
}

@keyframes pulseOpacity {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Premium shimmer text */
.premium-text {
  background: linear-gradient(
    90deg,
    #ffffff 0%,
    #a8d8ff 50%,
    #ffffff 100%
  );
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

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

/* Prevent horizontal overflow */
body { overflow-x: hidden; }

/* Safe area padding for mobile notches */
@supports (padding: max(0px)) {
  .safe-padding-x {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}

/* Ensure text never touches screen edge on mobile */
@media (max-width: 480px) {
  section, footer, nav {
    box-sizing: border-box;
  }
}

/* Mobile tap highlight removal */
* { -webkit-tap-highlight-color: transparent; }

/* Range input thumb styling */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #0b0b0b;
  cursor: pointer;
  border: 3px solid #fff;
  box-shadow: 0 1px 6px rgba(0,0,0,0.25);
  transition: transform 0.15s ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range] { -webkit-appearance: none; appearance: none; }

/* Input */
.input-clean {
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  background: #f7f7f7;
  border: 1.5px solid transparent;
  font-size: 15px;
  font-family: var(--font-inter);
  color: #0b0b0b;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.input-clean::placeholder { color: #bbb; }
.input-clean:focus { border-color: #0b0b0b; background: #fff; box-shadow: 0 0 0 3px rgba(0,0,0,0.06); }

/* Divider */
.divider { width: 100%; height: 1px; background: rgba(0,0,0,0.07); }
.divider-dark { width: 100%; height: 1px; background: rgba(255,255,255,0.07); }

/* Dark section buttons */
.btn-primary-dark {
  background: #fff;
  color: #0b0b0b;
  border-radius: 16px;
  font-weight: 700;
  font-size: 15px;
  padding: 0 28px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s ease;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  box-shadow: 0 2px 16px rgba(0,0,0,0.3);
}
.btn-primary-dark:hover { background: #f5f5f5; transform: translateY(-2px) scale(1.01); box-shadow: 0 8px 28px rgba(0,0,0,0.35); }

.btn-secondary-dark {
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.75);
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  font-weight: 600;
  font-size: 15px;
  padding: 0 28px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.22s ease;
  cursor: pointer;
  white-space: nowrap;
}
.btn-secondary-dark:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.35); color: #fff; transform: translateY(-1px); }

/* Heading ripple — keep subtle, now for dark sections */
h1, h2, h3 {
  --ripple-x: 0px;
  --ripple-y: 0px;
  --ripple-intensity: 0;
  transform: translate(var(--ripple-x), var(--ripple-y));
  transition: transform 0.1s ease-out;
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}