:root {
  --bg: #f5faf6;
  --card-bg: #ffffff;
  --accent: #66bb6a;
  --accent-dark: #2e7d32;
  --accent-yellow: #ffca28;
  --text-main: #1f2933;
  --text-muted: #6b7280;
  --border-soft: #e5e7eb;
  --danger: #ef5350;
  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition-fast: 0.2s ease;
  --sidebar-width: 260px;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}


*,
*::before,
*::after {
  box-sizing: border-box;
}


html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  color: var(--text-main);
  background: var(--bg);
}


/* LOGIN PAGE */


.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 0 0, #eafff2, #f6fff8),
    radial-gradient(circle at 100% 100%, #fff7e6, #fff);
}


.login-page::before {
  content: "🍍 🍍 🍍";
  position: absolute;
  font-size: 180px;
  opacity: 0.08;
  top: -40px;
  left: -40px;
  pointer-events: none;
}


.login-page::after {
  content: "🍍";
  position: absolute;
  font-size: 220px;
  opacity: 0.07;
  bottom: -60px;
  right: -40px;
  transform: rotate(-20deg);
  pointer-events: none;
}


.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-xl);
  padding: 2.2rem 2.3rem 1.8rem;
}


.login-header h1 {
  margin: 0;
  font-size: 2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}


.login-header p {
  margin: 0.2rem 0 1.4rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}


.login-card form {
  display: grid;
  gap: 0.9rem;
}


.login-footer {
  margin-top: 1.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}


/* GENERALES */


label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  color: var(--text-main);
}
input,
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background: #f9fafb;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast);
}


input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(102, 187, 106, 0.2);
  background: #ffffff;
}


textarea {
  resize: vertical;
}


button {
  border: none;
  font-family: inherit;
  cursor: pointer;
}


/* BOTONES */


.btn-primary {
  background: linear-gradient(135deg, #66bb6a, #43a047);
  color: #ffffff;
  padding: 0.65rem 1.1rem;
  border-radius: 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    filter var(--transition-fast);
}


.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(67, 160, 71, 0.25);
}


.btn-secondary {
  background: #ffffff;
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  border: 1px solid var(--border-soft);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: background var(--transition-fast),
    border-color var(--transition-fast), transform var(--transition-fast);
}


.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  transform: translateY(-1px);
}


.btn-xs {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
}


/* TEXTOS */


.error-text {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.2rem;
}


.info-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}


/* APP SHELL */


.app-shell {
  display: flex;
  min-height: 100vh;
}


/* SIDEBAR */


.sidebar {
  width: var(--sidebar-width);
  background: #ffffff;
  border-right: 1px solid var(--border-soft);
  padding: 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}


.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.2rem;
  font-weight: 700;
}


.logo-icon {
  font-size: 1.5rem;
}


.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
}


.nav-item {
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.8rem;
  border-radius: 0.8rem;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}


.nav-item:hover {
  background: #f3f4f6;
  color: var(--text-main);
  transform: translateX(1px);
}


.nav-item.active {
  background: linear-gradient(135deg, #66bb6a, #43a047);
  color: #ffffff;
}


.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}


.nutri-info {
  padding: 0.7rem 0.8rem;
  border-radius: 0.8rem;
  background: #f1f8e9;
  font-size: 0.8rem;
  line-height: 1.3;
}


.nutri-role {
  font-weight: 600;
  color: var(--accent-dark);
}


/* MAIN CONTENT */


.main-content {
  flex: 1;
  min-height: 100vh;
  padding: 1.5rem 2rem 2.5rem;
  display: flex;
  flex-direction: column;
}


.view {
  margin-bottom: 2rem;
}


.view-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}


.view h1 {
  margin: 0;
  font-size: 1.6rem;
}


.view-subtitle {
  margin: 0.15rem 0 1.1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}


/* CARDS */


.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
}


.dashboard-cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1.2fr);
}


.dashboard-charts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}


@media (max-width: 1000px) {
  .dashboard-cards {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-charts {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* TABLAS */


.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}


.table thead {
  background: #f3f4f6;
}


.table th,
.table td {
  padding: 0.6rem 0.4rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}


.table th {
  font-weight: 600;
  color: #4b5563;
}


.table tr:hover td {
  background: #fafafa;
}


/* LISTAS SENCILLAS */


.simple-list {
  list-style: none;
  padding: 0;
  margin: 0;
}


.simple-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 0.85rem;
}


/* BADGES */


.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: #e3f2fd;
  color: #1976d2;
}


.badge.status-programada {
  background: #e8f5e9;
  color: #2e7d32;
}


.badge.status-atendida {
  background: #e3f2fd;
  color: #1565c0;
}


.badge.status-cancelada {
  background: #ffebee;
  color: #c62828;
}


/* STATS */


.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}


.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}


.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
}


/* FORM GRID */


.form-grid {
  display: grid;
  gap: 0.9rem;
}


/* AGENDA */


.agenda-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.2fr);
  gap: 1rem;
}


.agenda-left {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}


.agenda-section-body {
  font-size: 0.85rem;
}


.agenda-calendar-card {
  position: relative;
  overflow: hidden;
}


@media (max-width: 900px) {
  .agenda-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}


/* CALENDARIO MEJORADO */


.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}


.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.78rem;
  color: #6b7280;
  margin-bottom: 0.3rem;
}


.calendar-weekdays span {
  padding: 3px 0;
}


.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}


.calendar-day {
  position: relative;
  min-height: 52px;
  border-radius: 0.85rem;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: 0.8rem;
  background: #f9fafb;
  border: 1px solid transparent;
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease, background 0.15s ease;
}


.calendar-day.empty {
  background: transparent;
  border: none;
}


.calendar-date {
  font-weight: 600;
  align-self: flex-end;
}


.calendar-dots {
  display: flex;
  gap: 3px;
  margin-top: auto;
}


.calendar-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}


.calendar-dot.status-programada {
  background: #66bb6a;
}


.calendar-dot.status-atendida {
  background: #42a5f5;
}


.calendar-dot.status-cancelada {
  background: #ef5350;
}


.calendar-day.has-appointment {
  cursor: pointer;
}


.calendar-day.status-programada {
  background: #e8f5e9;
  border-color: #66bb6a;
}


.calendar-day.status-atendida {
  background: #e3f2fd;
  border-color: #42a5f5;
}


.calendar-day.status-cancelada {
  background: #ffebee;
  border-color: #ef5350;
}


.calendar-day.has-appointment:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.12);
}


/* TARJETAS DE CITA */


.appointment-card {
  border-radius: 0.8rem;
  border: 1px solid #e5e7eb;
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  background: #f9fafb;
}


.appointment-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}


.appointment-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}


.appointment-card.status-programada {
  border-left: 4px solid #66bb6a;
}


.appointment-card.status-atendida {
  border-left: 4px solid #42a5f5;
}


.appointment-card.status-cancelada {
  border-left: 4px solid #ef5350;
  opacity: 0.85;
}


/* RACHAS: LLAMA */


.streak-patient {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}


.flame {
  font-size: 64px;
  padding: 12px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0%, #ffe082, #ffb300, #ff6f00);
  box-shadow: 0 0 18px rgba(255, 111, 0, 0.6);
  transition: transform 0.2s ease, filter 0.2s ease, opacity 0.2s ease,
    box-shadow 0.2s ease;
}


.flame.inactive {
  filter: grayscale(1);
  opacity: 0.4;
  background: radial-gradient(circle at 30% 0%, #eeeeee, #bdbdbd, #9e9e9e);
  box-shadow: none;
}


.flame:not(.inactive):hover {
  transform: scale(1.05);
  box-shadow: 0 0 24px rgba(255, 111, 0, 0.9);
}


/* HISTORIAL REGISTROS */


.meal-history {
  display: grid;
  gap: 0.7rem;
}


.meal-card {
  border-radius: 0.8rem;
  border: 1px solid #e5e7eb;
  padding: 0.7rem;
  font-size: 0.85rem;
}


.meal-card img {
  max-width: 100%;
  border-radius: 0.6rem;
  margin-top: 0.3rem;
}


/* TIMELINE PROGRESO */


.timeline {
  display: grid;
  gap: 0.8rem;
}


.timeline-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 0.7rem;
  border-left: 3px solid #e5e7eb;
  padding-left: 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}


.timeline-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  background: #f9fafb;
  border-radius: 0.6rem;
}


.timeline-date {
  font-weight: 600;
  color: var(--accent-dark);
}


.timeline-photos {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.3rem;
}


.timeline-photos img {
  max-width: 110px;
  border-radius: 0.6rem;
}


/* RECETAS */


.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
}


.recipe-card {
  border-radius: 0.9rem;
  border: 1px solid #e5e7eb;
  padding: 0.7rem;
  font-size: 0.85rem;
}


.recipe-card img {
  max-width: 100%;
  border-radius: 0.7rem;
  margin: 0.4rem 0;
}


/* FAQ */


.faq-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr);
  gap: 1rem;
}


@media (max-width: 1000px) {
  .faq-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}


.accordion {
  display: grid;
  gap: 0.5rem;
}


.accordion-item {
  border-radius: 0.8rem;
  border: 1px solid #e5e7eb;
  overflow: hidden;
}


.accordion-header {
  padding: 0.5rem 0.65rem;
  background: #f9fafb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  cursor: pointer;
}


.accordion-body {
  padding: 0.55rem 0.65rem 0.7rem;
  font-size: 0.85rem;
}


/* FOOTER */


.footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}


.footer-socials a {
  margin-left: 0.7rem;
  text-decoration: none;
  color: var(--accent-dark);
  font-weight: 500;
}


/* MODAL */


.modal {
  border: none;
  padding: 0;
  max-width: 700px;
  width: 95vw;
}


.modal::backdrop {
  background: rgba(15, 23, 42, 0.25);
}


.modal-content {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 1rem 1.2rem 1.1rem;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}


.modal-close {
  position: absolute;
  top: 0.4rem;
  right: 0.5rem;
  background: transparent;
  font-size: 1rem;
}


/* NOTIFICACIONES PACIENTE */


.notif-section {
  margin-bottom: 0.6rem;
}


.notif-title {
  margin: 0 0 0.3rem;
  font-size: 0.9rem;
}


.notif-list {
  display: grid;
  gap: 0.5rem;
}


.notif-card {
  border-radius: 0.8rem;
  border: 1px solid #e5e7eb;
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  background: #f9fafb;
}


.notif-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}


.notif-chip {
  font-size: 0.7rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}


.notif-chip.bonus {
  background: #fff8e1;
  color: #f9a825;
}


.notif-chip.system {
  background: #e3f2fd;
  color: #1976d2;
}


.notif-chip.note {
  background: #e8f5e9;
  color: #2e7d32;
}


.notif-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}


.notif-toggle {
  margin-top: 0.4rem;
}


.notif-old {
  margin-top: 0.4rem;
  border-top: 1px dashed #e5e7eb;
  padding-top: 0.4rem;
}


/* UTILS */


.hidden {
  display: none !important;
}


.historial-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
  margin-bottom: 0.7rem;
}


.agenda-item-main {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}


.agenda-item-actions {
  margin-top: 4px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}


.forgot-container a {
  font-size: 0.9rem;
  display: flex;
  justify-content: center;
  gap: 6px;
  color: #0077cc;
  align-items: center;
  text-decoration: none;
}


.forgot-container a:hover {
  text-decoration: underline;
}


/* ---------------- MODAL RECUPERAR CONTRASEÑA ---------------- */


/* Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(3px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999 !important;
}


.modal-overlay.hidden {
  display: none !important;
}


/* Caja */
.modal-box {
  background: #fff;
  padding: 30px;
  width: 90%;
  max-width: 420px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  animation: fadeIn 0.25s ease;
}


/* Animación */
@keyframes fadeIn {
  from { transform: scale(0.97); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}


/* Botón cerrar */
.close-btn {
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  float: right;
}


/* Inputs */
.modal-box input {
  width: 100%;
  margin-top: 5px;
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  outline: none;
}


/* Botón enviar */
.send-btn {
  width: 100%;
  padding: 12px;
  background: #34a853;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}


.send-btn:hover {
  background: #1e8e3e;
}


.modal-reset::backdrop {
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
}


.modal-reset {
  border: none;
  padding: 0;
  background: transparent;


  /* CENTRAR PERFECTAMENTE */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
}


.modal-reset-content {
  background: white;
  width: 420px;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}


#forgot-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Botón base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.1s ease,
    background-color 0.15s ease, color 0.15s ease;
}

/* Botón principal: crear, guardar, agendar, etc. */
.btn-primary {
  background: linear-gradient(to right,  #37be44, #37be44);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(67, 188, 54, 0.747);
}

.btn-primary:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

/* Botón secundario: editar, ver detalle, etc. */
.btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* Botón de peligro: eliminar, cancelar cita, etc. */
.btn-danger {
  background: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

/* Variante pequeña */
.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

/* Icono en botones */
.btn .icon {
  font-size: 1rem;
}

/* MINIATURAS Y MODAL DE IMÁGENES */
.thumb-image {
  max-width: 130px;
  max-height: 130px;
  border-radius: 0.6rem;
  object-fit: cover;
  cursor: pointer;
  display: block;
}

.image-modal-full {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 0.9rem;
}

.image-modal-wrapper {
  padding: 0.5rem 0;
  text-align: center;
}
