/* ==========================================================================
   SISTEMA DE DISEÑO PREMIUM - MEDICAL GLASSMORPHISM
   ========================================================================== */

/* Variables de Color e Interfaz (CSS Custom Properties) */
:root {
  /* Fuentes */
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-logo: 'Outfit', sans-serif;

  /* Modo Claro (Default) */
  --bg-app: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
  --bg-sidebar: rgba(255, 255, 255, 0.7);
  --bg-card: rgba(255, 255, 255, 0.65);
  --bg-input: rgba(255, 255, 255, 0.9);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-inverse: #ffffff;
  
  /* Acentos */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-glow: rgba(79, 70, 229, 0.15);
  
  --success: #10b981;
  --success-hover: #059669;
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-badge: rgba(16, 185, 129, 0.15);
  
  --warning: #f59e0b;
  --danger: #f43f5e;
  --danger-hover: #e11d48;
  --danger-bg: rgba(244, 63, 94, 0.1);
  
  --indigo-light: #818cf8;
  --indigo-bg: rgba(79, 70, 229, 0.08);

  /* Estructurales */
  --border-color: rgba(226, 232, 240, 0.7);
  --border-glass: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --glass-blur: blur(16px);
  --border-radius-sm: 8px;
  --border-radius-md: 14px;
  --border-radius-lg: 20px;
}

/* Variables para Modo Oscuro */
body.dark-mode {
  --bg-app: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  --bg-sidebar: rgba(15, 23, 42, 0.8);
  --bg-card: rgba(30, 41, 59, 0.7);
  --bg-input: rgba(15, 23, 42, 0.85);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  
  /* Acentos Ajustados */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.15);
  --success-badge: rgba(52, 211, 153, 0.2);
  
  --danger: #fb7185;
  --danger-bg: rgba(251, 113, 133, 0.15);

  --border-color: rgba(51, 65, 85, 0.6);
  --border-glass: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   RESET Y ESTILOS GENERALES
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Contenedor Principal (Layout de Rejilla con Sidebar) */
.app-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* ==========================================================================
   ASIDE: SIDEBAR CON GLASSMORPHISM
   ========================================================================== */
.sidebar {
  background: var(--bg-sidebar);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-glass);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.logo-icon {
  background: linear-gradient(135deg, var(--primary) 0%, #a5b4fc 100%);
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-logo);
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--text-main);
  line-height: 1.1;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

/* Botones de Navegación del Menu */
.menu-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.menu-btn::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 4px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  transform: scaleY(0);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-btn i {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

.menu-btn:hover {
  background: var(--primary-glow);
  color: var(--primary);
}

.menu-btn:hover::before {
  transform: scaleY(0.5);
}

.menu-btn.active {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px var(--primary-glow);
  font-weight: 600;
}

.menu-btn.active::before {
  background: white;
  transform: scaleY(1);
}

.menu-btn.active::after {
  content: '';
  position: absolute;
  right: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 30px;
}

/* Botón de Cambiar Tema */
.theme-toggle-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
}

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

.theme-toggle-btn i {
  width: 16px;
  height: 16px;
}

.app-version {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* ==========================================================================
   MAIN: DISEÑO DEL CONTENIDO PRINCIPAL
   ========================================================================== */
.main-content {
  padding: 30px 40px;
  display: flex;
  flex-direction: column;
  gap: 30px;
  overflow-y: auto;
  height: 100vh;
}

/* TOP BAR (Header Superior) */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  padding: 16px 24px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Buscador */
.header-search-wrapper {
  position: relative;
  width: 400px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

#search-patients {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

#search-patients:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.header-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.clock-display {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-app);
  padding: 8px 14px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-glass);
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s infinite;
}

.status-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* ==========================================================================
   VISTAS (TABS) Y CARDS
   ========================================================================== */
.content-view {
  display: none;
}

.content-view.active {
  display: block;
  animation: premiumSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Tarjeta Base Estilo Glassmorphism */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-md);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 18px;
}

.card-header h2 {
  font-family: var(--font-logo);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-header i {
  width: 28px;
  height: 28px;
  stroke-width: 2px;
}

/* ==========================================================================
   SECCIÓN: METRICS GRID (DASHBOARD DE CONTROLES)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 25px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.metric-icon i {
  width: 20px;
  height: 20px;
}

.bg-indigo { background: linear-gradient(135deg, #4f46e5 0%, #818cf8 100%); }
.bg-emerald { background: linear-gradient(135deg, #10b981 0%, #34d399 100%); }
.bg-blue { background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%); }
.bg-teal { background: linear-gradient(135deg, #0d9488 0%, #2dd4bf 100%); }
.bg-rose { background: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%); }

.metric-info h3 {
  font-family: var(--font-logo);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.metric-info p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.due-attention {
  color: var(--danger) !important;
}

/* ==========================================================================
   PIZARRA CENTRAL (COLUMNAS DE PACIENTES)
   ========================================================================== */
.dashboard-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}

.dashboard-column {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 450px;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
}

.column-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.column-title i {
  width: 22px;
  height: 22px;
}

.column-title h2 {
  font-family: var(--font-logo);
  font-size: 1.15rem;
  font-weight: 700;
}

.text-indigo { color: var(--primary); }
.text-emerald { color: var(--success); }

.column-count {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-indigo {
  background: var(--primary-glow);
  color: var(--primary);
}

.badge-emerald {
  background: var(--success-bg);
  color: var(--success);
}

.patients-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  overflow-y: auto;
  max-height: 550px;
  padding-right: 4px;
}

/* ==========================================================================
   CARDS DE PACIENTE (Sala de Espera)
   ========================================================================== */
.patient-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
}

.patient-card:hover {
  transform: translateY(-3px) scale(1.015);
  border-color: var(--primary);
  box-shadow: 0 8px 16px var(--primary-glow);
  background: var(--bg-card);
}

.patient-card:active {
  transform: translateY(-1px) scale(0.985);
  box-shadow: var(--shadow-sm);
}

.patient-card-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 70%;
}

.patient-card-left h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.patient-details {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.patient-service {
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-glow);
  padding: 2px 8px;
  border-radius: 6px;
}

.patient-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

/* Badges / Indicadores */
.badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-new {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.badge-follow {
  background: rgba(139, 92, 246, 0.15);
  color: #7c3aed;
}

.badge-paid {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-pending {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(244, 63, 94, 0.2);
  font-weight: 800;
  animation: glowPulse 2s infinite;
}

.checkout-time-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  color: var(--text-muted);
  text-align: center;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius-md);
  margin-top: 15px;
}

.empty-state i {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  stroke-width: 1.5px;
}

/* ==========================================================================
   FORMULARIOS Y CAMPOS DE ENTRADA
   ========================================================================== */
.form-container {
  max-width: 850px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 25px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.required {
  color: var(--danger);
}

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

.input-wrapper i {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}

.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: 12px 14px 12px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.input-wrapper select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px !important;
  cursor: pointer;
}

body.dark-mode .input-wrapper select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

.input-wrapper input:focus,
.input-wrapper select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  outline: none;
  resize: vertical;
  transition: all 0.2s ease;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Interruptor de Switch Premium */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--text-muted);
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Sección de Campos Avanzados Check-In */
.advanced-section {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 20px;
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.2);
}

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

.toggle-text h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.toggle-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.financial-fields {
  margin-top: 20px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  animation: slideDown 0.3s ease;
}

/* Botones */
.btn {
  padding: 12px 24px;
  border-radius: var(--border-radius-sm);
  border: none;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn i {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.form-actions-right {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ==========================================================================
   TABLA: HISTORIAL DE LOGS DE WEBHOOKS
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius-md);
  border: 1px solid var(--border-color);
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.logs-table th {
  background: var(--border-color);
  color: var(--text-main);
  font-weight: 700;
  padding: 14px 18px;
}

.logs-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.logs-table tr:last-child td {
  border-bottom: none;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  font-weight: 700;
}

.badge-failed {
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 700;
}

.text-center {
  text-align: center !important;
}

/* ==========================================================================
   VISTA: CONFIGURACIÓN Y MANTENIMIENTO
   ========================================================================== */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  max-width: 800px;
  margin: 0 auto;
}

.system-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.action-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border-color);
  padding: 18px 24px;
  border-radius: var(--border-radius-md);
  background: var(--bg-card);
}

.action-info h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.action-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.danger-zone {
  border-color: rgba(244, 63, 94, 0.4);
  background: rgba(244, 63, 94, 0.05);
}

.mt-15 { margin-top: 15px; }

/* ==========================================================================
   MODALES (EDIT Y CHECKOUT POPUP)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.25s ease-out;
}

.modal-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  width: 90%;
  max-width: 680px;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-title-wrapper i {
  width: 24px;
  height: 24px;
}

.modal-title-wrapper h2 {
  font-family: var(--font-logo);
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-title-wrapper p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px 28px;
  max-height: 75vh;
  overflow-y: auto;
}

/* Ficha Resumen del Paciente */
.patient-metadata-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--indigo-bg);
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  border-radius: var(--border-radius-md);
  margin-bottom: 18px;
}

.meta-item {
  font-size: 0.85rem;
}

.meta-label {
  font-weight: 600;
  color: var(--text-muted);
}

.meta-val {
  font-weight: 700;
  color: var(--text-main);
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 15px 0 20px 0;
}

/* Display dinámico de cálculo de saldo */
.modal-balance-display {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 14px 18px;
  border-radius: var(--border-radius-sm);
  margin-top: 15px;
  display: flex;
  justify-content: center;
}

.balance-calc-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.calc-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.calc-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--danger);
}

.calc-value.saldado {
  color: var(--success);
}

/* Caja de Checkout */
.checkout-decision-card {
  margin-top: 20px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--indigo-bg);
}

.checkout-decision-card.checked-state {
  border-color: rgba(16, 185, 129, 0.4);
  background: var(--success-bg);
}

.checkout-text {
  display: flex;
  align-items: center;
  gap: 14px;
}

.checkout-icon-badge {
  background: var(--primary);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.checkout-decision-card.checked-state .checkout-icon-badge {
  background: var(--success);
}

.checkout-text h3 {
  font-size: 0.9rem;
  font-weight: 700;
}

.checkout-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   TOASTS (NOTIFICACIONES DE SISTEMA)
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 25px;
  right: 25px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 14px 20px;
  border-radius: var(--border-radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 320px;
  transform: translateX(120%);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-left: 5px solid var(--success);
}

.toast-error {
  border-left: 5px solid var(--danger);
}

.toast-info {
  border-left: 5px solid var(--primary);
}

/* ==========================================================================
   ANIMACIONES CLAVE (@KEYFRAMES)
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes premiumSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes glowPulse {
  0% { opacity: 0.9; }
  50% { opacity: 0.75; }
  100% { opacity: 0.9; }
}

/* ==========================================================================
   SERVICIOS CRUD ESTILOS
   ========================================================================== */
.services-settings-list {
  padding: 0;
  margin: 0;
}

.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.service-item:last-child {
  border-bottom: none;
}

.service-item:hover {
  background: var(--primary-glow);
}

.service-name-text {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.95rem;
}

.service-actions {
  display: flex;
  gap: 8px;
}

.service-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 6px;
}

/* Edición Inline */
.edit-service-wrapper {
  flex-grow: 1;
  margin-right: 12px;
}

.edit-service-wrapper input {
  padding: 8px 12px 8px 36px !important;
  font-size: 0.85rem !important;
}

.edit-service-actions {
  display: flex;
  gap: 6px;
}

.edit-service-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 6px;
}
