/* ==========================================================================
   Base Colors & Variables (Modern Deluxe Theme)
   ========================================================================== */
:root {
  /* Dynamic Palette - Assuming Dark Mode First as per modern trend */
  --bg-color: #2b2e38; /* Gris Oscuro */
  --bg-gradient: radial-gradient(circle at top right, #3a3f4c 0%, #2b2e38 100%);
  --panel-bg: rgba(30, 33, 43, 0.85);
  --panel-border: rgba(255, 255, 255, 0.1);
  
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  
  --primary: #6366f1; /* Indigo */
  --primary-rgb: 99, 102, 241;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Utilities */
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-glow: 0 0 20px var(--primary-glow);
  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
body:not(.theme-dark) {
  --bg-color: #e5e7eb; /* Gris claro */
  --bg-gradient: radial-gradient(circle at top right, #f3f4f6 0%, #d1d5db 100%);
  --panel-bg: rgba(255, 255, 255, 0.95); /* Paneles blancos para contrastar con el fondo gris */
  --panel-border: rgba(0, 0, 0, 0.1);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --shadow-glass: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

/* ==========================================================================
   Reset & Base Styles
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: var(--font-family);
  font-size: clamp(14px, 1.2vw + 10px, 16px);
  background: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden !important; /* Prevent horizontal jitter on mobile */
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

/* ==========================================================================
   Glassmorphism Utilities
   ========================================================================== */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-glass);
}

.relative { position: relative !important; }
.flex-1 { flex: 1 !important; }
.d-none { display: none !important; }

/* ==========================================================================
   Typography & Inputs
   ========================================================================== */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.03em; }

h1 { font-size: clamp(1.2rem, 2.5vw + 0.8rem, 2rem); }
h2 { font-size: clamp(1.1rem, 2vw + 0.6rem, 1.6rem); }
h3 { font-size: clamp(1rem, 1.5vw + 0.5rem, 1.3rem); }

.text-lg { font-size: clamp(0.95rem, 1.2vw + 0.7rem, 1.15rem); }
.text-xl { font-size: clamp(1.05rem, 1.5vw + 0.8rem, 1.3rem); }

.module-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.module-header h3 {
  font-size: clamp(1.5rem, 3vw + 0.5rem, 1.75rem);
}

.input-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ==========================================================================
   Ticket Template Selector (Global & Forced)
   ========================================================================== */
.template-selector {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 1.25rem !important;
  margin: 1.5rem 0 !important;
  width: 100% !important;
}
.template-option {
  flex: 1 1 150px !important;
  cursor: pointer !important;
  position: relative !important;
}
.template-option input { 
  opacity: 0 !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
}
.template-card {
  border: 2px solid var(--panel-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 1.25rem !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 0.5rem !important;
  transition: var(--transition) !important;
  background: rgba(255,255,255,0.02) !important;
  min-height: 90px !important;
  justify-content: center !important;
}
.template-option.active .template-card {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.1) !important;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3) !important;
}
.template-card i { font-size: 1.5rem !important; opacity: 0.6 !important; }
.template-option.active .template-card i { opacity: 1 !important; color: var(--primary) !important; }
.template-card span { font-size: 0.65rem !important; font-weight: 800 !important; }

/* Modern Switch Toggle (Global) */
.switch {
  position: relative;
  display: inline-block;
  width: 42px !important;
  height: 22px !important;
  cursor: pointer;
}
.switch input { 
  position: absolute;
  opacity: 0 !important; 
  width: 100%; 
  height: 100%; 
  cursor: pointer;
  z-index: 2;
  margin: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #3f3f46 !important;
  transition: .4s;
  border-radius: 24px !important;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.05);
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px !important;
  width: 16px !important;
  left: 3px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider { background-color: var(--primary) !important; box-shadow: 0 0 10px var(--primary-glow); }
input:checked + .slider:before { transform: translateX(20px); }

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem; /* More space between label and input */
  display: block;
  text-align: inherit;
}

#login-form .input-group label {
  text-align: center;
  width: 100%;
}

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

.input-wrapper i {
  position: absolute;
  left: 1.25rem;
  color: #94a3af; /* More subtle grey */
  font-size: 1.1rem; /* Slightly smaller */
  transition: var(--transition);
  z-index: 2;
  pointer-events: none;
  opacity: 0.7; /* Subtler icon */
}

input, select, textarea {
  width: 100%;
  height: clamp(40px, 5vh, 46px); /* Elegantly compact */
  padding: 0 1rem;
  border-radius: 8px; /* Softer rounding, more modern */
  border: 1px solid #d1d5db; /* Clean grey border */
  background: #ffffff;
  color: #111827;
  font-family: var(--font-family);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

input::placeholder, select::placeholder, textarea::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

body.theme-dark input, body.theme-dark select, body.theme-dark textarea {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.theme-dark input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

body.theme-dark select option {
  background-color: #1e212b;
  color: var(--text-main);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); /* Modern Focus Ring */
}

input:focus + i, .input-wrapper:focus-within i {
  color: var(--primary);
}

.select-compact, .input-compact, .input-wrapper input, .input-wrapper select, .input-wrapper textarea {
  padding-left: 2.8rem !important;
}

.select-compact + i, .input-compact + i, .input-wrapper:has(> .select-compact) i {
  left: 0.85rem !important;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: clamp(0.5rem, 1.5vw, 0.75rem) clamp(1rem, 2vw, 1.5rem);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: clamp(0.85rem, 1.5vw, 0.95rem);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.96) translateY(0);
}

.btn-primary {
  background: rgba(var(--primary-rgb), 0.1);
  border-color: rgba(var(--primary-rgb), 0.5);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 0 20px var(--primary-glow);
  transform: translateY(-2px);
}

.btn-success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.5);
  color: #ffffff;
}

.btn-success:hover {
  background: #10b981;
  color: white;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
}

.btn-danger:hover {
  background: #ef4444;
  color: white;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
  transform: translateY(-2px);
}

.btn-warning {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.5);
  color: #ffffff;
}

.btn-warning:hover {
  background: #f59e0b;
  color: white;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline.text-danger {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn-outline.text-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

.btn-block { width: 100%; }

.glow-effect:hover {
  box-shadow: var(--shadow-glow);
}

.btn-icon {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--primary-glow);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon.text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.btn-icon.text-warning:hover {
  background: var(--warning);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  border-color: var(--warning);
  color: black;
}

.btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* Soft Background Utilities */
.bg-primary-soft { background: rgba(99, 102, 241, 0.12) !important; }
.bg-success-soft { background: rgba(16, 185, 129, 0.12) !important; }
.bg-warning-soft { background: rgba(245, 158, 11, 0.12) !important; }
.bg-danger-soft { background: rgba(239, 68, 68, 0.12) !important; }

.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }

/* ==========================================================================
   Layout Utilities (Grid/Flex) for Forms
   ========================================================================== */
.form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.flex-gap {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.flex-gap.no-wrap { flex-wrap: nowrap; }
.flex-gap.justify-center { justify-content: center; }

.modal-content .flex-gap .btn {
  flex: 1 !important;
}
.flex-1 { flex: 1 1 200px; min-width: 0; }
.flex-2 { flex: 2 1 300px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: clamp(1rem, 2vw, 2rem); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(1rem, 2vw, 2rem); }

/* Day Summary Slots (Week/Month View) */
.summary-slots-container::-webkit-scrollbar {
  width: 3px;
}
.summary-slots-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.slot-mini {
  transition: all 0.2s ease;
}
.slot-mini:hover {
  filter: brightness(1.3);
  transform: translateX(2px);
}
.slot-tag.available:hover {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

/* ═══════════════════════════════════════
   Premium Agenda Header Controls
═══════════════════════════════════════ */
.agenda-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  margin-bottom: 1rem;
}

.agenda-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.agenda-header-left h2 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}
.agenda-header-left p {
  font-size: 0.85rem;
  opacity: 0.55;
  text-transform: capitalize;
  margin: 0;
  letter-spacing: 0.01em;
  font-weight: 500;
}

.agenda-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Shared pill base */
.ctrl-pill {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.ctrl-pill:hover {
  border-color: rgba(255,255,255,0.2);
}

/* Select filters inside pills */
.ctrl-pill-select {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.6rem;
  height: 32px;
  color: inherit;
}
.ctrl-pill-select i {
  font-size: 0.7rem;
  opacity: 0.4;
  flex-shrink: 0;
}
.ctrl-pill-select select {
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
  padding: 0 0.5rem;
  -webkit-appearance: none;
  appearance: none;
}
.ctrl-pill-select select option {
  background: #1e212b;
  color: #fff;
}
.ctrl-pill-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* Toggle buttons inside pills */
.ctrl-pill-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.ctrl-pill-btn:hover {
  background: rgba(255,255,255,0.08);
}
.ctrl-pill-btn.active {
  background: var(--primary, #6366f1);
  color: #fff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
}
.ctrl-pill-btn.icon-only {
  padding: 0 0.6rem;
  font-size: 0.85rem;
}
.ctrl-pill-btn.nav-today {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--primary, #6366f1);
}

/* Admin action buttons */
.agenda-admin-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  height: 32px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  color: inherit;
  transition: all 0.2s;
  white-space: nowrap;
}
.agenda-admin-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}
.agenda-admin-btn i { font-size: 0.8rem; opacity: 0.7; }

/* Premium Action Pills */
.action-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  backdrop-filter: blur(5px);
}
.action-pill i {
  font-size: 0.85rem;
  color: var(--primary, #6366f1);
}
.action-pill:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.action-pill:active {
  transform: translateY(0);
}


/* Spacing Utilities */
.mb-0-5 { margin-bottom: 0.5rem !important; }
.mb-1 { margin-bottom: 1rem !important; }
.mb-1-5 { margin-bottom: 1.5rem !important; }
.mb-2 { margin-bottom: 2rem !important; }
.mb-3 { margin-bottom: 3rem !important; }
.mt-0-5 { margin-top: 0.5rem !important; }
.mt-1 { margin-top: 1rem !important; }
.mt-1-5 { margin-top: 1.5rem !important; }
.mt-2 { margin-top: 2rem !important; }
.p-0-5 { padding: 0.5rem !important; }
.p-1 { padding: 1rem !important; }
.p-1-5 { padding: 1.5rem !important; }
.p-2 { padding: 2rem !important; }


/* ==========================================================================
   Screens & Layout
   ========================================================================== */
.screen {
  display: none;
  height: 100vh;
  width: 100vw;
}

.screen.active {
  display: flex;
}

/* --- Login --- */
#login-screen {
  align-items: center;
  justify-content: center;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.1) 0%, transparent 40%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  border-radius: var(--radius-xl);
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}

.login-header {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.login-header h1 { font-size: 1.75rem; margin-bottom: 0.25rem; width: 100%; text-align: center; }
.login-header p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.5rem; width: 100%; text-align: center; }

.logo-container {
  margin-bottom: 1.5rem;
  display: block;
  text-align: center;
}

.login-logo {
  max-height: 140px;
  max-width: 140px;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto !important;
  object-fit: contain;
  filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.2));
  transform: translateX(-4px); /* Compensación micrométrica por asimetría en el archivo de imagen */
  transition: var(--transition);
}

/* --- Dashboard & Generic Grids --- */
.layout-dashboard {
  flex-direction: row;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: transform 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
}

.stat-details h3 {
  font-size: clamp(0.7rem, 1.5vw, 0.85rem);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-details p {
  font-size: clamp(1.2rem, 3.5vw, 1.75rem);
  font-weight: 700;
  font-family: var(--font-mono);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.sidebar {
  width: 280px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--panel-border);
  border-radius: 0;
  z-index: 1001; /* Higher than topbar */
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s ease;
  position: relative;
}

.sidebar.collapsed {
  width: 100px;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sidebar-brand {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--panel-border);
  overflow: hidden;
  white-space: nowrap;
}

.brand-logo {
  height: 72px; /* 48px * 1.5 = 72px */
  max-width: 100%;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 0 8px rgba(255,255,255,0.15));
  transition: all 0.4s ease;
}

.sidebar.collapsed .brand-logo {
  height: 60px; /* Slightly larger for collapsed view too */
}

.sidebar.collapsed .sidebar-brand {
  justify-content: center;
  padding: 1.5rem 0;
}

.sidebar.collapsed .brand-icon {
  margin: 0;
}

.sidebar.collapsed .sidebar-collapse-desktop {
  position: absolute;
  right: -12px;
  top: 60px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.8rem;
  box-shadow: var(--shadow-glow);
  z-index: 10;
}

.sidebar.collapsed .sidebar-collapse-desktop:hover {
  background: var(--primary-hover);
  transform: scale(1.1);
}

.sidebar.collapsed .brand-text {
  display: none;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
}

.sidebar-nav ul { list-style: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  position: relative;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.875rem 0;
  width: 50px;
  margin-left: auto;
  margin-right: auto;
}

.sidebar.collapsed .nav-item span {
  display: none;
}

.nav-item i { font-size: 1.25rem; }

.nav-item:hover, .nav-item.active {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
}

.nav-item.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

/* Submenu Styles */
.nav-item.has-submenu {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
}

.nav-item.has-submenu div {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toggle-icon {
  margin-left: auto;
  transition: transform 0.3s ease;
  font-size: 0.9rem !important;
}

.nav-item.has-submenu.open .toggle-icon {
  transform: rotate(180deg);
}

.submenu {
  display: none;
  overflow: hidden;
  list-style: none;
  padding-left: 0.5rem;
  margin-top: 0.25rem;
}

.nav-item.has-submenu.open + .submenu {
  display: block;
}

.submenu .nav-item {
  margin-left: 0.5rem;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.05);
}

.submenu .nav-item.active {
  background: var(--primary) !important;
  color: white !important;
}

.submenu .nav-item:hover {
  background: rgba(99, 102, 241, 0.1);
}

.sidebar.collapsed .has-submenu .toggle-icon,
.sidebar.collapsed .submenu {
  display: none !important;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 0.75rem; overflow: hidden; white-space: nowrap; }

.sidebar.collapsed .details {
  display: none;
}

.sidebar.collapsed .sidebar-footer {
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem 0.5rem;
}

@media (max-width: 1024px) {
  .sidebar.collapsed .details {
    display: flex;
  }
}

.avatar { font-size: 2rem; color: var(--text-muted); flex-shrink: 0; }
.details { display: flex; flex-direction: column; }
.details .name { font-weight: 600; font-size: 0.9rem; }
.details .role { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: transparent;
}

.topbar {
  height: clamp(56px, 10vh, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--panel-border);
}

.view-container {
  flex: 1;
  padding: clamp(0.75rem, 3vw, 2rem);
  padding-bottom: calc(clamp(80px, 15vh, 120px) + env(safe-area-inset-bottom, 0px)); /* Safe space for navs */
  overflow-y: auto;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.time-display {
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.menu-mobile-toggle {
  display: none;
}

/* ==========================================================================
/* ==========================================================================
   Structural Collapse (Mobile/Tablet Hierarchy)
   ========================================================================== */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    height: 100%;
  }
  
  .sidebar.mobile-active { left: 0; width: 280px; }
  .sidebar.collapsed { width: 280px; }

  .sidebar-footer {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    margin-bottom: constant(safe-area-inset-bottom);
  }

  .sidebar-collapse-desktop { display: none; }
  .menu-mobile-toggle { display: inline-flex; }
  
  .time-display { display: none; }
}

/* ==========================================================================
   Premium Components (Metric Cards, Lists)
   ========================================================================== */
.metric-card {
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.25rem);
  border: 1px solid var(--panel-border);
  transition: transform 0.3s ease;
  background: rgba(255, 255, 255, 0.03);
}

.metric-card:hover {
  transform: translateY(-5px);
  background: rgba(255, 255, 255, 0.05);
}

.metric-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.metric-info h4 {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.metric-info .value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.premium-list-item {
  padding: 1rem;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.02);
  border-left: 4px solid var(--primary);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.premium-list-item:hover {
  background: rgba(255,255,255,0.05);
  transform: translateX(5px);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center; /* Center vertically for better aesthetics */
  justify-content: center;
  padding: 1rem;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 630px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  transform: translateY(20px) scale(0.98);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--panel-border);
  padding: 0 !important; /* Managed by children */
  overflow: hidden;
}

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

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

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

/* Global design for labels inside modals */
.modal-body label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
  letter-spacing: 0.05em;
}

/* Scrollbar Styling Modero */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* ==========================================================================
   Tables & Data Lists
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  padding: 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--panel-border);
}

.data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--panel-border);
  font-size: 0.95rem;
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-primary { background: var(--primary-glow); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-secondary { background: rgba(203, 213, 225, 0.1); color: var(--text-muted); }

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes slideUpFade {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 450px;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-glass);
  border: 1px solid var(--panel-border);
  animation: slideInRight 0.3s ease-out forwards;
}

.toast i {
  font-size: 1.5rem;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-warning i { color: var(--warning); }
.toast-info i { color: var(--info); }

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

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

/* ==========================================================================
/* ==========================================================================
   Modern POS (Sales) & Split Layouts (Fluid Auto-Wrap)
   ========================================================================== */
.pos-layout, .layout-split {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  min-height: calc(100vh - 140px);
}

.pos-catalog-scroll {
  flex: 1 1 100%;
  overflow-y: auto;
}

.pos-products-section, .split-left {
  flex: 2 1 500px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 100%;
}

.pos-cart-section, .split-right {
  flex: 1 1 350px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 100%;
  /* Padding natural for safe areas inside wrapped layouts */
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}


.category-chips {
  display: flex;
  flex-wrap: wrap; 
  gap: 0.75rem;
  padding: 0.5rem 0;
  width: 100%;
  overflow-x: hidden;
}

.chip {
  padding: 0.6rem 1.25rem;
  user-select: none;
}

.chip.active {
  background: var(--primary);
  color: white !important;
  border-color: var(--primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.chip i {
  font-size: 1.1rem;
  opacity: 0.7;
}

.chip.active i {
  opacity: 1;
}

/* Rigid 600px overrides removed */

.chip {
  padding: 0.6rem 1.25rem;
  border-radius: 99px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.chip:hover:not(.active) {
  background: rgba(255,255,255,0.05);
  transform: translateY(-2px);
}

/* Product Grid for POS */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.5rem;
  padding: 0.25rem 0;
}

/* Product Cards POS */
.pos-product-card {
  background: var(--panel-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.15rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  height: 100px;
}

.pos-product-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.pos-product-card .price-tag {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

.pos-product-card .card-category {
  font-size: 0.65rem;
  margin-bottom: 0.2rem;
  opacity: 0.8;
}

.pos-product-card .card-badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  width: fit-content;
  margin-bottom: 0.4rem;
}

.pos-product-card .card-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: auto;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.pos-product-card .stock-badge {
  font-size: 0.65rem;
  padding: 0.25rem 0.5rem;
  white-space: nowrap;
}

.pos-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
}

.pos-card-main {
  margin-top: 0.5rem;
  flex: 1;
}

/* Cart Item */
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--primary);
}

.cart-item-info {
  display: flex;
  flex-direction: column;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.cart-item-details {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cart-item-price {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--text-main);
}

/* Custom Total Panel */
.total-panel {
  background: linear-gradient(135deg, var(--primary) 0%, #4f46e5 100%);
  color: white;
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glow);
  margin-top: auto;
}

.total-panel .label {
  opacity: 0.8;
  font-size: clamp(0.75rem, 1.5vw, 0.9rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.total-panel .value {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  font-weight: 800;
  font-family: var(--font-mono);
}

/* Quantity Stepper Buttons */
.qty-stepper {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  width: 100%;
}

.btn-qty-step {
  width: 70px;
  height: 6rem;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  user-select: none;
}

.btn-qty-step:active {
  transform: scale(0.9);
  background: var(--primary-hover);
}

.p-1 { padding: 0.5rem !important; }
.p-1-5 { padding: 0.75rem !important; }
.p-2 { padding: 1.25rem !important; }
.p-3 { padding: 2rem !important; }
.p-4 { padding: 2.5rem !important; } /* Updated to 2.5rem as per instruction */
.p-x-4 { padding-left: 3rem !important; padding-right: 3rem !important; }

.pos-qty-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 3.5rem !important;
  height: 6rem !important;
  text-align: center;
  background: rgba(128, 128, 128, 0.05) !important;
  border: 1px solid var(--panel-border) !important;
  color: var(--text-main) !important; 
  border-radius: var(--radius-lg);
  outline: none;
  transition: var(--transition);
}

.pos-qty-input:focus {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

/* Remove Arrows/Spinners from the number input */
.pos-qty-input::-webkit-outer-spin-button,
.pos-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.pos-qty-input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.pos-unit-badge {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  font-weight: 900;
  font-size: 0.85rem;
  pointer-events: none;
  letter-spacing: 0.5px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Dropdown Results (Client Search) */
.dropdown-results {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  margin-top: 0.5rem;
  padding: 0.5rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  max-height: 250px;
  overflow-y: auto;
}

.dropdown-results div:hover {
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
}

/* ==========================================================================
   Price Selector Styles (POS)
   ========================================================================== */
.price-option-card {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 1rem 0.5rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(128, 128, 128, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
  overflow: hidden;
}

.price-option-card:hover {
  background: rgba(128, 128, 128, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.price-option-card.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.price-option-card.active .price-label {
  color: rgba(255, 255, 255, 0.9);
}

.price-option-card .price-value {
  font-size: 1.15rem;
  font-family: var(--font-mono);
}

.price-option-card.active::after {
  content: '\f26b'; /* ph-check-circle alternative */
  font-family: 'Phosphor';
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 0.8rem;
  opacity: 0.8;
}
/* ==========================================================================
   Responsive Utilities & Card Views
   ========================================================================== */
.mobile-only, .mobile-only-flex, .sidebar-toggle-text { display: none !important; }
.desktop-only, .desktop-only-flex { display: flex !important; }

@media (max-width: 1024px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }
  
  .module-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .search-bar { width: 100%; }
  #btn-new-client { margin-left: 0 !important; width: 100%; }
  
  /* Mobile Client Cards */
  .mobile-client-card {
    border-left: 4px solid var(--primary);
    transition: var(--transition);
  }
  
  .mobile-client-card:active {
    transform: scale(0.98);
  }
  
  .client-avatar-mini {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
  }
  
  .mobile-client-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(0,0,0,0.1);
    padding: 0.75rem;
    border-radius: var(--radius-md);
  }
  
  .detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  
  .mobile-only { display: block !important; }
  .mobile-only-flex, .sidebar-toggle-text { display: inline-flex !important; }
  .desktop-only, .desktop-only-flex { display: none !important; }
  
  /* Reset Sidebar Collapse for Mobile Drawer */
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .brand-text {
    display: block !important;
  }

  .detail-item i { color: var(--primary); font-size: 1rem; }
  .detail-item.full-width { grid-column: span 2; }
  /* Tech Buttons for Mobile Cards (Global-aligned colors) */
  .btn-tech-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    font-weight: 700;
    font-family: var(--font-family);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px var(--primary-glow);
    cursor: pointer;
  }
  
  .btn-tech-ctacte {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white; /* Blanco para contraste */
    font-weight: 700;
    font-family: var(--font-family);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    cursor: pointer;
  }
  
  .btn-tech-edit i, .btn-tech-ctacte i { font-size: 1.25rem; color: white; }
  
  .btn-tech-edit:active { transform: scale(0.95); opacity: 0.9; }
  .btn-tech-ctacte:active { transform: scale(0.95); opacity: 0.9; }

  /* Icon Rotations */
  #btn-sidebar-collapse i, #btn-sidebar-close-mobile i, #btn-menu-mobile i {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .sidebar.collapsed #btn-sidebar-collapse i {
    transform: rotate(180deg);
  }

  /* Fixed Topbar for Mobile App Look */
  .topbar {
    position: sticky !important;
    top: 0;
    z-index: 1000;
    padding: 0.75rem 1rem !important;
    height: 60px !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 0 !important;
    margin-bottom: 0.5rem !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  }

  /* Hide elements not needed on Mobile App Look */
  .sidebar, #btn-menu-mobile, #btn-sidebar-collapse {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  /* Scrollable Mobile Bottom Navigation */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px; /* Reduced from 220px to a standard size */
    z-index: 2000;
    display: flex !important;
    justify-content: flex-start !important; /* Allow growing */
    align-items: center;
    border-top: 1px solid var(--panel-border);
    padding: 0 1rem;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
    background: rgba(15, 15, 25, 0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px 24px 0 0 !important;
    overflow-x: auto !important; /* ENABLE SCROLL */
    scrollbar-width: none; /* Hide scrollbar Firefox */
    -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    gap: 0.5rem;
  }
  
  .mobile-bottom-nav::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
  }

  .mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem; /* Standardized text size */
    font-weight: 700;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Exactly 4 items minus gaps and paddings */
    flex: 0 0 calc((100vw - 2.5rem) / 5.5) !important; 
    min-width: calc((100vw - 2.5rem) / 5.5) !important;
    height: 100%;
    scroll-snap-align: center;
  }

  .mobile-bottom-nav .nav-item i {
    font-size: 1.8rem; /* Standard context-heavy icons */
    padding: 0.5rem;
    border-radius: 12px;
    transition: all 0.3s ease;
  }

  .mobile-bottom-nav .nav-item.active {
    background: rgba(255, 255, 255, 0.12) !important;
    border-top: 4px solid #fff !important; /* Unified modern indicator */
    border-radius: 0 0 20px 20px !important;
    gap: 0.25rem !important;
    backdrop-filter: blur(15px) !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5) !important;
    color: #fff !important;
  }

  .mobile-bottom-nav .nav-item.active i {
    color: #fff !important;
    font-size: 2rem !important;
    background: transparent !important;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.8) !important;
    transform: translateY(2px) !important;
    padding: 0 !important;
  }
  
  .mobile-bottom-nav .nav-item.active span {
    display: block !important;
    color: #fff !important;
    font-size: 0.85rem !important;
    font-weight: 950 !important;
    visibility: visible !important;
    opacity: 1 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    margin-top: 0.25rem !important;
  }

  #btn-theme i {
    font-size: 2rem !important;
  }
  #btn-theme {
    width: 50px !important;
    height: 50px !important;
    background: rgba(255,255,255,0.08) !important;
    border-radius: 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .user-avatar-mini {
    display: none !important; /* Not necessary on mobile as per user request */
  }
  .topbar-right {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
  }
  .topbar-actions {
    gap: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
  }

}

/* Animations for Mobile Only button rotation */
#btn-sidebar-close-mobile i:hover { transform: rotate(-20deg); }
#btn-menu-mobile i:hover { transform: rotate(20deg); }

/* ==========================================================================
   Expert Responsive Design System (Fluid & Balanced)
   ========================================================================== */

/* 1. Global Touch & Overflow Fixes */
html, body {
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

* {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
/* 2. Tablets & Small Laptops (1024px) */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    border-radius: 0;
    z-index: 2000;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.active, .sidebar.mobile-active { left: 0; }
  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .sidebar-overlay.active { opacity: 1; pointer-events: auto; }
  .desktop-only { display: none !important; }
}

/* Media overrides deleted in favor of Fluid Layout Architecture */

/* Logout Button (Mobile Only Topbar) */
#btn-logout-mobile {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; 
}
#btn-logout-mobile:active { transform: scale(0.9); }
#btn-logout-mobile i { color: var(--danger) !important; opacity: 0.9; }


/* Sidebar Notification Badges */
.nav-item { position: relative; }
.sidebar-badge {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 900;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
  border: 2px solid var(--bg-panel);
  z-index: 5;
}

.pulse-animation {
  animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   Bookings Module Styles
   ========================================================================== */
.bookings-table {
  border-collapse: separate;
  border-spacing: 0.5rem;
  table-layout: fixed;
}

.bookings-table th {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  text-align: center;
}

.time-col {
  width: 80px;
  text-align: right !important;
  font-weight: 600;
  opacity: 0.7;
}

.time-label {
  padding: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  vertical-align: middle;
  text-align: right;
}

.time-slot {
  height: 40px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  position: relative;
}

.time-slot.available:hover {
  background: rgba(34, 197, 94, 0.1);
  border-color: var(--success);
  transform: scale(1.02);
  z-index: 10;
}

.time-slot.occupied {
  padding: 0;
  background: transparent;
  border: none;
}

.booking-card {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 4px solid var(--primary);
  background: rgba(99, 102, 241, 0.15);
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.booking-card:hover {
  transform: translateY(-2px);
  filter: brightness(1.2);
  box-shadow: var(--shadow-glow);
}

.booking-card.paid {
  border-left-color: var(--success);
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
}

.booking-card.pending {
  border-left-color: var(--warning);
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
}

.text-min-xs {
  font-size: 0.6rem;
}

.court-item {
  transition: var(--transition);
}

.court-item:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 1024px) {
  .bookings-table {
    display: block;
    overflow-x: auto;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}


.bookings-grid-container {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
  overflow: auto !important;
  max-height: 70vh;
  position: relative;
  display: block;
  z-index: 1;
}

.bookings-grid-container::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.bookings-grid-container::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

.court-header {
  min-width: 150px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--panel-bg) !important;
  backdrop-filter: blur(10px);
}

.time-col {
  position: sticky;
  left: 0;
  z-index: 21;
  background: var(--panel-bg) !important;
  border-right: 1px solid var(--panel-border);
}

.time-label {
  position: sticky;
  left: 0;
  background: var(--panel-bg) !important;
  z-index: 15;
}

/* ==========================================================================
   Print Styles (Thermal Ticket Optimization)
   ========================================================================== */
@media print {
  /* Hide everything except the thermal area */
  body * {
    visibility: hidden;
  }
  
  #thermal-print-area, #thermal-print-area * {
    visibility: visible;
  }
  
  #thermal-print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    color: black !important;
  }

  /* Force white background and black text for print */
  body, .thermal-print-area, .ticket-body {
    background: white !important;
    color: black !important;
  }

  /* Hide screen-only elements */
  .no-print, .btn, .topbar, .sidebar, .mobile-bottom-nav, .modal-overlay, .toast-container {
    display: none !important;
  }

  @page {
    margin: 0;
    size: auto;
  }
}

/* Thermal Ticket Specific Classes */
.thermal-print-area {
  display: none;
}

@media print {
  .thermal-print-area {
    display: block !important;
  }
}

.ticket-header { text-align: center; margin-bottom: 5mm; }
.ticket-logo { max-width: 40mm; max-height: 25mm; display: block; margin: 0 auto 3mm; filter: grayscale(1); }
.ticket-app-name { font-size: 14pt; font-weight: 900; margin-bottom: 1mm; text-transform: uppercase; }
.ticket-details { font-size: 8.5pt; line-height: 1.2; opacity: 0.9; }

.ticket-body { font-family: 'Courier New', Courier, monospace; width: 100%; max-width: 80mm; margin: 0 auto; padding: 2mm; color: #000; }
.ticket-body .divider { border-top: 1px dashed #000; margin: 3mm 0; }
.ticket-body .double-divider { border-top: 1px solid #000; border-bottom: 1px solid #000; height: 3px; margin: 3mm 0; }

.item-row { display: flex; justify-content: space-between; font-size: 9pt; margin-bottom: 1.5mm; }
.item-qty { width: 12mm; }
.item-name { flex: 1; padding: 0 2mm; }
.item-total { width: 18mm; text-align: right; font-weight: bold; }

.total-row { display: flex; justify-content: space-between; align-items: center; margin-top: 2mm; }
.total-section { margin-top: 4mm; }

.qr-container { text-align: center; margin: 5mm 0; }
.qr-image { width: 30mm; height: 30mm; margin: 0 auto; }

.ticket-footer { text-align: center; font-size: 8.5pt; margin-top: 5mm; border-top: 1px dashed #000; padding-top: 3mm; font-style: italic; }


.hover-danger:hover { background-color: rgba(239, 68, 68, 0.2) !important; color: var(--danger) !important; opacity: 1 !important; transform: scale(1.1); transition: all 0.2s ease; }  
 
/* Tab System Styles */
.module-tabs { display: flex; background: rgba(0,0,0,0.1); }
.tab-btn { border: none; background: transparent; color: var(--text-muted); padding: 1rem; cursor: pointer; transition: all 0.2s ease; border-bottom: 2px solid transparent; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(99, 102, 241, 0.05); }
.tab-btn:hover:not(.active) { color: var(--text-main); background: rgba(255, 255, 255, 0.02); }
.tab-content { display: none; }
.tab-content.active { display: block; }

