/* Calendario / diario
   (archivo: css/pages/diary-calendar.css) */
/* ============================================================
   CALENDAR / DIARY VIEW  — rediseño completo
   ============================================================ */
#calendar-view {
  padding: 16px 14px 60px;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 60vh;
}

/* ── Dos columnas: calendario izq, detalle der ── */
#cal-main-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,420px);
  gap: 18px;
  align-items: start;
}

/* ── Columna izquierda: widget del calendario ── */
#cal-container {
  background: #1e1e1e;
  border: 2px solid #333;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── Header nav ── */
#cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
  border-bottom: 2px solid #2a2a2a;
}
#cal-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.25rem;
  color: var(--yellow-bright);
  letter-spacing: 1px;
  text-align: center;
  text-shadow: 0 0 18px rgba(255,215,0,0.4);
  flex: 1;
}
#cal-nav-group {
  display: flex;
  gap: 6px;
  align-items: center;
}
#cal-prev, #cal-next, #cal-today {
  background: #2a2a2a;
  border: 2px solid #3a3a3a;
  border-radius: 8px;
  color: var(--text-white);
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
#cal-today {
  font-size: 0.72rem;
  width: auto;
  padding: 0 10px;
  letter-spacing: 0.3px;
}
#cal-prev:hover, #cal-next:hover, #cal-today:hover {
  background: #333;
  border-color: var(--yellow-bright);
  color: var(--yellow-bright);
}

/* ── Leyenda ── */
#cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: center;
  padding: 8px 12px 6px;
  background: #161616;
  border-bottom: 1px solid #2a2a2a;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.67rem;
  color: #888;
  letter-spacing: 0.3px;
}
.cal-legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Weekday labels ── */
#cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 8px 10px 4px;
  background: #1a1a1a;
}
#cal-weekdays span {
  font-family: 'Fredoka One', cursive;
  font-size: 0.67rem;
  color: #555;
  text-align: center;
  letter-spacing: 0.5px;
}

/* ── Month grid ── */
#cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  padding: 6px 10px 12px;
  background: #1a1a1a;
}
.cal-day {
  aspect-ratio: 1;
  background: #242424;
  border: 2px solid #2c2c2c;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 5px 3px 3px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .12s, box-shadow .15s;
  position: relative;
  overflow: hidden;
}
.cal-day:hover {
  border-color: var(--yellow-bright);
  background: #2c2c2c;
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  z-index: 2;
}
.cal-day.other-month {
  opacity: 0.2;
  cursor: default;
  pointer-events: none;
}
.cal-day.today {
  border-color: var(--yellow-bright);
  background: rgba(255,215,0,0.08);
}
.cal-day.today .cal-day-num {
  color: var(--yellow-bright);
  text-shadow: 0 0 10px rgba(255,215,0,0.7);
}
.cal-day.has-activity {
  border-color: rgba(57,255,20,0.5);
  background: rgba(57,255,20,0.04);
}
.cal-day.today.has-activity {
  border-color: var(--yellow-bright);
  background: rgba(255,215,0,0.1);
}
.cal-day.selected {
  border-color: var(--yellow-bright) !important;
  background: rgba(255,215,0,0.15) !important;
  box-shadow: 0 0 18px rgba(255,215,0,0.3), inset 0 0 8px rgba(255,215,0,0.08) !important;
  transform: scale(1.06);
  z-index: 3;
}
.cal-day-num {
  font-family: 'Fredoka One', cursive;
  font-size: 0.82rem;
  color: #ccc;
  line-height: 1;
  margin-bottom: 2px;
}
.cal-day-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}
.cal-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-dot.mastery-completed  { background: var(--green-done); box-shadow: 0 0 4px rgba(57,255,20,0.6); }
.cal-dot.mastery-uncompleted { background: #ff4444; }
.cal-dot.mission-done       { background: var(--yellow-bright); box-shadow: 0 0 3px rgba(255,215,0,0.5); }
.cal-dot.mission-undone     { background: #666; }
.cal-dot.counter-update     { background: #38bdf8; box-shadow: 0 0 3px rgba(56,189,248,0.5); }

/* ── Activity count badge ── */
.cal-day-count {
  position: absolute;
  top: 3px; right: 4px;
  font-family: 'Fredoka One', cursive;
  font-size: 0.55rem;
  color: var(--yellow-bright);
  opacity: 0.8;
  line-height: 1;
}

/* ══════════════════════════════════════════
   COLUMNA DERECHA — DETAIL PANEL
   ══════════════════════════════════════════ */
#cal-detail {
  background: #1e1e1e;
  border: 2px solid #333;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#cal-detail.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Header del detalle */
#cal-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 12px;
  background: linear-gradient(135deg, #111 0%, #1a1a1a 100%);
  border-bottom: 2px solid #2a2a2a;
  flex-shrink: 0;
}
#cal-detail-date {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: var(--yellow-bright);
  letter-spacing: 0.5px;
  text-shadow: 0 0 14px rgba(255,215,0,0.4);
}
#cal-detail-close {
  background: #2a2a2a;
  border: 2px solid #3a3a3a;
  color: #888;
  font-size: 0.9rem;
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}
#cal-detail-close:hover { color: #fff; border-color: #ff3333; background: #1a0808; }

/* Body scrollable */
#cal-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 18px;
}
#cal-detail-body::-webkit-scrollbar { width: 5px; }
#cal-detail-body::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 4px; }

/* Empty state */
#cal-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #555;
  font-size: 0.88rem;
  padding: 40px 0;
  text-align: center;
}
#cal-detail-empty .cal-empty-icon {
  font-size: 2.8rem;
  opacity: 0.5;
}
#cal-detail-empty .cal-empty-hint {
  font-size: 0.73rem;
  color: #444;
}

/* List of entries */
#cal-detail-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Agrupación por maestría ── */
.cal-mastery-group {
  border-radius: 14px;
  overflow: hidden;
  border: 2.5px solid #2e2e2e;
  animation: missionSlide .22s ease both;
  transition: border-color .25s, box-shadow .25s;
  background: #1c1c1c;
  position: relative;
}
.cal-mastery-group:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,0.55);
}

/* Banner completo de la maestría */
.cal-group-banner {
  position: relative;
  width: 100%;
  aspect-ratio: 700 / 450;
  overflow: hidden;
  background: #111;
  flex-shrink: 0;
}
.cal-group-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  display: block;
  filter: brightness(0.65) saturate(0.9);
  transition: filter .3s;
}
.cal-mastery-group:hover .cal-group-banner img {
  filter: brightness(0.82) saturate(1.05);
}
.cal-group-banner-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,0.82) 100%);
  z-index: 1;
}
.cal-group-banner-name {
  position: absolute;
  bottom: 10px;
  left: 14px;
  right: 14px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.95);
  z-index: 2;
  line-height: 1.2;
}
.cal-group-banner-color-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  z-index: 3;
}
/* Fallback sin imagen */
.cal-group-banner.no-img {
  aspect-ratio: unset;
  height: 52px;
  background: repeating-linear-gradient(-45deg, #1e1600 0, #1e1600 14px, #130f00 14px, #130f00 28px);
}

/* Entradas dentro del grupo */
.cal-group-entries {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.cal-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px 9px;
  border-top: 1px solid #2a2a2a;
  background: transparent;
  transition: background .15s;
}
.cal-entry:first-child { border-top: none; }
.cal-entry:hover { background: rgba(255,255,255,0.03); }

.cal-entry-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  line-height: 1.3;
  margin-top: 1px;
}
.cal-entry-body {
  flex: 1;
  min-width: 0;
}
.cal-entry-title {
  font-family: 'Fredoka One', cursive;
  font-size: 0.88rem;
  color: #ddd;
  line-height: 1.25;
  margin-bottom: 2px;
}
.cal-entry-sub {
  font-size: 0.73rem;
  color: #666;
  line-height: 1.4;
}
.cal-entry-time {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.62rem;
  color: #444;
  flex-shrink: 0;
  line-height: 1.3;
  margin-top: 3px;
}

/* Border color per type inside entry */
.cal-entry.type-mastery-completed  .cal-entry-title { color: var(--green-done); }
.cal-entry.type-mastery-uncompleted .cal-entry-title { color: #ff7070; }
.cal-entry.type-mission-done .cal-entry-title { color: var(--yellow-bright); }
.cal-entry.type-counter-update .cal-entry-title { color: #7dd3fc; }

/* Group border color per dominant type */
.cal-mastery-group.gtype-completed   { border-color: rgba(57,255,20,0.4); }
.cal-mastery-group.gtype-uncompleted { border-color: rgba(255,68,68,0.4); }
.cal-mastery-group.gtype-mission     { border-color: rgba(255,215,0,0.3); }
.cal-mastery-group.gtype-counter     { border-color: rgba(56,189,248,0.25); }

/* ── Collage de banners en días del calendario ── */
.cal-day-collage {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  overflow: hidden;
  z-index: 0;
  display: flex;
}
.cal-day-collage-img {
  flex: 1;
  min-width: 0;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.28) saturate(0.6);
}
.cal-day-collage-border {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  pointer-events: none;
}
.cal-day .cal-day-num,
.cal-day .cal-day-dots,
.cal-day .cal-day-count {
  position: relative;
  z-index: 1;
}

/* ── Placeholder estado sin selección ── */
#cal-detail-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 20px;
  text-align: center;
}
#cal-detail-placeholder .cdp-icon { font-size: 3rem; opacity: 0.25; }
#cal-detail-placeholder .cdp-text {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: #3a3a3a;
  letter-spacing: 0.5px;
}
#cal-detail-placeholder .cdp-sub {
  font-size: 0.75rem;
  color: #2e2e2e;
}

/* ══════════════════════════════════════════
   RESPONSIVE — MÓVIL
   ══════════════════════════════════════════ */
@media (max-width: 720px) {
  #calendar-view { padding: 12px 10px 60px; }

  #cal-main-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* En móvil el detalle va debajo */
  #cal-detail {
    max-height: none;
  }

  .cal-day { padding: 4px 2px 2px; border-radius: 7px; }
  .cal-day-num { font-size: 0.72rem; }
  .cal-dot { width: 4px; height: 4px; }
  #cal-title { font-size: 1.05rem; }

  .cal-group-banner-name { font-size: 0.88rem; }
  .cal-entry { padding: 7px 10px 7px; }
}

@media (max-width: 400px) {
  #cal-grid { gap: 3px; padding: 5px 7px 10px; }
  #cal-weekdays { padding: 6px 7px 3px; }
  .cal-day-num { font-size: 0.65rem; }
  #cal-prev, #cal-next, #cal-today { font-size: 0.9rem; width: 30px; height: 30px; }
  #cal-title { font-size: 0.9rem; }
}

