/*
  FacturePro – UI Theme (Creative + Responsive + Pro)
  ---------------------------------------------------
  - Basé sur Bootstrap 5, avec un “design system” via CSS variables
  - Compatible Light/Dark (via data-bs-theme="dark")
  - Optimisé pour dashboard, tables, formulaires et modals
*/

:root {
  /* Brand */
  --fp-primary: #2563eb;
  --fp-primary-2: #7c3aed;
  --fp-accent: #f59e0b;

  /* Surfaces */
  --fp-bg: #f6f8ff;
  --fp-surface: #ffffff;
  --fp-surface-2: #f2f6ff;

  /* Text */
  --fp-text: #0f172a;
  --fp-muted: #64748b;

  /* Borders / shadows */
  --fp-border: rgba(15, 23, 42, 0.10);
  --fp-shadow-sm: 0 8px 18px rgba(2, 6, 23, 0.06);
  --fp-shadow-md: 0 14px 36px rgba(2, 6, 23, 0.10);

  /* Radius */
  --fp-radius: 16px;
  --fp-radius-sm: 12px;

  /* Focus ring */
  --fp-ring: 0 0 0 0.25rem rgba(37, 99, 235, 0.18);
}

/* Dark theme overrides (Bootstrap 5.3 uses data-bs-theme) */
body[data-bs-theme="dark"] {
  --fp-bg: #0b1220;
  --fp-surface: rgba(17, 24, 39, 0.92);
  --fp-surface-2: rgba(30, 41, 59, 0.45);
  --fp-text: #e5e7eb;
  --fp-muted: rgba(229, 231, 235, 0.75);
  --fp-border: rgba(148, 163, 184, 0.18);
  --fp-shadow-sm: 0 10px 22px rgba(0,0,0,0.35);
  --fp-shadow-md: 0 20px 46px rgba(0,0,0,0.45);
  --fp-ring: 0 0 0 0.25rem rgba(96, 165, 250, 0.18);
}

html, body {
  height: 100%;
}

body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--fp-bg);
  color: var(--fp-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  letter-spacing: -0.01em;
}

h1 {
  font-weight: 850;
}

h2 {
  font-weight: 800;
}

h3 {
  font-weight: 750;
}

.page-title {
  font-weight: 850;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--fp-muted);
}

/* Subtle background glow */
body::before {
  content: "";
  position: fixed;
  inset: -20% -20% auto -20%;
  height: 420px;
  z-index: -1;
  background: radial-gradient(closest-side at 25% 30%, rgba(37,99,235,0.25), transparent 70%),
              radial-gradient(closest-side at 70% 20%, rgba(124,58,237,0.20), transparent 70%),
              radial-gradient(closest-side at 55% 70%, rgba(245,158,11,0.12), transparent 70%);
  filter: blur(8px);
}

/* Global helpers */
.text-muted { color: var(--fp-muted) !important; }
.shadow-soft { box-shadow: var(--fp-shadow-sm) !important; }
.rounded-soft { border-radius: var(--fp-radius) !important; }

/* Navbar */
.navbar-pro {
  background: linear-gradient(135deg, #0ea5e9 0%, var(--fp-primary) 42%, var(--fp-primary-2) 100%);
  border-bottom: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.16);
}

.navbar-pro .navbar-brand {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.navbar-pro .navbar-brand .brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  margin-right: .55rem;
}

.navbar-pro .nav-link,
.navbar-pro .navbar-text {
  color: rgba(255,255,255,0.92) !important;
}

.navbar-pro .nav-link:hover {
  color: #fff !important;
}

.navbar-pro .dropdown-menu {
  border-radius: 16px;
  border: 1px solid var(--fp-border);
  box-shadow: var(--fp-shadow-md);
}

/* Page spacing */
.container,
.container-fluid {
  padding-left: 18px;
  padding-right: 18px;
}

/* Cards */
.card {
  border: 1px solid var(--fp-border);
  border-radius: var(--fp-radius);
  background: var(--fp-surface);
  box-shadow: var(--fp-shadow-sm);
}

.card-hover {
  transition: transform .15s ease, box-shadow .15s ease;
}
.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--fp-shadow-md);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--fp-border);
  font-weight: 650;
}

/* KPI cards (dashboard) */
.kpi-card {
  border: 1px solid var(--fp-border) !important;
  border-radius: var(--fp-radius) !important;
  box-shadow: var(--fp-shadow-sm) !important;
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.20);
  backdrop-filter: blur(8px);
}

.kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--fp-muted);
}

.kpi-value {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.section-title {
  font-weight: 800;
}

.badge-status {
  text-transform: capitalize;
}

body[data-bs-theme="dark"] .kpi-icon {
  background: rgba(255,255,255,0.10);
}

/* Buttons */
.btn {
  border-radius: 14px;
}

.btn-primary {
  border: none;
  background: linear-gradient(135deg, var(--fp-primary) 0%, var(--fp-primary-2) 100%);
  box-shadow: 0 10px 18px rgba(37,99,235,0.20);
}
.btn-primary:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
}

.btn-outline-primary {
  border-color: rgba(255,255,255,0.35);
}

.btn-soft {
  background: var(--fp-surface-2);
  border: 1px solid var(--fp-border);
  color: var(--fp-text);
}
.btn-soft:hover {
  filter: brightness(0.98);
}

/* Forms */
.form-control,
.form-select {
  border-radius: 14px;
  border-color: var(--fp-border);
  background: var(--fp-surface);
}

.input-group-text {
  border-radius: 14px;
  border-color: var(--fp-border);
  background: var(--fp-surface-2);
  color: var(--fp-text);
}

body[data-bs-theme="dark"] .input-group-text {
  background: rgba(30, 41, 59, 0.55);
}

body[data-bs-theme="dark"] .form-control,
body[data-bs-theme="dark"] .form-select {
  background: rgba(17, 24, 39, 0.90);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: var(--fp-ring);
}

/* Tables */
.table-responsive {
  border-radius: var(--fp-radius);
  border: 1px solid var(--fp-border);
  background: var(--fp-surface);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  background: rgba(37, 99, 235, 0.06);
  border-bottom: 1px solid var(--fp-border) !important;
  font-weight: 700;
}

body[data-bs-theme="dark"] .table thead th {
  background: rgba(96, 165, 250, 0.10);
}

.table-hover tbody tr:hover {
  background: rgba(37, 99, 235, 0.05);
}

/* Badges */
.badge {
  border-radius: 999px;
  padding: .45em .75em;
  font-weight: 650;
}

/* Alerts */
.alert {
  border-radius: var(--fp-radius);
  border: 1px solid var(--fp-border);
  box-shadow: var(--fp-shadow-sm);
}

/* Modals */
.modal-content {
  border-radius: var(--fp-radius);
  border: 1px solid var(--fp-border);
  box-shadow: var(--fp-shadow-md);
}

.modal-header {
  border-bottom: 1px solid var(--fp-border);
}

.modal-header.modal-header-pro {
  background: linear-gradient(135deg, #0ea5e9 0%, var(--fp-primary) 42%, var(--fp-primary-2) 100%);
  color: #fff;
  border-bottom: none;
}

.modal-header.modal-header-pro .btn-close {
  filter: invert(1);
  opacity: 0.85;
}

/* Subscription lock */
.subscription-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(4px);
  z-index: 1070;
  pointer-events: all;
}

.subscription-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1080;
  max-width: 460px;
  width: 92%;
  background: var(--fp-surface);
  border-radius: var(--fp-radius);
  padding: 1.75rem 1.65rem 1.85rem;
  box-shadow: var(--fp-shadow-md);
  border: 1px solid var(--fp-border);
  overflow: hidden;
}

.subscription-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side at 20% 20%, rgba(37,99,235,0.22), transparent 60%),
              radial-gradient(closest-side at 70% 0%, rgba(124,58,237,0.18), transparent 60%),
              radial-gradient(closest-side at 90% 90%, rgba(245,158,11,0.10), transparent 65%);
  pointer-events: none;
}

.subscription-panel > * { position: relative; }

.subscription-panel h5 {
  font-weight: 800;
}

.subscription-panel.subscription-panel-expired {
  border-left: 6px solid #ef4444;
}
.subscription-panel.subscription-panel-inactive,
.subscription-panel.subscription-panel-none {
  border-left: 6px solid #f59e0b;
}

body.subscription-lock {
  overflow: hidden !important;
}

/* WhatsApp floating button */
.whatsapp-float {
  position: fixed;
  width: 56px;
  height: 56px;
  bottom: 24px;
  right: 24px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  font-size: 28px;
  z-index: 9999;
  background: linear-gradient(135deg, #25D366 0%, #1ebe5d 100%);
  box-shadow: 0 16px 30px rgba(0,0,0,0.22);
  transition: transform .15s ease, filter .15s ease;
}

.whatsapp-float:hover {
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.03);
  color: #fff;
}

/* Small devices tweaks */
@media (max-width: 576px) {
  .container,
  .container-fluid {
    padding-left: 14px;
    padding-right: 14px;
  }
  .whatsapp-float {
    bottom: 18px;
    right: 18px;
  }
}

/* Auth pages (login / signup) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--fp-surface);
  border: 1px solid var(--fp-border);
  border-radius: calc(var(--fp-radius) + 4px);
  box-shadow: var(--fp-shadow-md);
  padding: 30px 26px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(closest-side at 15% 25%, rgba(37,99,235,0.18), transparent 60%),
              radial-gradient(closest-side at 80% 0%, rgba(124,58,237,0.16), transparent 55%),
              radial-gradient(closest-side at 95% 90%, rgba(245,158,11,0.10), transparent 60%);
  pointer-events: none;
}

.auth-card > * { position: relative; }

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--fp-text);
}

.auth-brand .auth-logo {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9 0%, var(--fp-primary) 42%, var(--fp-primary-2) 100%);
  box-shadow: 0 12px 22px rgba(2,6,23,0.16);
}

.auth-subtitle {
  color: var(--fp-muted);
}

/* Pricing / subscription UI */
.plan-pill {
  border-radius: 999px;
}

.plan-pill.active {
  background: linear-gradient(135deg, var(--fp-primary) 0%, var(--fp-primary-2) 100%);
  color: #fff;
  border-color: transparent;
}

.plan-pill.active span,
.plan-pill.active strong {
  color: #fff !important;
}

pre.whatsapp-text {
  white-space: pre-wrap;
  font-size: 0.85rem;
}

