/* KidGenius Club - Bono #3: Calendario de Aventuras
   Estilos Profesionales de Impresión de 1 Sola Página (Letter Landscape) */

/* Contenedores de vista previa en la aplicación */
.print-hub-section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.print-options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.print-card {
  background: var(--kg-white);
  border-radius: var(--kg-radius-lg);
  padding: 24px;
  border: 3px solid rgba(53, 32, 111, 0.08);
  box-shadow: var(--kg-shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  transition: all 0.3s ease;
}

.print-card:hover {
  box-shadow: var(--kg-shadow);
  border-color: var(--kg-verde);
  transform: translateY(-3px);
}

.print-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.print-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}

.print-card-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--kg-morado);
}

.print-card-desc {
  font-size: 14px;
  color: var(--kg-gray);
  line-height: 1.45;
  font-weight: 600;
}

/* ==========================================================================
   ESTRUCTURA VISUAL DEL PÓSTER (PANTALLA Y PREVIEW)
   ========================================================================== */
.printable-calendar-poster {
  background: #ffffff;
  color: #241a3d;
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  box-sizing: border-box;
}

.poster-inner-frame {
  border: 3px solid #35206f;
  border-radius: 16px;
  padding: 12px 16px 8px 16px;
  background: #ffffff;
  box-sizing: border-box;
}

/* Header del Póster */
.poster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2.5px solid #35206f;
  padding-bottom: 8px;
  margin-bottom: 8px;
  gap: 12px;
}

.poster-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.poster-logo-dino {
  font-size: 36px;
  line-height: 1;
  background: #e8f7dd;
  padding: 4px 8px;
  border-radius: 12px;
  border: 2px solid #7ac943;
}

.poster-title-block .poster-main-title {
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 22px;
  color: #35206f;
  margin: 0;
  line-height: 1.1;
  font-weight: 700;
}

.poster-title-block .poster-sub-title {
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 13px;
  color: #ff8a25;
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.poster-title-block .poster-tagline {
  font-size: 10.5px;
  color: #6b6280;
  margin: 2px 0 0 0;
  font-weight: 700;
}

/* Leyenda de Semanas */
.poster-weeks-legend {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 10px;
  font-weight: 800;
}

.legend-pill {
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.leg-w1 { background: #e8f7dd; color: #4f9a25; }
.leg-w2 { background: #e6f5fd; color: #1e87c4; }
.leg-w3 { background: #fff8e1; color: #e0a800; }
.leg-w4 { background: #fff0e3; color: #d96a0c; }

/* Info del Niño */
.poster-kid-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.poster-info-field {
  border: 2px dashed #35206f;
  background: #fff9ec;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  color: #35206f;
  display: flex;
  gap: 6px;
}

.poster-badge-goal {
  background: #ffc928;
  color: #35206f;
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}

/* Rejilla de 30 Días (6 Columnas x 5 Filas) */
.poster-grid-30 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, auto);
  gap: 6px;
  box-sizing: border-box;
}

/* Casilla Diaria */
.poster-cell {
  border: 2px solid #35206f;
  border-radius: 10px;
  padding: 5px 6px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  position: relative;
  min-height: 76px;
}

.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  line-height: 1;
}

.cell-day-num {
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
}

.cell-icon {
  font-size: 15px;
  line-height: 1;
}

.cell-body {
  text-align: center;
  margin: 2px 0;
}

.cell-title {
  font-size: 10px;
  font-weight: 800;
  color: #35206f;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-math-snip {
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #ff8a25;
  line-height: 1.1;
  margin-top: 1px;
}

.cell-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
}

.cell-sticker-circle {
  border: 1.5px dashed #a098b3;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 8.5px;
  font-weight: 800;
  color: #6b6280;
  background: #faf8f5;
  line-height: 1.1;
}

/* Colores Temáticos por Semana */
.cell-w1 { border-color: #7ac943; background: #fbfff8; }
.cell-w1 .cell-day-num { background: #7ac943; }
.cell-w1 .cell-math-snip { color: #4f9a25; }

.cell-w2 { border-color: #38a9e8; background: #f7fcff; }
.cell-w2 .cell-day-num { background: #38a9e8; }
.cell-w2 .cell-math-snip { color: #1e87c4; }

.cell-w3 { border-color: #ffc928; background: #fffdf5; }
.cell-w3 .cell-day-num { background: #ffc928; color: #35206f; }
.cell-w3 .cell-math-snip { color: #e0a800; }

.cell-w4 { border-color: #ff8a25; background: #fffaf5; }
.cell-w4 .cell-day-num { background: #ff8a25; }
.cell-w4 .cell-math-snip { color: #d96a0c; }

/* Casilla Especial Día 30 */
.cell-grand-30 {
  border: 2.5px solid #35206f !important;
  background: linear-gradient(135deg, #fff8dc 0%, #ffecb3 100%) !important;
}
.cell-grand-30 .cell-day-num {
  background: #35206f !important;
  color: #ffc928 !important;
}
.cell-grand-30 .cell-title {
  color: #35206f !important;
  font-weight: 900 !important;
}
.cell-grand-30 .cell-math-snip {
  color: #35206f !important;
  font-weight: 800 !important;
}
.final-circle {
  border-color: #35206f !important;
  background: #ffc928 !important;
  color: #35206f !important;
  font-weight: 800 !important;
}

/* Pie del Póster */
.poster-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 2px solid #e0a800;
  margin-top: 6px;
  padding-top: 4px;
  font-size: 9.5px;
  font-weight: 700;
  color: #6b6280;
}

/* Contenedores Aislados para Print */
.print-isolated-root {
  display: none;
}

/* Diploma Oficial */
.diploma-container {
  display: none;
  background: #ffffff;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 36px;
  border: 10px double #e0a800;
  border-radius: 20px;
  text-align: center;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  background-image: radial-gradient(circle, #fffdf8 0%, #fff6e0 100%);
  box-sizing: border-box;
}

.diploma-header {
  margin-bottom: 16px;
}

.diploma-seal {
  font-size: 54px;
  margin-bottom: 4px;
}

.diploma-title {
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 36px;
  color: #35206f;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 0;
}

.diploma-subtitle {
  font-size: 16px;
  font-weight: 700;
  color: #7ac943;
  margin: 4px 0 0 0;
}

.diploma-awarded-to {
  font-size: 15px;
  color: #6b6280;
  font-weight: 600;
  margin-top: 14px;
}

.diploma-kid-name {
  font-family: 'Fredoka', cursive, sans-serif;
  font-size: 34px;
  color: #ff8a25;
  font-weight: 700;
  border-bottom: 3px solid #ffc928;
  display: inline-block;
  padding: 0 30px 4px 30px;
  margin: 6px 0 14px 0;
}

.diploma-text {
  font-size: 14.5px;
  font-weight: 700;
  color: #35206f;
  max-width: 660px;
  margin: 0 auto 20px auto;
  line-height: 1.5;
}

.diploma-signatures {
  display: flex;
  justify-content: space-around;
  margin-top: 24px;
  padding-top: 14px;
}

.diploma-sig {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: #35206f;
  border-top: 2px solid #35206f;
  padding-top: 4px;
  width: 200px;
}

/* ==========================================================================
   REGLAS DIRECTAS @MEDIA PRINT: EXACTAMENTE 1 PÁGINA TAMAÑO CARTA HORIZONTAL
   ========================================================================== */
@media print {
  @page {
    size: letter landscape;
    margin: 4mm;
  }

  html, body {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    background-image: none !important;
    color: #000000 !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Ocultar toda la interfaz de la web */
  .top-bonus-bar,
  .app-header,
  .adventure-hero,
  .nav-tabs,
  .header-actions,
  .app-footer,
  .modal-overlay,
  .btn-kg,
  .nav-tab-btn,
  .print-options-grid,
  .toast-container,
  #confetti-canvas,
  .main-wrapper {
    display: none !important;
  }

  /* Si imprimimos el Calendario */
  body.printing-calendar #print-isolated-calendar {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    box-sizing: border-box !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  body.printing-calendar #print-isolated-calendar .printable-calendar-poster {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
  }

  body.printing-calendar #print-isolated-calendar .poster-inner-frame {
    height: calc(100vh - 8mm) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 6px 10px !important;
    border-width: 3px !important;
    box-sizing: border-box !important;
  }

  body.printing-calendar #print-isolated-calendar .poster-grid-30 {
    flex: 1 !important;
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    grid-template-rows: repeat(5, 1fr) !important;
    gap: 4px !important;
    margin: 2px 0 !important;
  }

  body.printing-calendar #print-isolated-calendar .poster-cell {
    min-height: 0 !important;
    padding: 2px 4px !important;
    justify-content: space-between !important;
  }

  body.printing-calendar #print-isolated-calendar .cell-title {
    font-size: 8.5pt !important;
  }

  body.printing-calendar #print-isolated-calendar .cell-math-snip {
    font-size: 9pt !important;
  }

  body.printing-calendar #print-isolated-calendar .cell-sticker-circle {
    font-size: 7pt !important;
    padding: 0 4px !important;
  }

  /* Si imprimimos el Diploma */
  body.printing-diploma #print-isolated-diploma {
    display: block !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    box-sizing: border-box !important;
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  body.printing-diploma #print-isolated-diploma .diploma-container {
    display: block !important;
    width: 100% !important;
    height: calc(100vh - 8mm) !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    margin: 0 auto !important;
    padding: 24px 30px !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
}
