/*
 * Payogo Design System v2.0 — July 2026
 * "The Digital Private Bank" — deep teal primary, no decorative borders,
 *  tonal surface stacking, AI tertiary accent.
 * Single source of truth for all CSS tokens.
 *
 * Usage: <link rel="stylesheet" href="{{ url_for('static', filename='css/design-system.css') }}">
 */

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

/* ─── Design Tokens ─────────────────────────────────────────── */
:root {
  /* ── Primary — deep authoritative teal ── */
  --primary:              #00333c;
  --primary-dark:         #004b57;
  --on-primary:           #ffffff;
  --primary-container:    #004b57;
  --on-primary-container: #b2e8f0;
  --primary-gradient:     linear-gradient(135deg, #00333c 0%, #004b57 100%);

  /* ── Secondary — confirmation / success actions only ── */
  --secondary:              #006a62;
  --on-secondary:           #ffffff;
  --secondary-container:    #79f4e5;
  --on-secondary-container: #004a44;

  /* ── Tertiary — AI / intelligence accent only ── */
  --tertiary:             #33008e;
  --on-tertiary:          #ffffff;
  --tertiary-container:   #4c00c8;
  --on-tertiary-container:#ead7ff;

  /* ── Semantic ── */
  --success:  #10b981;
  --warning:  #f59e0b;
  --danger:   #ef4444;
  --info:     #3b82f6;

  /* ── Surface hierarchy — tonal stacking (no decorative borders) ──
     Use background shifts to create depth, not divider lines.         */
  --surface:          #f7f9ff;   /* base — widest background             */
  --surface-low:      #edf4ff;   /* elevated sections                    */
  --surface-container:#e7eefa;   /* main content panels (alias: section) */
  --surface-section:  #e7eefa;   /* backward-compat alias                */
  --surface-high:     #e1e9f4;   /* input fields, dense data rows        */
  --surface-card:     #ffffff;   /* cards / modals — max contrast / "pop"*/
  --surface-tint:     #2a6673;   /* focus ring color (ghost, 40% opacity)*/

  /* ── Text ── */
  --on-surface:         #141c24;   /* primary text — never pure black     */
  --on-surface-variant: #40484a;   /* secondary labels, metadata          */

  /* ── Outline ── */
  --border:          #bfc8ca;   /* ghost borders on interactive components */
  --outline-variant: #bfc8ca;   /* 15–30% opacity for non-interactive use  */

  /* ── AI card accent ── */
  --ai-bg:     linear-gradient(135deg, rgba(51,0,142,0.10), rgba(76,0,200,0.10));
  --ai-border: 1px solid rgba(76,0,200,0.20);

  /* ── Typography ── */
  --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Inter',   -apple-system, BlinkMacSystemFont, sans-serif;

  /* ── Spacing ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* ── Radius ── */
  --radius-sm:   4px;    /* tags, tight chips                        */
  --radius-md:   12px;   /* buttons, inputs, small cards             */
  --radius-lg:   16px;   /* standard cards                           */
  --radius-xl:   24px;   /* feature banners, hero sections           */
  --radius-full: 9999px; /* pills, avatars                           */

  /* ── Shadows — tinted with on-surface (#141c24), not pure black ── */
  --shadow-card:  0 1px 3px rgba(20,28,36,0.06), 0 1px 2px rgba(20,28,36,0.04);
  --shadow-modal: 0 8px 24px rgba(20,28,36,0.06);
  --shadow-btn:   0 4px 14px rgba(0,51,60,0.22);
}

/* ─── Base Reset ─────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--on-surface);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Typography Utilities ───────────────────────────────────── */
.display-lg {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.display-md {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1, .h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2, .h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h3, .h3 {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 600;
}

.body-lg  { font-size: 1.125rem; font-weight: 400; }
.body     { font-size: 1rem;     font-weight: 400; }
.body-sm  { font-size: 0.875rem; font-weight: 400; }
.label    { font-size: 0.75rem;  font-weight: 500; letter-spacing: 0.04em; }

/* Monetary / rate values — tabular numerics required */
.currency,
.amount,
.rate-value,
.balance {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  border: none;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  min-height: 44px;   /* accessibility touch target */
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(0,51,60,0.30);
}

.btn-gradient {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-btn);
}
.btn-gradient:hover {
  box-shadow: 0 6px 20px rgba(0,51,60,0.30);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--surface);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}
.btn-danger:hover { background: #dc2626; }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: none;
}
.btn-ghost:hover { background: rgba(0,51,60,0.08); }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Mobile full-width override */
@media (max-width: 480px) {
  .btn-block { width: 100%; padding: 14px 20px; }
}

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-xl);
}

@media (max-width: 768px) {
  .card { padding: var(--space-lg); }
}

/* ─── Input Fields ───────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.form-label {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-surface);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface-section);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--on-surface);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
}

.form-input::placeholder { color: var(--on-surface-variant); }

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* ─── AI Insight Card ────────────────────────────────────────── */
.ai-card {
  background: var(--ai-bg);
  border: var(--ai-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.ai-card-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--primary);
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
}

/* ─── Status Banners ─────────────────────────────────────────── */
.banner-info {
  background: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--info);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: #1e40af;
}

.banner-warning {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--warning);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: #92400e;
}

.banner-success {
  background: rgba(16, 185, 129, 0.08);
  border-left: 3px solid var(--success);
  padding: 12px 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: #065f46;
}

/* ─── Budget Progress Bars ───────────────────────────────────── */
.progress-track {
  background: var(--border);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.4s ease;
}

.progress-fill.warning { background: var(--warning); }
.progress-fill.danger  { background: var(--danger);  }

/* ─── Badge / Chip ───────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.6875rem;  /* 11px */
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  text-transform: uppercase;
}

.badge-success { background: var(--success); color: #ffffff; }
.badge-warning { background: var(--warning); color: #ffffff; }
.badge-danger  { background: var(--danger);  color: #ffffff; }
.badge-primary { background: var(--primary); color: #ffffff; }
.badge-info    { background: var(--info);    color: #ffffff; }

/* ─── Accessibility ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* Focus visible — never suppress outline without a replacement */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ─── Mobile Utilities ───────────────────────────────────────── */

/* Eliminate 300ms tap delay on interactive elements */
a, button, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent content from hiding behind the iOS notch / home bar */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Scrollable area that respects safe zones */
.scroll-area {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* ─── Responsive Container ───────────────────────────────────── */
.container-fluid {
  width: 100%;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

@media (min-width: 768px) {
  .container-fluid {
    padding-left: var(--space-xl);
    padding-right: var(--space-xl);
  }
}

/* ─── Visibility helpers ─────────────────────────────────────── */
@media (max-width: 767px)  { .hide-mobile  { display: none !important; } }
@media (min-width: 768px)  { .hide-desktop { display: none !important; } }
