/* ============================================================
   DISEÑO NATURISTA PREMIUM - CONSULTORIO ALFREDO ZURITA
   ============================================================ */

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

:root {
  --primary-dark: #0f2c23;
  --primary: #1b4d3e;
  --primary-light: #2d6a4f;
  --accent-gold: #c5a059;
  --accent-gold-hover: #b08b46;
  --accent-sage: #80b996;
  --accent-sage-light: #e8f3ed;
  
  --bg-main: #f4f7f5;
  --bg-card: #ffffff;
  
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-light: #f9fafb;
  
  --border-color: #e5e7eb;
  --border-focus: #1b4d3e;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 10px 25px -5px rgba(27,77,62,0.08), 0 8px 10px -6px rgba(0,0,0,0.03);
  --shadow-lg: 0 20px 30px -10px rgba(15,44,35,0.15);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--primary-dark);
  font-weight: 600;
}

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

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

/* ============================================================
   HEADER & NAVBAR
   ============================================================ */
.navbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff;
  padding: 1rem 2rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: var(--accent-gold);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--accent-sage);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-logout {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: #dc2626;
  color: #fff;
}

/* ============================================================
   CONTENEDOR PRINCIPAL
   ============================================================ */
.main-container {
  max-width: 1300px;
  width: 94%;
  margin: 2rem auto;
  flex: 1;
}

/* Page Header & Stats */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-title h1 {
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.dashboard-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Tarjetas de Estadísticas */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-sage);
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  background: var(--accent-sage-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info h3 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1.1;
}

.stat-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   CONTROLES DE BÚSQUEDA Y ACCIÓN
   ============================================================ */
.action-bar {
  background: var(--bg-card);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.search-filter-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 280px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.1);
}

.filter-select {
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  background-color: #fff;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(27, 77, 62, 0.2);
  transition: var(--transition);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(27, 77, 62, 0.3);
}

/* ============================================================
   TABLA DE PACIENTES
   ============================================================ */
.table-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.custom-table th {
  background: #f9fafb;
  color: var(--primary-dark);
  font-weight: 600;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: var(--transition);
}

.custom-table tbody tr:hover {
  background-color: var(--accent-sage-light);
}

/* Badges de Estado */
.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-block;
}

.badge-activo {
  background: #d1fae5;
  color: #065f46;
}

.badge-seguimiento {
  background: #fef3c7;
  color: #92400e;
}

.badge-alta {
  background: #e0e7ff;
  color: #3730a3;
}

.badge-pendiente {
  background: #fee2e2;
  color: #991b1b;
}

/* Botones de Acción en Tabla */
.action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #fff;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-icon:hover {
  background: var(--bg-main);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
  border: none;
}

.btn-whatsapp:hover {
  background: #1da851;
  color: #fff;
}

.btn-pdf {
  background: var(--primary);
  color: #fff;
  border: none;
}

.btn-pdf:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

/* ============================================================
   MODALES (CREAR / EDITAR / WHATSAPP)
   ============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 44, 35, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content {
  background: #fff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--accent-gold);
}

.modal-header h3 {
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  opacity: 0.8;
  transition: var(--transition);
}

.btn-close-modal:hover {
  opacity: 1;
}

.modal-body {
  padding: 1.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-dark);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.1);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f9fafb;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-secondary {
  background: #e5e7eb;
  color: var(--text-main);
  border: none;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* ============================================================
   PÁGINA DE LOGIN
   ============================================================ */
.login-body {
  background: linear-gradient(135deg, var(--primary-dark) 0%, #081d17 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.3);
  text-align: center;
}

.login-brand-icon {
  width: 70px;
  height: 70px;
  background: var(--accent-sage-light);
  border: 2px solid var(--accent-gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.2rem;
  font-size: 2.2rem;
  color: var(--primary);
}

.login-card h2 {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.8rem;
}

.alert-message {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1.2rem;
  text-align: left;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

/* ============================================================
   FICHA DEL PACIENTE EN VER_FICHA.PHP
   ============================================================ */
.ficha-container {
  background: #fff;
  max-width: 850px;
  margin: 2rem auto;
  padding: 2.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.ficha-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--primary);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.ficha-brand h2 {
  font-size: 1.8rem;
  color: var(--primary-dark);
}

.ficha-brand p {
  color: var(--accent-gold);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.ficha-meta {
  text-align: right;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.ficha-section {
  margin-bottom: 1.8rem;
}

.ficha-section-title {
  font-size: 1.1rem;
  color: var(--primary);
  border-bottom: 1px solid var(--accent-sage);
  padding-bottom: 4px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}

.info-box {
  background: #f9fafb;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}

.info-box label {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}

.info-box span {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-main);
}

.ficha-text-box {
  background: #f8faf9;
  border: 1px solid #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  line-height: 1.7;
}

.ficha-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.firm-box {
  text-align: center;
  width: 220px;
}

.firm-line {
  border-top: 1px solid #9ca3af;
  margin-bottom: 4px;
}

.firm-box p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Footer general */
.main-footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  background: #fff;
}

/* Responsivo */
@media (max-width: 768px) {
  .navbar {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .user-nav {
    width: 100%;
    justify-content: space-between;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-group.full-width {
    grid-column: span 1;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .action-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-filter-box {
    flex-direction: column;
  }
}
