/**
 * public/assets/css/app.css
 *
 * DESIGN SYSTEM - loaded after Bootstrap's CDN stylesheet, so it
 * can override Bootstrap 5.3's CSS custom properties (--bs-*).
 * Bootstrap 5.3 generates buttons/badges/alerts/links etc. from
 * these root-level variables via live var() references, NOT
 * baked-in hex values -- so redefining them here cascades the new
 * palette through every view already built (bg-success, btn-primary,
 * badge bg-danger, text-success, etc.) without editing those files.
 *
 * Palette rationale:
 *   Indigo (primary)  - modern, trustworthy, distinct from the
 *                        generic Bootstrap blue every template uses.
 *   Emerald (success)  - "paid" reads as money received at a glance.
 *   Amber (warning)    - pending / partially paid.
 *   Rose (danger)      - overdue / cancelled / failed.
 *   Sky (info)         - sent / neutral informational state.
 *   Slate (neutrals)   - cooler, more premium than default grays.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ---- Brand: Indigo ---- */
  --bs-primary: #4F46E5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-primary-text-emphasis: #3730A3;
  --bs-primary-bg-subtle: #EEF2FF;
  --bs-primary-border-subtle: #C7D2FE;
  --bs-link-color: #4F46E5;
  --bs-link-color-rgb: 79, 70, 229;
  --bs-link-hover-color: #4338CA;
  --bs-link-hover-color-rgb: 67, 56, 202;

  /* ---- Success: Emerald ---- */
  --bs-success: #10B981;
  --bs-success-rgb: 16, 185, 129;
  --bs-success-text-emphasis: #047857;
  --bs-success-bg-subtle: #ECFDF5;
  --bs-success-border-subtle: #A7F3D0;

  /* ---- Warning: Amber ---- */
  --bs-warning: #F59E0B;
  --bs-warning-rgb: 245, 158, 11;
  --bs-warning-text-emphasis: #B45309;
  --bs-warning-bg-subtle: #FFFBEB;
  --bs-warning-border-subtle: #FDE68A;

  /* ---- Danger: Rose ---- */
  --bs-danger: #E11D48;
  --bs-danger-rgb: 225, 29, 72;
  --bs-danger-text-emphasis: #9F1239;
  --bs-danger-bg-subtle: #FFF1F2;
  --bs-danger-border-subtle: #FECDD3;

  /* ---- Info: Sky ---- */
  --bs-info: #0EA5E9;
  --bs-info-rgb: 14, 165, 233;
  --bs-info-text-emphasis: #0369A1;
  --bs-info-bg-subtle: #F0F9FF;
  --bs-info-border-subtle: #BAE6FD;

  /* ---- Neutrals: Slate ---- */
  --bs-secondary: #64748B;
  --bs-secondary-rgb: 100, 116, 139;
  --bs-light: #F8FAFC;
  --bs-light-rgb: 248, 250, 252;
  --bs-dark: #0F172A;
  --bs-dark-rgb: 15, 23, 42;
  --bs-body-color: #1E293B;
  --bs-body-color-rgb: 30, 41, 59;
  --bs-body-bg: #F8FAFC;
  --bs-body-bg-rgb: 248, 250, 252;
  --bs-border-color: #E2E8F0;
  --bs-secondary-color: #64748B;
  --bs-tertiary-bg: #F1F5F9;
  --bs-tertiary-color: #94A3B8;
  --bs-emphasis-color: #0F172A;

  /* ---- Typography ---- */
  --bs-body-font-family: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-heading-color: #0F172A;

  /* ---- Shape ---- */
  --bs-border-radius: 0.625rem;
  --bs-border-radius-sm: 0.5rem;
  --bs-border-radius-lg: 0.875rem;
  --bs-border-radius-xl: 1.25rem;
  --bs-border-radius-pill: 50rem;

  /* ---- Custom tokens (not part of Bootstrap's API) ---- */
  --app-shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --app-shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --app-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --app-shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12), 0 4px 8px rgba(15, 23, 42, 0.04);
  --app-gradient-brand: linear-gradient(135deg, #4F46E5 0%, #6366F1 50%, #7C3AED 100%);
  --app-gradient-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
}

/* ============================================================
   BASE
   ============================================================ */

html { scroll-behavior: smooth; }

body {
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--bs-heading-color);
}

.text-muted { color: #64748B !important; }

a { text-decoration: none; }
a:hover { text-decoration: none; }

::selection { background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; border: 2px solid #F8FAFC; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--app-shadow-sm);
  border-radius: var(--bs-border-radius-lg);
}

.card-header {
  font-weight: 600;
  font-size: 0.875rem;
  color: #334155;
  border-bottom: 1px solid var(--bs-border-color);
  padding: 0.9rem 1.1rem;
}

.card-body { padding: 1.25rem; }
.card-footer { border-top: 1px solid var(--bs-border-color); padding: 0.9rem 1.1rem; }

.shadow-sm { box-shadow: var(--app-shadow-sm) !important; }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.005em;
  border-radius: var(--bs-border-radius);
  padding: 0.5rem 1rem;
  transition: all 0.15s ease;
}

.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }

.btn-primary {
  --bs-btn-bg: var(--bs-primary);
  --bs-btn-border-color: var(--bs-primary);
  --bs-btn-hover-bg: #4338CA;
  --bs-btn-hover-border-color: #4338CA;
  --bs-btn-active-bg: #3730A3;
  --bs-btn-active-border-color: #3730A3;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover { box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3); transform: translateY(-1px); }

.btn-outline-secondary {
  --bs-btn-color: #475569;
  --bs-btn-border-color: #CBD5E1;
  --bs-btn-hover-bg: #F1F5F9;
  --bs-btn-hover-border-color: #94A3B8;
  --bs-btn-hover-color: #1E293B;
}

.btn-outline-danger:hover { transform: translateY(-1px); }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  font-weight: 600;
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
  padding: 0.35em 0.65em;
  border-radius: var(--bs-border-radius-pill);
}

/* ============================================================
   NAVBAR (authenticated shell)
   ============================================================ */

.app-navbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--bs-border-color);
  padding: 0.65rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  backdrop-filter: saturate(180%) blur(8px);
}

.app-brand {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  color: #0F172A !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--app-gradient-brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
}

.app-subnav {
  background: #FFFFFF;
  border-bottom: 1px solid var(--bs-border-color);
}

.app-subnav .nav-link {
  color: #64748B;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  white-space: nowrap;
}

.app-subnav .nav-link:hover { color: #4F46E5; }

.app-subnav .nav-link.active,
.app-subnav .nav-link[aria-current="page"] {
  color: #4F46E5 !important;
  background: transparent !important;
  border-bottom-color: #4F46E5;
}

.app-subnav .nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.app-subnav .nav::-webkit-scrollbar { display: none; }

/* ============================================================
   STAT CARDS (dashboard)
   ============================================================ */

.stat-card {
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-lg);
  background: #fff;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--app-shadow-sm);
  position: relative;
  overflow: hidden;
  height: 100%;
}

.stat-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.stat-card-icon.bg-brand { background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
.stat-card-icon.bg-emerald { background: var(--bs-success-bg-subtle); color: var(--bs-success); }
.stat-card-icon.bg-amber { background: var(--bs-warning-bg-subtle); color: #B45309; }
.stat-card-icon.bg-rose { background: var(--bs-danger-bg-subtle); color: var(--bs-danger); }

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94A3B8;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0F172A;
}

/* ============================================================
   TABLES
   ============================================================ */

.table {
  --bs-table-hover-bg: #F8FAFC;
  font-size: 0.875rem;
}

.table thead th {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94A3B8;
  border-bottom-width: 1px;
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
  background: #FAFBFC;
}

.table td { vertical-align: middle; padding-top: 0.75rem; padding-bottom: 0.75rem; }
.table a { color: #1E293B; font-weight: 600; }
.table a:hover { color: var(--bs-primary); }

/* ============================================================
   FORMS
   ============================================================ */

.form-control, .form-select {
  border-color: #CBD5E1;
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--bs-border-radius-sm);
}

.form-control:focus, .form-select:focus {
  border-color: #A5B4FC;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.form-label {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #334155;
  margin-bottom: 0.35rem;
}

/* ============================================================
   AUTH PAGES (guest layout)
   ============================================================ */

.auth-shell {
  min-height: 100vh;
  display: flex;
}

.auth-brand-panel {
  background: var(--app-gradient-brand);
  color: #fff;
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 3rem;
  position: relative;
  overflow: hidden;
}

.auth-brand-panel::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  top: -150px;
  right: -150px;
}

.auth-brand-panel::after {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  bottom: -100px;
  left: -80px;
}

@media (min-width: 992px) {
  .auth-brand-panel { display: flex; flex: 0 0 42%; }
}

.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  background: #F8FAFC;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state { text-align: center; padding: 3.5rem 1.5rem; }

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--bs-primary-bg-subtle);
  color: var(--bs-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

/* ============================================================
   PUBLIC INVOICE / RECEIPT PAGES
   ============================================================ */

.public-page-bg {
  background: linear-gradient(180deg, #EEF2FF 0%, #F8FAFC 280px);
  min-height: 100vh;
}

.public-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem;
  border-radius: 50rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.public-total-display {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0F172A;
}

.pay-now-btn {
  background: var(--app-gradient-brand);
  border: none;
  font-size: 1rem;
  padding: 0.85rem;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.pay-now-btn:hover { box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45); transform: translateY(-1px); }

/* ============================================================
   MISC
   ============================================================ */

.dropdown-menu {
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--app-shadow-md);
  border-radius: var(--bs-border-radius);
  padding: 0.4rem;
}

.dropdown-item { border-radius: var(--bs-border-radius-sm); font-size: 0.875rem; padding: 0.5rem 0.75rem; }
.dropdown-item:active { background: var(--bs-primary); }

.alert { border-radius: var(--bs-border-radius); border: 1px solid; font-size: 0.875rem; }

code {
  background: #F1F5F9;
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.8125rem;
  color: #475569;
}

@media (max-width: 576px) {
  .card-body { padding: 1rem; }
  .stat-value, .public-total-display { font-size: 1.5rem; }
  h1.h4 { font-size: 1.15rem; }
}
