/* Alpine.js cloak – prevents flash of unstyled content */
[x-cloak] { display: none !important; }

/* =========================================
   Design-System – CSS Custom Properties
   ========================================= */
:root {
  /* ── Green Palette ── */
  --fs-green-50:  #eaf7f3;
  --fs-green-100: #c7eadf;
  --fs-green-200: #8fd9bf;
  --fs-green-300: #4dc9a0;
  --fs-green-400: #00b386;
  --fs-green-500: #00a37a;
  --fs-green-600: #008f6b;
  --fs-green-700: #008060;
  --fs-green-800: #006b50;
  --fs-green-900: #004d3a;

  /* ── Neutrals ── */
  --fs-neutral-50:  #f8fafb;
  --fs-neutral-100: #f1f5f9;
  --fs-neutral-200: #e2e8f0;
  --fs-neutral-300: #cbd5e1;
  --fs-neutral-400: #94a3b8;
  --fs-neutral-500: #64748b;
  --fs-neutral-600: #475569;
  --fs-neutral-700: #334155;
  --fs-neutral-800: #1e293b;
  --fs-neutral-900: #0f172a;

  /* ── Semantic ── */
  --fs-danger:   #ef4444;
  --fs-warning:  #f59e0b;
  --fs-info:     #3b82f6;
  --fs-success:  #22c55e;

  /* ── Gradients ── */
  --fs-grad-brand: linear-gradient(135deg, var(--fs-green-600), var(--fs-green-800));
  --fs-grad-hero:  linear-gradient(135deg, var(--fs-green-700) 0%, #0a6d55 50%, #064e3b 100%);
  --fs-grad-card:  linear-gradient(135deg, var(--fs-green-600), var(--fs-green-800));

  /* ── Glassmorphism ── */
  --fs-glass-bg:     rgba(255, 255, 255, .72);
  --fs-glass-border: rgba(255, 255, 255, .45);
  --fs-glass-shadow: 0 8px 32px rgba(0, 0, 0, .05);
  --fs-glass-blur:   14px;

  /* ── Typography ── */
  --fs-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* ── Radii ── */
  --fs-radius-sm:  0.5rem;
  --fs-radius-md:  0.75rem;
  --fs-radius-lg:  1rem;
  --fs-radius-xl:  1.25rem;
  --fs-radius-pill: 999px;

  /* ── Shadows ── */
  --fs-shadow-xs:  0 1px 2px rgba(0, 0, 0, .04);
  --fs-shadow-sm:  0 1px 3px rgba(0, 0, 0, .06), 0 1px 2px rgba(0, 0, 0, .04);
  --fs-shadow-md:  0 4px 6px rgba(0, 0, 0, .04), 0 2px 4px rgba(0, 0, 0, .03);
  --fs-shadow-lg:  0 10px 25px rgba(0, 0, 0, .06), 0 4px 10px rgba(0, 0, 0, .04);
  --fs-shadow-xl:  0 20px 40px rgba(0, 0, 0, .08), 0 8px 16px rgba(0, 0, 0, .04);

  /* ── Spacing ── */
  --fs-space-xs:  0.25rem;
  --fs-space-sm:  0.5rem;
  --fs-space-md:  1rem;
  --fs-space-lg:  1.5rem;
  --fs-space-xl:  2rem;
  --fs-space-2xl: 3rem;
  --fs-space-3xl: 4rem;

  /* ── Transitions ── */
  --fs-transition-fast: 150ms cubic-bezier(.4, 0, .2, 1);
  --fs-transition-base: 200ms cubic-bezier(.4, 0, .2, 1);
  --fs-transition-slow: 300ms cubic-bezier(.4, 0, .2, 1);
}

/* =========================================
   Bootstrap Overrides
   ========================================= */

/* Primary → Green */
.btn-primary {
  --bs-btn-bg: var(--fs-green-700);
  --bs-btn-border-color: var(--fs-green-700);
  --bs-btn-hover-bg: var(--fs-green-800);
  --bs-btn-hover-border-color: var(--fs-green-800);
  --bs-btn-active-bg: var(--fs-green-900);
  --bs-btn-active-border-color: var(--fs-green-900);
  --bs-btn-focus-shadow-rgb: 0, 128, 96;
}
.btn-outline-primary {
  --bs-btn-color: var(--fs-green-700);
  --bs-btn-border-color: var(--fs-green-700);
  --bs-btn-hover-bg: var(--fs-green-700);
  --bs-btn-hover-border-color: var(--fs-green-700);
  --bs-btn-active-bg: var(--fs-green-800);
  --bs-btn-active-border-color: var(--fs-green-800);
  --bs-btn-focus-shadow-rgb: 0, 128, 96;
}

/* Success → Consistent green */
.btn-success {
  --bs-btn-bg: var(--fs-green-600);
  --bs-btn-border-color: var(--fs-green-600);
  --bs-btn-hover-bg: var(--fs-green-700);
  --bs-btn-hover-border-color: var(--fs-green-700);
}

/* Links → Green */
a { color: var(--fs-green-700); transition: color var(--fs-transition-fast); }
a:hover { color: var(--fs-green-900); }

/* Badges → Slightly rounded */
.badge { font-weight: 600; letter-spacing: .01em; }

/* Buttons global polish */
.btn {
  border-radius: var(--fs-radius-sm);
  font-weight: 500;
  transition: all var(--fs-transition-base);
}
.btn:focus-visible { box-shadow: 0 0 0 .25rem rgba(0, 128, 96, .2); }

/* =========================================
   Global / Layout
   ========================================= */
html, body { height: 100%; margin: 0; padding: 0; }
body { background: var(--fs-neutral-50); }
.modern-body {
  font-family: var(--fs-font-sans);
  color: var(--fs-neutral-800);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Glassmorphism Utility */
.glass-card {
  background: var(--fs-glass-bg);
  backdrop-filter: blur(var(--fs-glass-blur));
  -webkit-backdrop-filter: blur(var(--fs-glass-blur));
  border: 1px solid var(--fs-glass-border);
  border-radius: var(--fs-radius-lg);
  box-shadow: var(--fs-glass-shadow);
}

/* =========================================
   Navbar
   ========================================= */
.modern-navbar {
  background: var(--fs-grad-brand);
  z-index: 2020;
}
.navbar .dropdown-menu {
  z-index: 2030;
  border-radius: var(--fs-radius-md);
  border: 1px solid var(--fs-neutral-200);
  box-shadow: var(--fs-shadow-lg);
}
.modern-navbar .navbar-brand {
  color: #fff;
  font-weight: 700;
  letter-spacing: -.01em;
  transition: color var(--fs-transition-fast);
}
.modern-navbar .navbar-brand:hover { color: var(--fs-green-100); }
.modern-navbar .nav-link {
  color: rgba(255, 255, 255, .88);
  font-weight: 500;
  transition: color var(--fs-transition-fast);
}
.modern-navbar .nav-link:hover,
.modern-navbar .nav-link:focus { color: #fff; }

/* =========================================
   Main, Tables, Cards
   ========================================= */
.modern-main { padding: var(--fs-space-md); }
@media (min-width: 768px) { .modern-main { padding: var(--fs-space-xl); } }

.modern-table thead th {
  font-size: .82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--fs-neutral-600);
}
.modern-table tbody tr { transition: background var(--fs-transition-fast); }
.modern-table tbody tr:hover td { background: var(--fs-neutral-50); }

.card {
  border-radius: var(--fs-radius-md);
  background: #fff;
  border: 1px solid var(--fs-neutral-200);
  box-shadow: var(--fs-shadow-xs);
}
.card-header {
  border-top-left-radius: var(--fs-radius-md);
  border-top-right-radius: var(--fs-radius-md);
}

/* Inputs */
.form-control,
.form-select {
  border-radius: var(--fs-radius-sm);
  border-color: var(--fs-neutral-300);
  transition: border-color var(--fs-transition-fast), box-shadow var(--fs-transition-fast);
}
.form-control:focus,
.form-select:focus {
  border-color: var(--fs-green-500);
  box-shadow: 0 0 0 .2rem rgba(0, 128, 96, .15);
}

/* =========================================
   Metric Cards
   ========================================= */
.modern-metric {
  background: #fff;
  border: 1px solid var(--fs-neutral-200);
  border-radius: var(--fs-radius-md);
  box-shadow: var(--fs-shadow-xs);
  transition: transform var(--fs-transition-base), box-shadow var(--fs-transition-base);
  cursor: default;
}
.modern-metric:hover {
  transform: translateY(-2px);
  box-shadow: var(--fs-shadow-md);
}
.metric-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fs-green-700);
  line-height: 1.2;
}
.metric-label {
  color: var(--fs-neutral-500);
  font-size: .82rem;
  font-weight: 500;
  margin-top: var(--fs-space-xs);
}

/* Gradient Utility */
.gradient-metric {
  background: var(--fs-grad-brand);
  color: #fff;
  border: none;
  padding: var(--fs-space-md);
}
.gradient-metric .metric-label { color: rgba(255, 255, 255, .7); }
.gradient-metric .metric-value { color: #fff; }

/* =========================================
   Pricing Container & Grid
   ========================================= */
.plans-container { max-width: 1200px; }

.plans-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: var(--fs-space-lg);
}
@media (min-width: 768px) {
  .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
  .plans-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =========================================
   Plan Cards
   ========================================= */
.plan-card {
  border-radius: var(--fs-radius-lg);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--fs-neutral-200);
  transition: transform var(--fs-transition-base), box-shadow var(--fs-transition-base), border-color var(--fs-transition-base);
  background: #fff;
}
.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--fs-shadow-lg);
  border-color: rgba(0, 128, 96, .2);
}

.plan-card-header {
  background: var(--fs-grad-brand);
  color: #fff;
  padding: var(--fs-space-md) var(--fs-space-lg);
  padding-left: 3.9rem;
}

.plan-card-active {
  border: 2px solid var(--fs-green-700);
  animation: planPulse 1.6s ease-in-out infinite alternate;
}
@keyframes planPulse {
  0%   { box-shadow: 0 0 0 rgba(0, 128, 96, .2); }
  100% { box-shadow: 0 0 18px rgba(0, 128, 96, .2); }
}

.plan-desc { line-height: 1.6; margin-bottom: var(--fs-space-md); }

.plan-features { margin: 0; padding: 0; list-style: none; }
.plan-feature {
  display: flex;
  gap: var(--fs-space-md);
  align-items: flex-start;
  padding: .35rem 0;
}
.plan-feature-icon {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--fs-green-700);
  margin-top: .1rem;
  flex: 0 0 auto;
}
.plan-feature-title { font-weight: 600; color: var(--fs-neutral-800); font-size: .95rem; }
.plan-feature-text  { color: var(--fs-neutral-500); font-size: .92rem; }

.plan-bottom { margin-top: var(--fs-space-md); }

.plan-price {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--fs-neutral-900);
  line-height: 1;
}
.plan-price-free {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--fs-green-700);
  line-height: 1;
}
.plan-price-sub {
  color: var(--fs-neutral-500);
  margin-top: .1rem;
  font-size: .9rem;
}

/* CTA Button */
.btn-choose-modern {
  background: var(--fs-grad-brand);
  color: #fff;
  border: none;
  border-radius: var(--fs-radius-sm);
  padding: .7rem 1.25rem;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 128, 96, .2);
  transition: transform var(--fs-transition-fast), box-shadow var(--fs-transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.btn-choose-modern:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 128, 96, .25);
  color: #fff;
}
.btn-choose-modern:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(0, 128, 96, .18);
}
.btn-choose-modern:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .25rem rgba(0, 128, 96, .2);
}
.btn-choose-modern.active,
.btn-choose-modern[disabled] {
  background: var(--fs-green-50);
  color: var(--fs-green-800);
  border: 1px solid var(--fs-green-200);
  box-shadow: none;
}

/* Badges */
.badge-beta {
  background: linear-gradient(135deg, #22c55e, #f59e0b);
  color: #0b1a13;
  border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05) inset;
}

/* Ribbon */
.ribbon {
  position: absolute;
  top: 14px;
  left: -34px;
  transform: rotate(-35deg);
  background: #22c55e;
  color: #073b2d;
  font-weight: 700;
  padding: .28rem 2.1rem;
  font-size: .78rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 420px) {
  .plan-card-header { padding-left: 3.4rem; }
  .ribbon { left: -30px; }
}

@media (max-width: 576px) {
  .plan-card-header h4 { font-size: 1.1rem; }
  .plan-feature-title { font-size: .92rem; }
  .plan-feature-text  { font-size: .9rem; }
  .btn-choose-modern  { width: 100%; justify-content: center; }
}

/* Pending Ribbon */
.ribbon-pending {
  position: absolute;
  top: 14px;
  left: -34px;
  transform: rotate(-35deg);
  background: #f59e0b;
  color: #1f1503;
  font-weight: 700;
  padding: .28rem 2.1rem;
  font-size: .78rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
  z-index: 2;
  pointer-events: none;
}
.plan-card-pending { border-color: rgba(245, 158, 11, .3); }

/* =========================================
   Button Loading State
   ========================================= */
.btn-loading {
  pointer-events: none;
  opacity: .65;
  position: relative;
}
.btn-loading .btn-label { visibility: hidden; }
.btn-loading .btn-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================
   Auth Pages (Login / Register)
   ========================================= */
.auth-split { min-height: 70vh; }
.auth-brand-panel {
  background: var(--fs-grad-hero);
  border-radius: var(--fs-radius-lg) 0 0 var(--fs-radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--fs-space-2xl) var(--fs-space-xl);
  color: #fff;
  text-align: center;
}
@media (max-width: 767.98px) {
  .auth-brand-panel {
    border-radius: var(--fs-radius-lg) var(--fs-radius-lg) 0 0;
    padding: var(--fs-space-xl) var(--fs-space-lg);
  }
}
