/* ==========================================================================
   FLEXAPAY DESIGN SYSTEM - ROYAL INDIGO & GOLD
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Royal Indigo & Midnight Palette */
  --bg-darkest: #070913;
  --bg-dark: #0c1024;
  --bg-surface: #131938;
  --bg-surface-elevated: #1a224a;
  --bg-surface-glass: rgba(19, 25, 56, 0.75);
  --bg-card: #151c3f;
  --bg-card-hover: #1c2552;
  
  /* Gold & Amber Accents */
  --gold-primary: #f5b041;
  --gold-light: #fcd77f;
  --gold-dark: #d48f1f;
  --gold-glow: rgba(245, 176, 65, 0.25);
  --gold-gradient: linear-gradient(135deg, #fce08b 0%, #f5b041 50%, #d48f1f 100%);
  
  /* Secondary & Status Accents */
  --indigo-accent: #4f5eff;
  --indigo-light: #7c88ff;
  --indigo-glow: rgba(79, 94, 255, 0.2);
  --cyan-accent: #00d2d3;
  --emerald-success: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  --rose-danger: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.2);
  --amber-warning: #f59e0b;
  
  /* Text & Typography */
  --text-white: #ffffff;
  --text-primary: #f1f3f9;
  --text-secondary: #a3b0cc;
  --text-muted: #6a789a;
  --text-gold: #fce08b;
  
  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.14);
  --border-gold: rgba(245, 176, 65, 0.35);
  --border-gold-focus: #f5b041;
  
  /* Shadows & Depth */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 25px rgba(245, 176, 65, 0.2);
  
  /* Layout & Geometry */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   CSS RESET & GLOBAL STYLES
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-darkest);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Atmospheric Background Glows */
body::before {
  content: '';
  position: fixed;
  top: -15vw;
  left: 20%;
  width: 60vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(79, 94, 255, 0.12) 0%, rgba(12, 16, 36, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: 0;
  right: -10vw;
  width: 50vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(245, 176, 65, 0.08) 0%, rgba(12, 16, 36, 0) 70%);
  pointer-events: none;
  z-index: 0;
}

a {
  color: var(--gold-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--gold-light);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-white);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  color: var(--text-secondary);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==========================================================================
   CONTAINER & LAYOUT UTILITIES
   ========================================================================== */

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.container-narrow {
  max-width: 860px;
}

.section-padding {
  padding: 5.5rem 0;
}

@media (max-width: 768px) {
  .section-padding {
    padding: 3.5rem 0;
  }
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   BUTTONS & ACTIONS
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.6rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-normal);
  text-align: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn-primary {
  background: var(--gold-gradient);
  color: #070913;
  box-shadow: 0 4px 18px var(--gold-glow);
  font-weight: 700;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 176, 65, 0.4);
  color: #000;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-white);
  border-color: var(--border-medium);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-gold);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--gold-primary);
  border-color: var(--border-gold);
}

.btn-outline:hover {
  background: rgba(245, 176, 65, 0.1);
  color: var(--gold-light);
  border-color: var(--gold-primary);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 1rem 2.2rem;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

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

/* ==========================================================================
   CARDS & SURFACES
   ========================================================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all var(--transition-normal);
  position: relative;
}

.card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
}

.card-gold-border {
  border-color: var(--border-gold);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-4px);
  border-color: var(--border-gold);
  box-shadow: var(--shadow-gold);
}

/* ==========================================================================
   FORM CONTROLS & INPUTS
   ========================================================================== */

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-label .required {
  color: var(--gold-primary);
  margin-left: 2px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-white);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px var(--gold-glow);
  background: var(--bg-surface-elevated);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5b041' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-select option {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.form-error-msg {
  font-size: 0.8rem;
  color: var(--rose-danger);
  margin-top: 0.35rem;
  display: none;
}

.form-input.is-invalid,
.form-select.is-invalid {
  border-color: var(--rose-danger);
  box-shadow: 0 0 0 2px var(--rose-glow);
}

.form-input.is-invalid + .form-error-msg,
.form-select.is-invalid + .form-error-msg {
  display: block;
}

/* Tag / Chip Multi-select */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.tag-choice:hover {
  border-color: var(--border-gold);
  color: var(--text-white);
  background: var(--bg-surface-elevated);
}

.tag-choice.selected {
  background: rgba(245, 176, 65, 0.15);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  font-weight: 600;
}

/* Checkbox & Radio Custom styling */
.checkbox-label, .radio-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input, .radio-label input {
  margin-top: 0.25rem;
  accent-color: var(--gold-primary);
  width: 1.1rem;
  height: 1.1rem;
}

/* ==========================================================================
   POPIA & COMPLIANCE BADGES & NOTICES
   ========================================================================== */

.popia-notice-banner {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1.25rem 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #c0ebd7;
}

.popia-notice-banner svg {
  flex-shrink: 0;
  color: var(--emerald-success);
  margin-top: 2px;
}

.popia-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  color: #34d399;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-gold {
  background: rgba(245, 176, 65, 0.12);
  border: 1px solid rgba(245, 176, 65, 0.35);
  color: var(--gold-primary);
}

.badge-indigo {
  background: rgba(79, 94, 255, 0.12);
  border: 1px solid rgba(79, 94, 255, 0.35);
  color: var(--indigo-light);
}

/* ==========================================================================
   MODAL DIALOG
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 9, 19, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: transform var(--transition-smooth);
  position: relative;
}

.modal-backdrop.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-white);
  background: var(--bg-surface-elevated);
}

/* ==========================================================================
   PROGRESS BARS & GAUGES
   ========================================================================== */

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: var(--gold-gradient);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.progress-bar-indigo {
  background: linear-gradient(90deg, #4f5eff, #00d2d3);
}

.progress-bar-emerald {
  background: linear-gradient(90deg, #10b981, #34d399);
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  color: var(--text-white);
  font-size: 0.9rem;
  min-width: 320px;
  animation: slideInRight 0.3s ease forwards;
}

.toast.toast-success {
  border-color: var(--emerald-success);
}

.toast.toast-error {
  border-color: var(--rose-danger);
}

.toast.toast-warning {
  border-color: var(--amber-warning);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================================================
   NAVBAR & HEADER
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 500;
  background: rgba(12, 16, 36, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-white);
  letter-spacing: -0.03em;
}

.brand-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--gold-gradient);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #070913;
  font-weight: 900;
  box-shadow: 0 2px 10px var(--gold-glow);
}

.brand-logo span {
  color: var(--gold-primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text-white);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
}
