/* ==========================================================================
   GymFee — Master Design System (Mobile-First CSS)
   Brand Identity: Premium Emerald Green (#00965A) & Clean White
   ========================================================================== */

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

:root {
  /* Brand Colors */
  --primary: #00965A;
  --primary-hover: #007D4B;
  --primary-active: #00633B;
  --primary-dark: #00633B;
  --primary-light: #E8F8F1;
  --primary-subtle: #F0FDF7;
  --primary-gradient: linear-gradient(135deg, #00965A 0%, #00B36B 100%);
  
  /* WhatsApp Brand Green */
  --whatsapp: #25D366;
  --whatsapp-hover: #1EBE5D;
  --whatsapp-light: #E7F9EE;

  /* Neutral Dark Charcoal & Text */
  --text-main: #1A202C;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --text-light: #A0AEC0;
  --text-inverse: #FFFFFF;
  --text-primary: var(--text-main);
  --color-primary: var(--primary);
  --text-color: var(--text-main);

  /* Surfaces & Backgrounds */
  --bg-app: #F7FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #F8FAFC;
  --bg-muted: #EDF2F7;
  --bg-hover: var(--bg-muted);
  --bg-card: var(--bg-surface);

  /* Borders & Dividers */
  --border-color: #E2E8F0;
  --border-light: #EDF2F7;
  --border-focus: #00965A;

  /* Accent Status Colors (inspired by reference screenshots) */
  --status-paid: #00965A;
  --status-paid-bg: #E8F8F1;
  --status-pending: #DD6B20;
  --status-pending-bg: #FEEBC8;
  --status-expired: #E53E3E;
  --status-expired-bg: #FED7D7;
  --status-info: #3182CE;
  --status-info-bg: #EBF8FF;

  /* Typography */
  --font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-size-xs: 0.75rem;     /* 12px */
  --font-size-sm: 0.875rem;    /* 14px */
  --font-size-base: 1rem;      /* 16px */
  --font-size-lg: 1.125rem;    /* 18px */
  --font-size-xl: 1.25rem;     /* 20px */
  --font-size-2xl: 1.5rem;     /* 24px */
  --font-size-3xl: 1.875rem;   /* 30px */
  --font-size-4xl: 2.25rem;    /* 36px */
  --font-size-5xl: 3rem;       /* 48px */

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Elevation / Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-emerald: 0 8px 20px -4px rgba(0, 150, 90, 0.28);

  /* Layout & Transitions */
  --container-max: 1200px;
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* ==========================================================================
   Dark Mode Theme System Tokens
   ========================================================================== */
[data-theme="dark"] {
  /* Neutral Dark Charcoal & Text */
  --text-main: #F1F5F9;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --text-light: #64748B;
  --text-inverse: #0F172A;
  --text-primary: var(--text-main);
  --color-primary: var(--primary);
  --text-color: var(--text-main);

  /* Surfaces & Backgrounds */
  --bg-app: #0B1120;
  --bg-surface: #131D31;
  --bg-surface-alt: #1E293B;
  --bg-muted: #1E293B;
  --bg-hover: var(--bg-surface-alt);
  --bg-card: var(--bg-surface);

  /* Borders & Dividers */
  --border-color: #27354E;
  --border-light: #1E293B;
  --border-focus: #10B981;

  /* Brand Overrides for Dark Mode */
  --primary: #10B981;
  --primary-hover: #059669;
  --primary-active: #047857;
  --primary-light: rgba(16, 185, 129, 0.16);
  --primary-subtle: rgba(16, 185, 129, 0.08);
  --primary-gradient: linear-gradient(135deg, #059669 0%, #10B981 100%);
  --primary-dark: #34D399;

  /* Status Overrides */
  --status-paid: #34D399;
  --status-paid-bg: rgba(16, 185, 129, 0.2);
  --status-pending: #FB923C;
  --status-pending-bg: rgba(251, 146, 60, 0.18);
  --status-expired: #F87171;
  --status-expired-bg: rgba(248, 113, 113, 0.18);
  --status-info: #60A5FA;
  --status-info-bg: rgba(96, 165, 250, 0.18);

  /* Elevation / Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.65);
  --shadow-emerald: 0 8px 20px -4px rgba(16, 185, 129, 0.35);
}

/* ==========================================================================
   CSS Reset & Base Rules
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

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

a:hover {
  color: var(--primary-hover);
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Typography Utilities
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.15rem; }

@media (min-width: 768px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2.25rem; }
  h3 { font-size: 1.5rem; }
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ==========================================================================
   Containers & Grids
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.section {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

@media (min-width: 768px) {
  .section {
    padding-top: 5.5rem;
    padding-bottom: 5.5rem;
  }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* ==========================================================================
   Buttons (Accessible, 44px+ touch target)
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: var(--font-size-sm);
  padding: 0.65rem 1.25rem;
  min-height: 44px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
  user-select: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: var(--text-inverse);
  box-shadow: var(--shadow-emerald);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border-color: var(--border-color);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background-color: var(--bg-muted);
  border-color: var(--border-color);
  color: var(--text-main);
}

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

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

.btn-whatsapp {
  background-color: var(--whatsapp);
  color: #FFFFFF;
}

.btn-whatsapp:hover {
  background-color: var(--whatsapp-hover);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: var(--font-size-base);
  min-height: 48px;
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: var(--font-size-xs);
  min-height: 36px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Badges & Pills
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  line-height: 1.2;
}

.badge-emerald {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.badge-warning {
  background-color: var(--status-pending-bg);
  color: var(--status-pending);
}

.badge-danger {
  background-color: var(--status-expired-bg);
  color: var(--status-expired);
}

.badge-info {
  background-color: var(--status-info-bg);
  color: var(--status-info);
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card-body {
  padding: 1.5rem;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background-color: var(--bg-surface);
}

.card-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-surface-alt);
}

/* ==========================================================================
   Forms & Inputs (Mobile-First Accessible)
   ========================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.form-control, .form-select {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 1rem;
  font-size: var(--font-size-base);
  color: var(--text-main);
  background-color: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 150, 90, 0.15);
  outline: none;
}

.form-control.is-invalid {
  border-color: var(--status-expired);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--status-expired);
  margin-top: 0.35rem;
  font-weight: 500;
}

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

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border: 1px solid transparent;
}

.alert-success {
  background-color: var(--primary-light);
  color: var(--primary-dark);
  border-color: #B2E5D0;
}

.alert-danger {
  background-color: var(--status-expired-bg);
  color: #9B2C2C;
  border-color: #FEB2B2;
}

.alert-warning {
  background-color: var(--status-pending-bg);
  color: #9C4221;
  border-color: #FBD38D;
}

.alert-info {
  background-color: var(--status-info-bg);
  color: #2B6CB0;
  border-color: #BEE3F8;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-light);
  height: 68px;
  display: flex;
  align-items: center;
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.nav-link {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

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

.hamburger-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
}

@media (min-width: 900px) {
  .nav-links {
    display: flex;
  }
  .hamburger-btn {
    display: none;
  }
}

/* Mobile Drawer */
.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.mobile-nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-surface);
  z-index: 201;
  transform: translateX(100%);
  transition: transform var(--transition-normal);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

.mobile-nav-links {
  list-style: none;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.mobile-nav-links a {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text-main);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding-top: 4rem;
  padding-bottom: 2.5rem;
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-heading {
  color: var(--text-main);
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.footer-bottom a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-bottom a:hover {
  color: var(--primary);
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ==========================================================================
   Theme Switcher & Dark Mode Enhancements
   ========================================================================== */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: all var(--transition-fast);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.theme-toggle-btn .theme-icon-sun {
  display: none;
}

.theme-toggle-btn .theme-icon-moon {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn {
  background: var(--bg-surface-alt);
  color: #F1F5F9;
  border-color: var(--border-color);
}

[data-theme="dark"] .theme-toggle-btn:hover {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
  border-color: #10B981;
}

[data-theme="dark"] .theme-toggle-btn .theme-icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle-btn .theme-icon-moon {
  display: none;
}

[data-theme="dark"] .site-header {
  background-color: rgba(19, 29, 49, 0.95);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .mobile-nav-drawer {
  background: var(--bg-surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .hamburger-btn {
  color: var(--text-main);
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: var(--bg-surface-alt);
  border-color: var(--border-color);
  color: var(--text-main);
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
  background-color: var(--bg-surface-alt);
  border-color: var(--border-focus);
}

[data-theme="dark"] select option {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

[data-theme="dark"] ::placeholder {
  color: var(--text-muted);
  opacity: 0.85;
}

[data-theme="dark"] .btn-secondary {
  background-color: var(--bg-surface-alt);
  color: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-secondary:hover {
  background-color: #27354E;
}

[data-theme="dark"] .btn-outline {
  border-color: var(--border-color);
  color: var(--text-main);
}

[data-theme="dark"] .btn-outline:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
}

[data-theme="dark"] .table thead th {
  background-color: var(--bg-surface-alt);
  color: var(--text-secondary);
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .table tbody td {
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .site-footer {
  background-color: #070B14;
  border-top-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .footer-heading {
  color: var(--text-main);
}

[data-theme="dark"] .footer-links a {
  color: var(--text-muted);
}

[data-theme="dark"] .footer-links a:hover {
  color: var(--primary);
}

[data-theme="dark"] .footer-bottom {
  border-top-color: var(--border-color);
  color: var(--text-muted);
}

[data-theme="dark"] .footer-bottom a {
  color: var(--text-muted);
}

[data-theme="dark"] .footer-bottom a:hover {
  color: var(--primary);
}

/* Adaptive Logo Switching */
.logo-dark {
  display: none !important;
}
.logo-light {
  display: block !important;
}
[data-theme="dark"] .logo-dark {
  display: block !important;
}
[data-theme="dark"] .logo-light {
  display: none !important;
}

/* Password Visibility Toggle Utility */
.password-toggle-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-toggle-group .form-control {
  padding-right: 2.85rem;
}

.password-toggle-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.35rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  min-height: 38px;
  min-width: 38px;
  transition: color var(--transition-fast);
  z-index: 2;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus-visible {
  color: var(--primary);
  outline: none;
}
