/* =========================================================
   Simulador de Calendario Personalizable
   Estilos propios de esta herramienta (tablero de días, KPIs,
   minicalendarios de la vista anual y modal de edición de tareas).
   ========================================================= */

/* ── TARJETAS DE SECCIÓN (cabecera en azul marino + cuerpo blanco) ── */
.section-card { background: var(--site-blanco); margin-bottom: 20px; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0, 51, 102, 0.06); }
.section-head { background: var(--site-azul-marino); padding: 16px 22px; }
.section-title { font-size: var(--fs-md); font-weight: 700; color: #fff; }
.section-sub { font-size: var(--fs-sm); color: rgba(255, 255, 255, .72); margin-top: 3px; }
.section-body { padding: 22px; }

/* ── AVISO ── */
.aviso { background: #eef6ff; border-left: 3px solid #1a6bc8; border-radius: 0 4px 4px 0; padding: 9px 14px; font-size: var(--fs-sm); color: #1a3a5c; margin-bottom: 18px; }

.cal-name { max-width: 460px; margin-bottom: 0; }

/* ── TOOLBAR ── */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-group { display: flex; align-items: center; gap: 7px; }
.toolbar label { font-size: var(--fs-sm); color: var(--site-gris-texto); font-weight: 600; }
.toolbar select, .toolbar input[type=number] { border: 1.5px solid #1a6bc8; border-radius: 4px; padding: 6px 10px; font-size: var(--fs-md); color: #1a3a5c; background: #fff; outline: none; font-family: var(--font-body); }
.toolbar input[type=number] { width: 82px; }
.toolbar select:focus, .toolbar input:focus { border-color: var(--site-azul-marino); }

.view-toggle { display: flex; border: 1.5px solid #1a6bc8; border-radius: 4px; overflow: hidden; }
.vt-btn { background: #fff; border: none; padding: 6px 14px; font-size: var(--fs-sm); font-weight: 700; color: #1a6bc8; cursor: pointer; font-family: var(--font-body); }
.vt-btn.active { background: #1a6bc8; color: #fff; }
.vt-btn:hover:not(.active) { background: #eef1f5; }

.nav-arrows { display: flex; gap: 4px; }
.nav-btn { background: var(--site-azul-marino); border: none; color: #fff; width: 32px; height: 32px; border-radius: 4px; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; line-height: 1; }
.nav-btn:hover { background: var(--site-azul-oscuro); }
.nav-label { font-size: var(--fs-base); font-weight: 700; color: var(--site-azul-marino); min-width: 168px; text-align: center; }

.export-row { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.btn-export { background: var(--site-azul-marino); color: #fff; border: none; border-radius: 4px; padding: 7px 13px; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; display: flex; align-items: center; gap: 5px; font-family: var(--font-body); }
.btn-export:hover { background: var(--site-azul-oscuro); }

/* ── MONTH GRID ── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head { background: #1a3a5c; color: #fff; text-align: center; padding: 7px 4px; font-size: 11px; font-weight: 700; border-radius: 3px; letter-spacing: .02em; }
.cal-day { background: #fff; border: 1.5px solid var(--site-borde); border-radius: 5px; min-height: 100px; padding: 6px 7px; cursor: pointer; transition: border-color .1s, background .1s; position: relative; overflow: hidden; }
.cal-day:hover { border-color: #1a6bc8; background: #f5f9ff; }
.cal-day.empty { background: #f8fafc; cursor: default; border-color: var(--site-borde); }
.cal-day.empty:hover { background: #f8fafc; border-color: var(--site-borde); }
.cal-day.weekend { background: #fafafa; }
.cal-day.festivo-day { background: #fff8f0; }
.cal-day.is-today { border-color: var(--site-verde); border-width: 2px; }
.day-num { font-size: 12px; font-weight: 700; color: #1a3a5c; line-height: 1; margin-bottom: 4px; }
.cal-day.weekend .day-num { color: #8a9aaa; }
.cal-day.festivo-day .day-num { color: #b85a00; }
.today-badge { background: var(--site-verde); color: #fff; width: 21px; height: 21px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.task-chip { font-size: 10px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; font-weight: 600; line-height: 1.4; }
.tipo-tarea { background: #ddeeff; color: #0a3a6b; }
.tipo-proyecto { background: #e6f5d0; color: #2a5c00; }
.tipo-festivo { background: #fde8cc; color: #7a3800; }
.tipo-reunion { background: #f0e0ff; color: #4a0080; }
.tipo-otro { background: #e8eaec; color: #3a4a5a; }
.more-badge { font-size: 10px; color: #1a6bc8; font-weight: 700; cursor: pointer; display: block; }

/* ── YEAR GRID ── */
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mini-month-title { font-size: 11px; font-weight: 700; color: #fff; background: #1a3a5c; padding: 5px 8px; border-radius: 4px 4px 0 0; text-align: center; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--site-borde); border: 1px solid var(--site-borde); border-top: none; border-radius: 0 0 4px 4px; overflow: hidden; }
.mini-head { background: var(--site-azul-marino); color: #fff; font-size: 8.5px; font-weight: 700; text-align: center; padding: 3px 0; }
.mini-day { background: #fff; font-size: 9px; text-align: center; padding: 3px 1px; cursor: pointer; color: var(--site-gris-texto); min-height: 18px; display: flex; align-items: center; justify-content: center; }
.mini-day:hover { background: #eef3ff; }
.mini-day.has-task { background: #e6f5d0; color: #2a5c00; font-weight: 700; }
.mini-day.mini-festivo { background: #fde8cc; color: #7a3800; font-weight: 700; }
.mini-day.mini-today { background: var(--site-verde); color: #fff; border-radius: 50%; font-weight: 700; }
.mini-day.mini-empty { background: #f8fafc; cursor: default; }
.mini-day.mini-weekend { color: #8a9aaa; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 24, 56, .58); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 8px; width: 100%; max-width: 460px; overflow: hidden; box-shadow: 0 8px 40px rgba(0, 0, 0, .22); }
.modal-head { background: var(--site-azul-marino); color: #fff; padding: 13px 20px; display: flex; align-items: center; justify-content: space-between; }
.modal-head-title { font-size: var(--fs-md); font-weight: 700; }
.modal-close { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; padding: 0 4px; line-height: 1; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; display: flex; gap: 10px; justify-content: flex-end; background: #f8fafc; border-top: 1px solid var(--site-borde); }

.field-group { margin-bottom: 13px; }
.field-label { font-size: 11px; font-weight: 700; color: #1a3a5c; margin-bottom: 5px; display: block; letter-spacing: .03em; }
.inp, .inp-tipo { width: 100%; border: 1.5px solid #ccd5e0; border-radius: 4px; padding: 8px 10px; font-size: var(--fs-md); color: #1a3a5c; outline: none; background: #fff; font-family: var(--font-body); }
.inp:focus, .inp-tipo:focus { border-color: #1a6bc8; }
textarea.inp { resize: vertical; min-height: 56px; }

.task-list { margin-bottom: 14px; }
.task-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--site-borde); border-radius: 4px; margin-bottom: 5px; background: #fafbfc; }
.task-row .task-chip { margin: 0; flex: 1; cursor: default; font-size: 11px; }
.task-row .task-notes { font-size: 10px; color: #8a9aaa; flex: 1; }
.btn-del { background: none; border: none; color: #c0392b; font-size: 18px; cursor: pointer; padding: 0 3px; line-height: 1; }
.btn-del:hover { color: #7a1f1f; }
.btn-add-task { width: 100%; text-align: left; background: #f0f7ff; border: 1.5px dashed #1a6bc8; color: #1a6bc8; border-radius: 4px; padding: 7px 12px; font-size: var(--fs-md); font-weight: 600; cursor: pointer; margin-top: 2px; font-family: var(--font-body); }
.btn-add-task:hover { background: #ddeeff; }

.btn-secondary { background: #eef1f5; color: #1a3a5c; border: 1.5px solid #ccd5e0; }
.btn-secondary:hover { background: #dde3ea; }

.modal-err { color: #c0392b; font-size: var(--fs-sm); margin: -4px 0 10px; }
@media (max-width: 420px) { .modal-body > div[style*="grid"] { grid-template-columns: 1fr !important; } }

/* ── LEGEND ── */
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--site-gris-texto); }
.leg-sq { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }

/* ── RESPONSIVE ── */
@media (max-width: 860px) { .year-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .cal-day { min-height: 66px; padding: 4px 3px; }
  .cal-head { font-size: 10px; padding: 5px 2px; }
  .year-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { gap: 8px; }
  .nav-label { min-width: 120px; font-size: var(--fs-sm); }
  .export-row { margin-left: 0; }
}

/* ── EXPORTACIÓN LIMPIA (PNG) ── */
.exp-stage { position: fixed; left: -10000px; top: 0; width: 1200px; }
.exp { background: linear-gradient(180deg, #eef3f9 0%, #ffffff 100%); color: var(--site-azul-marino); overflow: hidden; }
.exp-head { position: relative; text-align: center; padding: 34px 40px 30px; background: linear-gradient(160deg, #0b5aa8 0%, #003366 55%, #002244 100%); }
.exp-head::before { content: ""; position: absolute; top: -140px; left: -100px; width: 380px; height: 380px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16) 0%, rgba(255,255,255,0) 70%); }
.exp-title { position: relative; font-size: 36px; font-weight: 700; line-height: 1.2; color: #fff; }
.exp-line { position: relative; width: 84px; height: 3px; margin: 26px auto 10px; border-radius: 2px; background: var(--site-verde); }
.exp-period { position: relative; font-size: 20px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: #fff; line-height: 1.2; }
.exp-body { padding: 30px 38px 8px; }
.exp-foot { text-align: center; padding: 14px 0 18px; font-size: 12px; font-weight: 400; color: var(--site-gris-texto); letter-spacing: .04em; }
.exp .cal-day, .exp .mini-day { cursor: default; }
.exp .cal-day:hover { border-color: var(--site-borde); background: #fff; }
.exp .cal-day.weekend { background: #fafafa; }
.exp .cal-day.festivo-day { background: #fff8f0; }
.exp .task-chip { white-space: normal; overflow: visible; }
.exp-stage .cal-head, .exp-stage .mini-month-title, .exp-stage .mini-head, .exp-stage .day-num, .exp-stage .task-chip, .exp-stage .mini-day { line-height: 1; }
.exp-stage .cal-head { padding: 5px 4px 15px; }
.exp-stage .mini-month-title { padding: 4px 8px 14px; }
.exp-stage .mini-head { padding: 2px 0 8px; }
.exp-stage .day-num { margin-bottom: 8px; padding-top: 2px; }
.exp-stage .task-chip { padding: 0 6px 11px; margin-bottom: 4px; }
.exp-stage .mini-day { padding: 0 1px 4px; min-height: 22px; }
