/* ============================================
   ATM — Main Styles (Pratham Branding)
   ============================================ */

/* Google Font Import — full weight range for variable use */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* CSS Variables — ATM Brand Colors (Dark Glassmorphism Theme) */
:root {
  /* Primary: ATM Gold/Amber — brand identity kept */
  --color-primary: #F5B642;
  --color-primary-dark: #E5A632;
  --color-primary-light: rgba(245, 182, 66, 0.18);
  --color-primary-lighter: rgba(245, 182, 66, 0.08);

  /* Secondary: Dark base (used for button text etc.) */
  --color-secondary: #1A1A1A;
  --color-secondary-light: #2D2D2D;

  /* Violet accent for interactive highlights */
  --color-accent: #7C3AED;
  --color-accent-light: rgba(124, 58, 237, 0.18);

  /* Status colors */
  --color-success: #10B981;
  --color-success-light: rgba(16, 185, 129, 0.18);
  --color-warning: #F59E0B;
  --color-warning-light: rgba(245, 158, 11, 0.18);
  --color-error: #EF4444;
  --color-error-light: rgba(239, 68, 68, 0.18);

  /* Dark Palette */
  --color-white: #FFFFFF;
  --color-bg: #0F0C29;
  --color-bg-alt: #1A1730;
  --color-bg-mid: #201D3A;
  --color-surface: rgba(255, 255, 255, 0.06);
  --color-surface-raised: rgba(255, 255, 255, 0.10);
  --color-border: rgba(255, 255, 255, 0.12);
  --color-border-light: rgba(255, 255, 255, 0.06);
  --color-text: #F8FAFC;
  --color-text-secondary: rgba(248, 250, 252, 0.70);
  --color-text-muted: rgba(248, 250, 252, 0.45);

  /* Typography — slightly larger scale for readability on all screens */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-xs: 0.8125rem;
  --font-size-sm: 0.9375rem;
  --font-size-base: 1.0625rem;
  --font-size-lg: 1.1875rem;
  --font-size-xl: 1.3125rem;
  --font-size-2xl: 1.625rem;
  --font-size-3xl: clamp(1.625rem, 4vw, 2.125rem);
  --font-size-4xl: clamp(2.125rem, 5vw, 3.5rem);

  /*
   * Semantic roles — use across all screens for uniform hierarchy
   * (maps to the scale above; change here to retune globally)
   */
  --font-label: var(--font-size-lg);
  --font-label-group: var(--font-size-xl);
  --font-body: var(--font-size-base);
  --font-caption: var(--font-size-sm);
  --font-meta: var(--font-size-xs);
  --font-screen-title: var(--font-size-3xl);
  --font-screen-title-compact: clamp(1.375rem, 4vw, 1.75rem);
  --font-screen-subtitle: var(--font-size-lg);
  --font-auth-headline: var(--font-size-2xl);
  --font-heading-h2: var(--font-size-2xl);
  --font-heading-h3: var(--font-size-xl);
  --font-card-title: clamp(1.125rem, 2.2vw, 1.375rem);
  --font-card-title-emphasis: var(--font-size-2xl);
  --font-card-subtitle: var(--font-body);
  --font-card-subtitle-large: var(--font-size-lg);

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

  /* Border radius — generous rounded corners */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1.25rem;
  --radius-2xl: 2rem;
  --radius-full: 9999px;

  /* Shadows — color-tinted for depth */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --shadow-card-hover: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(245, 182, 66, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  --shadow-primary-glow: 0 4px 20px rgba(245, 182, 66, 0.4);
  --shadow-primary-glow-lg: 0 8px 30px rgba(245, 182, 66, 0.6);
  --shadow-violet-glow: 0 8px 32px rgba(124, 58, 237, 0.25);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
}

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

html {
  font-size: 16px;
  height: 100%;
  /* Lock viewport: scroll only inside #main-content, not the document (avoids
     double scrollbars / stray window scrollbar when flex + fonts differ by a few px) */
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Smooth scrolling for anchor links */
  scroll-behavior: smooth;
  /* Native form controls (select dropdown list on Windows/Chrome) use dark UI */
  color-scheme: dark;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--color-text);
  background: linear-gradient(135deg, #0F0C29, #302B63, #24243e);
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
  overflow-y: hidden;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Floating ambient orbs */
body::before {
  content: '';
  position: fixed;
  top: -200px;
  left: -150px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.14) 0%, transparent 70%);
  border-radius: 50%;
  animation: orbPulse 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(245, 182, 66, 0.09) 0%, transparent 70%);
  border-radius: 50%;
  animation: orbPulse 10s ease-in-out infinite 3s;
  pointer-events: none;
  z-index: 0;
}

@keyframes orbPulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.15); opacity: 1; }
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  background: transparent;
  position: relative;
  overflow-x: hidden;
  overflow-y: hidden;
  margin: 0;
  contain: layout style;
}

/* Header */
#app-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: var(--space-md) var(--space-lg);
  background: rgba(15, 12, 41, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 60px;
  flex-shrink: 0;
  gap: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text);
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 12px rgba(245, 182, 66, 0.15);
}

#btn-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text);
}

#btn-back:hover {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 12px rgba(245, 182, 66, 0.15);
}

#btn-back svg {
  width: 20px;
  height: 20px;
}

.header-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-primary-dark);
  flex: 1;
  text-align: center;
}

/* Brand name next to logo — hidden on mobile, shown on desktop via responsive.css */
.header-brand-name {
  display: none;
}

/* Center area between logo and menu button — hidden on mobile */
.header-center-area {
  display: none;
  flex: 1;
  align-items: center;
  padding: 0 var(--space-xl);
  overflow: hidden;
}

.header-page-tagline {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header user chip — hidden on mobile, shown on desktop via responsive.css */
.header-user-chip {
  display: none;
}

/* Desktop-only sidebar items — hidden on mobile */
.nav-desktop-only {
  display: none;
}

/* Sidebar bottom actions container */
.nav-bottom-actions {
  display: none;
}

/* Individual sidebar action buttons (About, Sign Out) */
.nav-action-item {
  display: none;
}

.header-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none; /* Allow clicks to pass through to underlying elements */
}

#btn-menu {
  margin-left: auto; /* Push menu button to the right on mobile */
  flex-shrink: 0;
}

/* Dropdown Menu */
.dropdown-menu {
  position: absolute;
  top: 60px;
  right: var(--space-md);
  background: rgba(20, 17, 46, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  min-width: 210px;
  z-index: 200;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.10);
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dropdown-menu.hidden {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px var(--space-lg);
  cursor: pointer;
  transition: background var(--transition-fast);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.07);
}

.menu-item svg {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.menu-item-logout {
  color: #FCA5A5 !important;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: var(--space-xs);
  padding-top: 12px;
}

.menu-item-logout svg {
  color: #FCA5A5 !important;
}

.menu-item-logout:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

.menu-item-danger {
  color: #FCA5A5 !important;
}

.menu-item-danger svg {
  color: #FCA5A5 !important;
}

.menu-item-danger:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

.menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: var(--space-xs) 0;
}

/* Bottom Navigation */
.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: var(--space-sm) 0;
  padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom));
  background: rgba(15, 12, 41, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  flex-shrink: 0;
}

/* No pseudo footer in nav (copyright removed app-wide) */
#bottom-nav::after {
  content: none !important;
  display: none !important;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-sm) var(--space-lg);
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(248, 250, 252, 0.72);
  transition: all var(--transition-fast);
  border-radius: var(--radius-lg);
  position: relative;
  font-size: var(--font-size-base);
  font-weight: 500;
}

.nav-item:hover {
  color: var(--color-text-secondary);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item.active svg {
  stroke-width: 2.5;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  box-shadow: 0 0 8px rgba(245, 182, 66, 0.6);
}

.nav-item span {
  font-size: inherit;
  font-weight: 500;
}

/* Main Content - adjust for bottom nav */
#main-content {
  flex: 1;
  padding: var(--space-lg);
  padding-bottom: calc(var(--space-lg) + 80px);
  max-width: 100%;
  margin: 0 auto;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
  min-height: 0;
}

/* Empty main-content placeholder — dark shimmer */
#main-content:empty::after {
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.06) 50%,
    rgba(255,255,255,0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xl);
  opacity: 0.8;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Typography */
h1 {
  font-size: var(--font-screen-title);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

h2 {
  font-size: var(--font-heading-h2);
  font-weight: 600;
  line-height: 1.3;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

h3 {
  font-size: var(--font-heading-h3);
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-text);
}

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

.subtitle {
  font-size: var(--font-body);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Screen wrapper */
.screen {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Screen Header Block */
.screen-header {
  text-align: center;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.screen-header h1 {
  margin-bottom: var(--space-xs);
}

.screen-header .subtitle {
  margin-bottom: 0;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 14px 24px;
  font-family: var(--font-family);
  font-size: var(--font-body);
  font-weight: 600;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn svg,
.btn .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Primary Button — gold gradient */
.btn-primary {
  background: linear-gradient(135deg, #F5B642, #F97316);
  color: #1A1A1A;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-primary-glow);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-primary-glow-lg);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.97) translateY(0);
}

/* Secondary Button — frosted glass */
.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: var(--color-text);
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  padding: 12px 20px;
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-text);
  border-color: rgba(255, 255, 255, 0.10);
}

/* Destructive Button */
.btn-destructive {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
  border-radius: var(--radius-full);
}

.btn-destructive:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
}

/* Success Button */
.btn-success {
  background: linear-gradient(135deg, #10B981, #059669);
  color: white;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-success:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.5);
  transform: translateY(-2px);
}

/* Danger Button */
.btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

.btn-danger:hover:not(:disabled) {
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.5);
  transform: translateY(-2px);
}

/* Button Sizes */
.btn-sm {
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-lg);
}

.btn-lg {
  padding: 18px 32px;
  font-size: var(--font-label);
}

.btn-block {
  width: 100%;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Icon Button */
.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-xl);
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-2xl);
  padding: var(--space-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.card-clickable {
  cursor: pointer;
}

.card-clickable:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}

.card-clickable.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
  box-shadow: 0 0 0 2px rgba(245, 182, 66, 0.4), var(--shadow-primary-glow);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(245, 182, 66, 0.25), rgba(249, 115, 22, 0.20));
  border-radius: var(--radius-xl);
  flex-shrink: 0;
  border: 1px solid rgba(245, 182, 66, 0.25);
}

.card-icon svg {
  width: 26px;
  height: 26px;
  color: #F5B642;
}

.card-icon.accent {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(99, 102, 241, 0.20));
  border-color: rgba(124, 58, 237, 0.3);
}

.card-icon.accent svg {
  color: #A78BFA;
}

.card-icon.success {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.20));
  border-color: rgba(16, 185, 129, 0.3);
}

.card-icon.success svg {
  color: #34D399;
}

.card-content {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.card-body {
  margin-top: var(--space-md);
  color: var(--color-text-secondary);
  font-size: var(--font-size-sm);
}

.card-footer {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.card-badge.primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-color: rgba(245, 182, 66, 0.3);
}

/* ============================================
   Forms
   ============================================ */

.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--font-label);
  font-weight: 600;
  color: rgba(248, 250, 252, 0.85);
  margin-bottom: var(--space-sm);
  letter-spacing: 0.01em;
}

.form-label .required {
  color: var(--color-error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-family);
  font-size: var(--font-body);
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.20);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.20), 0 0 0 3px rgba(245, 182, 66, 0.20);
  background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
  color: rgba(248, 250, 252, 0.40);
}

.form-input.error,
.form-select.error {
  border-color: var(--color-error);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.20), 0 0 0 3px rgba(239, 68, 68, 0.20);
}

.form-select {
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23F8FAFC' 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 14px center;
  background-size: 18px;
  padding-right: 44px;
  cursor: pointer;
}

/* Dropdown list: browsers that style <option> (fixes light-on-white when native list is light) */
.form-select option {
  background-color: var(--color-bg-alt);
  color: var(--color-text);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
  border-radius: var(--radius-xl);
}

.form-hint {
  font-size: var(--font-caption);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
}

.form-error {
  font-size: var(--font-caption);
  color: var(--color-error);
  margin-top: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Form Row (two columns) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   Toggle Group (Modern Segmented Control)
   ============================================ */

.toggle-group {
  display: flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-xl);
  padding: 4px;
  gap: 4px;
}

.toggle-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.toggle-option:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.06);
}

.toggle-option.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.toggle-option svg {
  width: 22px;
  height: 22px;
}

.toggle-option .toggle-label {
  font-weight: 600;
}

.toggle-option .toggle-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ============================================
   Chips / Pills
   ============================================ */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(248, 250, 252, 0.80);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-lighter);
  color: var(--color-primary);
}

.chip.selected {
  background: rgba(245, 182, 66, 0.15);
  color: var(--color-primary);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px rgba(245, 182, 66, 0.3);
}

.chip.selected svg {
  color: var(--color-primary);
}

.chip svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Info Tooltip
   ============================================ */

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--color-bg);
  border-radius: var(--radius-full);
  cursor: help;
  position: relative;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
}

.info-icon:hover {
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 14px;
  background: var(--color-secondary);
  color: white;
  font-size: var(--font-size-sm);
  font-weight: 400;
  border-radius: var(--radius-lg);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  z-index: 100;
  max-width: 250px;
  white-space: normal;
  text-align: left;
  line-height: 1.4;
}

.tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--color-secondary);
}

.info-icon:hover .tooltip {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   Utilities
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-sm { font-size: var(--font-caption); }
.text-lg { font-size: var(--font-label); }
.text-xl { font-size: var(--font-label-group); }

/* Semantic aliases — prefer in templates where helpful */
.type-label { font-size: var(--font-label); font-weight: 600; }
.type-label-group { font-size: var(--font-label-group); font-weight: 700; }
.type-body { font-size: var(--font-body); }
.type-caption { font-size: var(--font-caption); color: var(--color-text-muted); }
.type-meta { font-size: var(--font-meta); color: var(--color-text-muted); }

.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.w-full { width: 100%; }

.hidden { display: none !important; }

/* Micro-interactions */
.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Keyboard focus ring — gold */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Divider */
.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: var(--space-lg) 0;
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ============================================
   Loading States
   ============================================ */

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  z-index: 1000;
}

.loading-text {
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* Page Loader Overlay */
#main-content {
  position: relative; /* Required for absolute positioned loader */
}

.page-loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.page-loader-overlay.page-loader-show {
  opacity: 1;
  pointer-events: auto;
}

.page-loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.page-loader-message {
  color: var(--color-text-secondary);
  font-size: var(--font-size-base);
  font-weight: 500;
  text-align: center;
}

/* ============================================
   Responsive (Base - Additional styles in responsive.css)
   ============================================ */

@media (max-width: 480px) {
  :root {
    --font-size-3xl: 1.75rem;
    --font-size-2xl: 1.375rem;
  }
  
  #main-content {
    padding: var(--space-md);
  }
  
  .btn-lg {
    padding: 16px 24px;
  }
  
  .card {
    padding: var(--space-md);
  }
}
