/* =========================================
   1. RESET & VARIABLES GLOBALES
   ========================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Colores */
  --primary: #4CAF50;
  --primary-dark: #3d8b40;
  --primary-light: #e8f5e9;
  --secondary: #FFC107;
  --text: #333;
  --text-light: #666;
  --bg: #fff;
  --bg-alt: #f5f5f5;
  --border: #e0e0e0;

  /* Efectos */
  --shadow: 0 2px 12px rgba(0,0,0,.07);
  --shadow-soft: 0 5px 20px rgba(0,0,0,.07);
  --radius: 10px;
  --radius-lg: 12px;
  --font-family: 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
}

/* =========================================
   2. BASE & UTILIDADES COMPARTIDAS
   ========================================= */
body {
  font-family: var(--font-family);
  color: var(--text);
  line-height: 1.6;
  background: var(--bg);
}
a { text-decoration: none; color: inherit; }
.contenedor { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Alertas compartidas (Login & Dashboard) */
.alerta {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 20px;
  font-size: .88rem; display: none; line-height: 1.5;
}
.alerta.error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alerta.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* Botones base (Index) */
.btn { display: inline-block; padding: 12px 30px; border-radius: 50px; font-weight: 600; transition: all 0.3s ease; border: none; cursor: pointer; font-size: 1rem; }
.btn-primario { background-color: var(--primary); color: white; }
.btn-primario:hover { background-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 10px 25px rgba(76,175,80,0.3); }
.btn-secundario { background-color: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-secundario:hover { background-color: var(--primary); color: white; }

/* =========================================
   3. CONTEXTOS DE PÁGINA (Reemplaza body global)
   ========================================= */
.page-index { background: var(--bg); }

.page-login {
  background: linear-gradient(135deg, #f5f7fa 0%, #e9f0e9 100%);
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.page-dashboard { background: var(--bg-alt); }

/* =========================================
   4. LANDING PAGE (index)
   ========================================= */
.titulo-seccion { font-size: 2.5rem; margin-bottom: 1rem; text-align: center; }
.subtitulo-seccion { text-align: center; color: var(--text-light); margin-bottom: 3rem; font-size: 1.2rem; }

header { background-color: white; box-shadow: var(--shadow-soft); position: sticky; top: 0; z-index: 200; }
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0; }
.logo { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.logo span { color: var(--text); }
.nav-menu { display: flex; gap: 2rem; align-items: center; }
.nav-menu a { font-weight: 500; transition: color .2s; }
.nav-menu a:hover { color: var(--primary); }
.nav-cta { background-color: var(--primary); color: white !important; padding: 8px 20px; border-radius: 50px; }
.nav-cta:hover { background-color: var(--primary-dark) !important; }

.hero { padding: 60px 0; background: linear-gradient(135deg, #f5f7fa 0%, #e9f0e9 100%); }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; align-items: center; }
.hero-contenido h1 { font-size: 3.2rem; line-height: 1.2; margin-bottom: 20px; color: #2d3e2d; }
.hero-contenido p { font-size: 1.2rem; color: var(--text-light); margin-bottom: 30px; }
.hero-botones { display: flex; gap: 15px; margin-bottom: 40px; flex-wrap: wrap; }

.lead-form { background: white; padding: 30px; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.lead-form h3 { margin-bottom: 10px; font-size: 1.5rem; }
.lead-form > p { margin-bottom: 20px; color: var(--text-light); }
.form-grupo { margin-bottom: 15px; }
.form-grupo input, .form-grupo select {
  width: 100%; padding: 12px 15px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 1rem; font-family: var(--font-family); transition: border-color .2s;
}
.form-grupo input:focus, .form-grupo select:focus { outline: none; border-color: var(--primary); }
.form-btn { width: 100%; background-color: var(--primary); color: white; padding: 14px; border: none; border-radius: 8px; font-size: 1.1rem; font-weight: 600; cursor: pointer; transition: background-color 0.3s; font-family: var(--font-family); }
.form-btn:hover { background-color: var(--primary-dark); }

.como-funciona { padding: 80px 0; background-color: white; }
.pasos-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.paso { text-align: center; padding: 30px; border-radius: var(--radius-lg); background-color: var(--bg-alt); }
.paso-icono { width: 80px; height: 80px; background-color: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; font-size: 2rem; }
.paso h3 { margin-bottom: 10px; }

.servicios { padding: 80px 0; background-color: var(--bg-alt); }
.servicios-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 25px; }
.servicio-card { background: white; padding: 30px 20px; border-radius: var(--radius-lg); text-align: center; box-shadow: var(--shadow-soft); transition: transform 0.3s; }
.servicio-card:hover { transform: translateY(-10px); }
.servicio-icono { font-size: 2.5rem; color: var(--primary); margin-bottom: 15px; }
.servicio-card h3 { margin-bottom: 10px; }
.servicio-card p { color: var(--text-light); margin-bottom: 20px; }
.servicio-link { color: var(--primary); font-weight: 600; }

.sobre-vet { padding: 80px 0; }
.vet-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 50px; align-items: center; }
.vet-imagen img { width: 100%; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.vet-contenido h2 { font-size: 2.2rem; margin-bottom: 20px; }
.vet-contenido p { margin-bottom: 15px; color: var(--text-light); }
.vet-contenido .frase { font-size: 1.2rem; font-style: italic; color: var(--primary); margin: 20px 0; border-left: 4px solid var(--primary); padding-left: 20px; }

.planes { padding: 80px 0; background-color: var(--bg-alt); }
.tabla-planes { width: 100%; border-collapse: collapse; background: white; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); }
.tabla-planes th { background-color: var(--primary); color: white; padding: 20px; font-size: 1.2rem; }
.tabla-planes td { padding: 15px 20px; border-bottom: 1px solid var(--border); text-align: center; }
.tabla-planes tr:last-child td { border-bottom: none; }
.tabla-planes .destacado { background-color: #f0f7f0; }
.precio { font-size: 1.5rem; font-weight: 700; color: var(--primary); }
.btn-plan { background-color: var(--primary); color: white; padding: 8px 20px; border-radius: 50px; font-size: 0.9rem; transition: background .2s; }
.btn-plan:hover { background-color: var(--primary-dark); }

.testimonios { padding: 80px 0; }
.testimonios-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.testimonio-card { background: var(--bg-alt); padding: 25px; border-radius: var(--radius-lg); box-shadow: var(--shadow-soft); }
.testimonio-texto { margin-bottom: 20px; font-style: italic; color: var(--text-light); }
.testimonio-autor { display: flex; align-items: center; gap: 15px; }
.testimonio-autor img { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; }
.testimonio-autor h4 { font-size: 1rem; }
.testimonio-autor p { font-size: 0.9rem; color: var(--text-light); }

.blog { padding: 80px 0; background-color: var(--bg-alt); }
.blog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.blog-card { background: white; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); }
.blog-card img { width: 100%; height: 200px; object-fit: cover; }
.blog-contenido { padding: 20px; }
.blog-meta { color: var(--primary); font-size: 0.9rem; margin-bottom: 10px; }
.blog-card h3 { margin-bottom: 10px; }
.blog-card p { color: var(--text-light); margin-bottom: 15px; }
.blog-link { color: var(--primary); font-weight: 600; }

footer { background-color: #2d3e2d; color: white; padding: 60px 0 20px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 40px; margin-bottom: 40px; }
.footer-col .logo { color: white; margin-bottom: 20px; display: block; }
.footer-col p { margin-bottom: 10px; opacity: 0.9; }
.footer-col i { margin-right: 10px; color: var(--secondary); }
.footer-col h4 { margin-bottom: 20px; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul a:hover { color: var(--secondary); }
.redes-sociales { display: flex; gap: 15px; margin-top: 20px; }
.redes-sociales a { width: 40px; height: 40px; background-color: rgba(255,255,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background-color 0.3s; }
.redes-sociales a:hover { background-color: var(--secondary); }
.copyright { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); opacity: 0.8; font-size: 0.9rem; }

/* Modal Agendamiento */
#modal-cita { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
#modal-cita.abierto { display: flex; }
.modal-cita-inner { background: #fff; border-radius: 16px; width: 100%; max-width: 540px; max-height: 92vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); margin: auto; }
.modal-cita-header { padding: 24px 28px 0; display: flex; align-items: flex-start; justify-content: space-between; }
.modal-cita-header h2 { font-size: 1.2rem; font-weight: 700; color: #1a2e1a; margin: 0; }
.modal-cita-header p { font-size: .85rem; color: #6b7c6b; margin: 4px 0 0; }
.modal-cita-close { background: none; border: none; font-size: 1.5rem; color: #aaa; cursor: pointer; line-height: 1; padding: 0 4px; border-radius: 4px; transition: color .15s; flex-shrink: 0; }
.modal-cita-close:hover { color: #333; }
.pasos-barra { display: flex; gap: 8px; padding: 16px 28px 0; }
.paso-barra { flex: 1; height: 3px; border-radius: 2px; background: #e0e0e0; transition: background .3s; }
.paso-barra.activo { background: var(--primary); }
.modal-body { padding: 20px 28px 28px; }
.paso-label { font-size: .73rem; font-weight: 600; color: var(--primary); letter-spacing: .06em; text-transform: uppercase; margin: 0 0 14px; }
.mc-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.mc-campo { margin-bottom: 12px; }
.mc-campo input, .mc-campo select, .mc-campo textarea { width: 100%; padding: 11px 14px; border: 1.5px solid #dde8dd; border-radius: 8px; font-size: .95rem; font-family: var(--font-family); transition: border-color .2s; background: #fff; }
.mc-campo input:focus, .mc-campo select:focus, .mc-campo textarea:focus { outline: none; border-color: var(--primary); }
.mc-campo textarea { resize: none; }
.medicos-opciones { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.medico-opt { border: 2px solid #e0e0e0; border-radius: 10px; padding: 12px 10px; cursor: pointer; text-align: center; transition: all .15s; background: #fff; }
.medico-opt:hover { border-color: #b2dfca; }
.medico-opt.sel { border-color: var(--primary); background: #f0faf4; }
.medico-opt-avatar { width: 36px; height: 36px; border-radius: 50%; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .95rem; }
.medico-opt-nombre { font-size: .82rem; font-weight: 600; color: #222; }
.medico-opt-spec { font-size: .72rem; color: #888; margin-top: 2px; }
.slots-grilla { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-height: 240px; overflow-y: auto; margin-bottom: 16px; }
.slot-btn { border: 2px solid #dde8dd; border-radius: 8px; padding: 10px 6px; text-align: center; cursor: pointer; background: #fff; transition: all .15s; }
.slot-btn:hover { border-color: #b2dfca; }
.slot-btn.sel { border-color: var(--primary); background: #f0faf4; }
.slot-hora { font-size: 1rem; font-weight: 700; color: #1a6b3c; }
.slot-hasta { font-size: .7rem; color: #888; }
.slot-medico { font-size: .65rem; color: var(--primary); font-weight: 600; margin-top: 3px; }
.mc-btns { display: flex; gap: 8px; margin-top: 20px; }
.mc-btn-back { flex: 1; background: #f5f5f5; color: #555; border: none; border-radius: 8px; padding: 12px; font-size: .9rem; font-weight: 500; cursor: pointer; font-family: var(--font-family); transition: background .15s; }
.mc-btn-back:hover { background: #eaeaea; }
.mc-btn-next { flex: 2; background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 12px; font-size: .95rem; font-weight: 600; cursor: pointer; font-family: var(--font-family); transition: background .15s; }
.mc-btn-next:hover { background: var(--primary-dark); }
.mc-btn-next:disabled { opacity: .5; cursor: not-allowed; }
.mc-mensaje { display: none; padding: 12px 16px; border-radius: 8px; margin-bottom: 12px; font-size: .9rem; line-height: 1.5; }
.mc-mensaje.ok { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.mc-mensaje.err { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* =========================================
   5. LOGIN / AUTH
   ========================================= */
.login-card {
  background: white; border-radius: 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  width: 100%; max-width: 420px; padding: 40px; animation: fadeUp .35s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card .logo .paw { font-size: 2.2rem; display: block; margin-bottom: 6px; }
.login-card .logo h1 { color: var(--primary); font-size: 1.9rem; font-weight: 700; margin-bottom: 4px; }
.login-card .logo p { color: var(--text-light); font-size: .9rem; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--text); font-weight: 500; font-size: .9rem; }
.form-group input { width: 100%; padding: 12px 14px; border: 1.5px solid #dde8dd; border-radius: 8px; font-size: 1rem; font-family: inherit; transition: border-color .2s; }
.form-group input:focus { outline: none; border-color: var(--primary); }

.btn-login { width: 100%; background: var(--primary); color: white; border: none; padding: 14px; border-radius: 8px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: background .2s, transform .1s; font-family: inherit; margin-top: 4px; }
.btn-login:hover { background: var(--primary-dark); }
.btn-login:active { transform: scale(.98); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

.footer-links { display: flex; justify-content: space-between; margin-top: 20px; font-size: .85rem; }
.footer-links a { color: var(--primary); cursor: pointer; }
.footer-links a:hover { text-decoration: underline; }

.divider { text-align: center; margin: 16px 0; color: #aaa; font-size: .85rem; position: relative; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: #e0e0e0; }
.divider::before { left: 0; }
.divider::after  { right: 0; }

#panel-recuperar { display: none; }
.back-link { color: var(--primary); cursor: pointer; font-size: .85rem; margin-bottom: 16px; display: inline-block; }
.back-link:hover { text-decoration: underline; }

/* =========================================
   6. DASHBOARD
   ========================================= */
.header { background: white; box-shadow: var(--shadow); padding: 0; position: sticky; top: 0; z-index: 100; }
.header-inner { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 58px; display: flex; align-items: center; justify-content: space-between; }
.header .logo { color: var(--primary); font-size: 1.5rem; font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--text-light); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.btn-logout { background: none; border: 1px solid var(--border); padding: 6px 14px; border-radius: 6px; cursor: pointer; color: var(--text-light); font-size: .85rem; font-family: inherit; transition: all .15s; }
.btn-logout:hover { background: var(--bg-alt); border-color: #bbb; }

.dashboard-grid { display: grid; grid-template-columns: 220px 1fr; gap: 24px; margin: 24px 0; }
.sidebar { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; height: fit-content; }
.sidebar-menu { list-style: none; }
.sidebar-menu li { margin-bottom: 4px; }
.sidebar-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); border-radius: 8px; font-size: .9rem; font-weight: 500; transition: all .15s; }
.sidebar-menu a:hover, .sidebar-menu a.active { background: var(--primary-light); color: var(--primary); }
.sidebar-menu a i { width: 16px; text-align: center; }

.main-content { background: white; border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; min-height: 400px; }

.loading { text-align: center; padding: 40px; color: var(--text-light); }
.loading i { font-size: 2rem; color: var(--primary); margin-bottom: 12px; display: block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.bienvenida { margin-bottom: 24px; }
.bienvenida h2 { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.bienvenida p  { color: var(--text-light); font-size: .9rem; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--bg-alt); padding: 20px 16px; border-radius: var(--radius); text-align: center; border: 1px solid var(--border); }
.stat-icon { font-size: 1.8rem; color: var(--primary); margin-bottom: 8px; }
.stat-num  { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label{ font-size: .8rem; color: var(--text-light); margin-top: 4px; }

.seccion-titulo { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.btn-agendar { background: var(--primary); color: white; border: none; padding: 7px 16px; border-radius: 6px; font-size: .82rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: background .15s; }
.btn-agendar:hover { background: var(--primary-dark); }

.citas-lista { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cita-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); transition: background .15s; }
.cita-item:last-child { border-bottom: none; }
.cita-item:hover { background: #fafafa; }
.cita-info { flex: 1; }
.cita-fecha { font-weight: 600; color: var(--primary); font-size: .9rem; margin-bottom: 2px; }
.cita-detalle { font-size: .83rem; color: var(--text-light); }
.cita-medico  { font-size: .8rem; color: #888; margin-top: 2px; }
.cita-acciones { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: 12px; }

.badge { font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.badge-Pendiente   { background: #fff3cd; color: #856404; }
.badge-Confirmada  { background: #d4edda; color: #155724; }
.badge-Completada  { background: #e2e3e5; color: #383d41; }
.badge-Cancelada   { background: #f8d7da; color: #721c24; }

.btn-cancelar { background: none; border: 1px solid #f5c6cb; color: #c82333; padding: 4px 10px; border-radius: 6px; font-size: .75rem; cursor: pointer; font-family: inherit; transition: all .15s; }
.btn-cancelar:hover { background: #f8d7da; }

.mascotas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 4px; }
.mascota-card { background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; }
.mascota-emoji { font-size: 2.2rem; display: block; margin-bottom: 8px; }
.mascota-nombre { font-weight: 700; font-size: .95rem; }
.mascota-especie { font-size: .8rem; color: var(--text-light); margin-top: 2px; }

.empty-state { text-align: center; padding: 32px; color: var(--text-light); font-size: .9rem; }
.empty-state i { font-size: 2.5rem; color: #ccc; display: block; margin-bottom: 12px; }

.btn-agendar-virtual-dashboard {
  display: inline-flex; align-items: center; gap: 8px;
  background: #27ae60; color: white; padding: 12px 24px; border-radius: 8px;
  text-decoration: none; font-weight: 600; margin: 20px 0; transition: background 0.2s;
}
.btn-agendar-virtual-dashboard:hover { background: #1a6b3c; }

/* =========================================
   7. RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  .servicios-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .navbar { flex-direction: column; gap: 15px; }
  .nav-menu { flex-wrap: wrap; justify-content: center; gap: 1rem; }
  .hero-grid, .vet-grid, .pasos-grid, .testimonios-grid, .blog-grid { grid-template-columns: 1fr; }
  .titulo-seccion { font-size: 2rem; }
  .tabla-planes { font-size: 0.9rem; }
  .tabla-planes td, .tabla-planes th { padding: 10px 5px; }
  .mc-grid2, .medicos-opciones { grid-template-columns: 1fr; }
  .slots-grilla { grid-template-columns: repeat(2, 1fr); }
  .hero-contenido h1 { font-size: 2.4rem; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr; }
}

/* Fallback de centrado para la página de login */
body:has(.login-card) {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9f0e9 100%);
    padding: 20px;
}
