/* ==========================================================================
   PocketCue - Design System & Main CSS
   Teal: #0B5D5B (Primary / Buttons)
   Lime: #C6F432 (Secondary / Accents / Badges)
   Deep: #06302F (Third / Dark Brand / Hero Backgrounds)
   ========================================================================== */

:root {
  --bg-primary: #FFFFFF;
  --bg-secondary: #F4F8F8;
  --bg-card: #FFFFFF;
  --bg-input: #FFFFFF;
  
  --text-primary: #0C1E1D;
  --text-secondary: #4A6362;
  --text-muted: #849E9D;
  
  --border-color: #E2ECEB;
  --border-focus: #0B5D5B;
  
  /* PocketCue Brand Palette */
  --brand-primary: #0B5D5B;          /* Teal - Main buttons & primary brand */
  --brand-primary-hover: #074745;
  --brand-secondary: #C6F432;        /* Lime - Secondary actions, badges, accents */
  --brand-secondary-hover: #B4E320;
  --brand-secondary-text: #06302F;
  --brand-dark: #06302F;             /* Deep Teal - Dark headers & cards */
  --brand-light: #E8F7F6;            /* Soft teal tint */
  --brand-accent: #C6F432;
  --brand-coral: #FF6B57;
  
  --status-success: #10B981;
  --status-success-light: #ECFDF5;
  --status-warning: #F59E0B;
  --status-warning-light: #FFFBEB;
  --status-danger: #EF4444;
  --status-danger-light: #FEF2F2;
  --status-info: #0B5D5B;
  --status-info-light: #E8F7F6;

  --shadow-sm: 0 1px 2px 0 rgba(11, 93, 91, 0.05);
  --shadow-md: 0 4px 14px 0 rgba(6, 48, 47, 0.08);
  --shadow-lg: 0 10px 30px -3px rgba(6, 48, 47, 0.12);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-width-mobile: 480px;
  --max-width-desktop: 1080px;
}

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

html, body {
  min-height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Shell container */
.app-shell {
  max-width: var(--max-width-mobile);
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-primary);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(6, 48, 47, 0.06);
}

@media (min-width: 768px) {
  body {
    padding: 24px 0;
  }
  .app-shell {
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: calc(100vh - 48px);
    border: 1px solid var(--border-color);
  }
}

/* Header */
.app-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.logo-brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

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

img.logo-img, .logo-img {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  border-radius: 8px !important;
  object-fit: contain !important;
  display: inline-block !important;
  flex-shrink: 0 !important;
  box-shadow: 0 2px 6px rgba(6, 48, 47, 0.15);
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--brand-dark);
  color: var(--brand-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 2px 6px rgba(6, 48, 47, 0.15);
}

/* Main Content Area */
.page-content {
  flex: 1;
  padding: 20px 20px 96px 20px;
}

.page-content-auth {
  padding: 32px 20px;
}

/* Typography & Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--brand-dark);
  margin-bottom: 4px;
}

.page-subtitle {
  font-size: 0.925rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* Cards & Containers */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card-soft {
  background: var(--bg-secondary);
  border: 1px solid transparent;
}

/* Hero / Balance Cards with Deep Teal + Lime accents */
.card-hero {
  background: linear-gradient(135deg, #06302F 0%, #0B5D5B 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: 0 8px 24px rgba(6, 48, 47, 0.25);
  position: relative;
  overflow: hidden;
}

.card-hero::after {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(198, 244, 50, 0.2) 0%, rgba(198, 244, 50, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.card-hero h1, .card-hero h2, .card-hero h3, .card-hero p {
  color: #FFFFFF;
}

.card-hero .accent-lime {
  color: #C6F432;
  font-weight: 800;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  font-size: 0.975rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  min-height: 48px;
}

.btn:active {
  transform: scale(0.98);
}

/* Primary Teal Button */
.btn-primary {
  background-color: var(--brand-primary);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(11, 93, 91, 0.25);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  color: #FFFFFF;
}

/* Secondary Lime Button */
.btn-secondary, .btn-lime {
  background-color: var(--brand-secondary);
  color: var(--brand-secondary-text);
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(198, 244, 50, 0.3);
}

.btn-secondary:hover, .btn-lime:hover {
  background-color: var(--brand-secondary-hover);
  color: var(--brand-secondary-text);
}

/* Deep Third Dark Button */
.btn-dark {
  background-color: var(--brand-dark);
  color: #FFFFFF;
  border-color: transparent;
}

.btn-dark:hover {
  background-color: #04201F;
}

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

.btn-outline:hover {
  background-color: var(--brand-light);
}

.btn-google {
  background-color: #FFFFFF;
  color: #374151;
  border: 1px solid #D1D5DB;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-google:hover {
  background-color: #F9FAFB;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  min-height: 36px;
  border-radius: var(--radius-sm);
  width: auto;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

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

.form-hint {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 48px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.input-money-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-money-prefix {
  position: absolute;
  left: 16px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand-primary);
  pointer-events: none;
}

.input-money {
  padding-left: 36px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Alerts & Notices */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-danger {
  background-color: var(--status-danger-light);
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.alert-success {
  background-color: var(--status-success-light);
  color: #047857;
  border: 1px solid #A7F3D0;
}

.alert-info {
  background-color: var(--brand-light);
  color: var(--brand-dark);
  border: 1px solid #B8E4E2;
}

/* Divider with text */
.divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.divider:not(:empty)::before {
  margin-right: 12px;
}

.divider:not(:empty)::after {
  margin-left: 12px;
}

/* Bottom Navigation Bar */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width-mobile);
  height: 64px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 50;
  padding: 0 8px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 0.725rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  flex: 1;
  height: 100%;
  transition: color 0.15s ease;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
}

.nav-item.active {
  color: var(--brand-primary);
  font-weight: 700;
}

.nav-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
}

.nav-fab-btn {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(11, 93, 91, 0.4);
  transition: transform 0.15s ease, background-color 0.15s ease;
  margin-top: -16px;
  text-decoration: none;
}

.nav-fab-btn:active {
  transform: scale(0.92);
}

.nav-fab-btn svg {
  width: 24px;
  height: 24px;
  stroke: #FFFFFF;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-lime {
  background: var(--brand-secondary);
  color: var(--brand-dark);
  font-weight: 700;
}

.badge-teal {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 700;
}

.badge-due-today {
  background: #FEF2F2;
  color: #DC2626;
  font-weight: 700;
}

.badge-due-soon {
  background: var(--status-warning-light);
  color: #B45309;
}

.badge-upcoming {
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.badge-paid {
  background: var(--status-success-light);
  color: var(--status-success);
}

.badge-overdue {
  background: #FEF2F2;
  color: #DC2626;
  font-weight: 700;
}

/* Utility Helpers */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ==========================================================================
   Modals & Bottom Sheets (Points 14, 19, 21)
   ========================================================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(6, 48, 47, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  align-items: flex-end;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.24s;
  padding: 0;
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-sheet {
  background: var(--bg-card);
  width: 100%;
  max-width: var(--max-width-mobile);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 20px)) 20px;
  box-shadow: 0 -10px 40px rgba(6, 48, 47, 0.25);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 88vh;
  overflow-y: auto;
  border-top: 1px solid var(--border-color);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }
  .modal-sheet {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 50px rgba(6, 48, 47, 0.2);
    transform: scale(0.94);
    max-height: 85vh;
  }
  .modal-overlay.active .modal-sheet {
    transform: scale(1);
  }
}

/* Bank / Account Chips */
.bank-chips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.bank-chip-btn {
  padding: 10px 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-card);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bank-chip-btn:hover {
  border-color: var(--brand-primary);
}

.bank-chip-btn.selected {
  border-color: var(--brand-primary);
  background: var(--brand-light);
  color: var(--brand-primary);
}

.account-pill-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  transition: transform 0.15s ease;
}
