/* calendario-style.css */
:root {
  --bg-discipulado-rvf: #92d050;
  --bg-oracion: #ff00ff;
  --bg-casas: #b4c6e7;
  --bg-diplomado: #00b0f0;
  --bg-mujeres: #ffc0cb;
  --bg-varones: #002060;
  --bg-jovenes: #00ffff;
  --bg-matrimonios: #ffff00;
  --bg-vigilias: #ff0000;

  --surface-bg: #ffffff;
  --body-bg: #f1f5f9;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
}

body {
  font-family: '-apple-system', BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--body-bg);
  margin: 0;
  padding: 16px;
  color: var(--text-primary);
  display: flex;
  justify-content: center;
}

.app-wrapper {
  max-width: 1200px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Encabezado */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-bg);
  padding: 20px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.02);
}

.main-header h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  letter-spacing: -0.5px;
}

.main-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Selector de pestañas */
.month-navigation {
  display: flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.nav-tab {
  border: none;
  background: transparent;
  padding: 8px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.nav-tab.active {
  background: var(--surface-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* LAYOUT DASHBOARD */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
  align-items: start;
}

/* Panel del Calendario */
.calendar-card {
  background: var(--surface-bg);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.weekdays-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.day-box {
  aspect-ratio: 1.2;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 8px;
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  background: var(--surface-bg);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.day-box.empty {
  border: none;
  background: transparent;
}

/* Posicionamiento fijo del número */
.day-number {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  line-height: 1;
}

/* Posicionamiento fijo del punto indicador */
.day-box .dot-indicator {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Panel de Agenda Lateral */
.agenda-card {
  background: var(--surface-bg);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.agenda-card h2 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.activity-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border-left: 6px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.activity-info .title {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 0 0 2px 0;
  color: var(--text-primary);
}

.activity-info .subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.day-box.active-event {
  cursor: pointer;
}

/* EFECTOS DINÁMICOS */
.dashboard-layout.dimmed .day-box:not(.highlighted):not(.empty) {
  opacity: 0.15;
  filter: grayscale(50%);
}

.dashboard-layout.dimmed .activity-item:not(.highlighted) {
  opacity: 0.3;
}

.day-box.highlighted {
  transform: scale(1.06);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  z-index: 5;
  border-color: rgba(0, 0, 0, 0.35) !important;
}

.activity-item.highlighted {
  transform: translateX(4px);
  background: #f1f5f9;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.02);
}

/* HOY HIGHLIGHT */
.day-box.today-highlight {
  border: 2px solid #0f172a !important;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.05);
}

.today-tag {
  font-size: 0.65rem;
  color: #ef4444;
  text-transform: uppercase;
  font-weight: bold;
}

/* ==========================================================================
   ESTILOS VENTANA MODAL (ESCRITORIO)
   ========================================================================== */
.day-box.has-invitation:hover {
  transform: scale(1.08) !important;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15) !important;
  z-index: 10;
}

.custom-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(5px);
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

/* La clase .show fuerza la visualización del contenedor */
.custom-modal.show {
  display: flex !important;
  opacity: 1 !important;
}

.modal-content {
  position: relative;
  background-color: #fff;
  padding: 6px;
  border-radius: 20px;
  max-width: 85%;
  max-height: 80vh;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: scale(0.9);
  transition: transform 0.25s ease;
}

.custom-modal.show .modal-content {
  transform: scale(1) !important;
}

.modal-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 16px;
  object-fit: contain;
  display: block;
}

.close-modal-btn {
  display: none;
}

/* ==========================================================================
   OPTIMIZACIÓN PARA MÓVILES (RESPONSIVE COMPLETO)
   ========================================================================== */
@media (max-width: 768px) {
  body {
    padding: 8px;
  }

  .main-header {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    text-align: center;
  }

  .month-navigation {
    width: 100%;
  }

  .nav-tab {
    flex: 1;
    text-align: center;
    padding: 6px 0;
  }

  .dashboard-layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .calendar-card {
    padding: 12px;
  }

  .weekdays-grid {
    font-size: 0.75rem;
    margin-bottom: 8px;
  }

  .days-grid {
    gap: 4px;
  }

  .day-box {
    aspect-ratio: 1 !important;
    padding: 4px;
    border-radius: 6px;
    font-size: 0.85rem;
  }

  .day-number {
    top: 4px;
    left: 4px;
  }

  .today-tag {
    display: none;
  }

  .day-box .dot-indicator {
    bottom: 4px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
  }

  /* FORZAR COMPORTAMIENTO CLICKABLE Y VISIBLE EN MÓVILES */
  .custom-modal {
    pointer-events: auto !important;
  }

  .modal-content {
    max-width: 90%;
    max-height: 70vh;
  }

  .modal-content img {
    max-height: 65vh;
  }

  /* Botón "X" superior para cerrar cómodamente con el pulgar en móviles */
  .close-modal-btn {
    display: block !important;
    position: absolute;
    top: -45px;
    right: 5px;
    color: #ffffff;
    font-size: 36px;
    font-weight: 300;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.3);
    width: 40px;
    height: 40px;
    line-height: 36px;
    text-align: center;
    border-radius: 50%;
  }
}