/**
 * ClassKit Global - Elapsed Time & Clocks Studio Stylesheet
 * Strict ISO A4 (210x297mm) and US Letter (215.9x279.4mm) Calibrated Print Engine
 * Curricular Alignment: CCSS.MATH.CONTENT.2.MD.C.7, 3.MD.A.1, 4.MD.A.2
 * Strict Rule 4 Compliance: Under 600 lines
 */

/* ------------------------------------------------------------------------------
 * 1. Printable Sheet Canvas Engine (A4 & US Letter)
 * ------------------------------------------------------------------------------ */
.print-pages-container {
  display: flex;
  flex-direction: column;
  gap: 28px;
  align-items: center;
  width: 100%;
}

.elapsed-sheet {
  width: var(--a4-width, 210mm);
  height: var(--a4-height, 297mm);
  min-height: var(--a4-height, 297mm);
  max-height: var(--a4-height, 297mm);
  box-sizing: border-box;
  padding: 9mm 12mm 7mm 12mm;
  background: #FFFFFF;
  color: #0F172A;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
  margin: 0 auto;
  border-radius: 2px;
}

/* Scoped Header Block */
.elapsed-sheet .sheet-header-block {
  border-bottom: 2px solid #0F172A;
  padding-bottom: 2mm;
  margin-bottom: 2mm;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.elapsed-sheet .sheet-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5mm;
  margin-bottom: 1.5mm;
  width: 100%;
  box-sizing: border-box;
  font-size: 8.5pt;
  font-weight: 600;
  color: #334155;
  line-height: 1.2;
}

.elapsed-sheet .sheet-name-field {
  display: inline-block;
  border-bottom: 1.5px solid #0F172A;
  min-width: 24mm;
  height: 11pt;
  vertical-align: bottom;
}

.elapsed-sheet .sheet-main-title {
  font-size: 15pt;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: #0F172A;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.elapsed-sheet .sheet-answer-tag {
  font-size: 8pt;
  font-weight: 800;
  color: #059669;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  padding: 1px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}

/* Directive / Instruction Banner */
.elapsed-directive-banner {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  padding: 1.8mm 3mm;
  margin-bottom: 2.5mm;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 7.5pt;
  line-height: 1.35;
  color: #334155;
  flex-shrink: 0;
}

.elapsed-directive-banner.is-answer {
  background: #F0FDF4;
  border-color: #86EFAC;
  color: #166534;
}

/* ------------------------------------------------------------------------------
 * 2. Grid Architecture
 * ------------------------------------------------------------------------------ */
.elapsed-grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100%;
  overflow: hidden;
}

.elapsed-grid-4 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3.5mm;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.elapsed-grid-6 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, 1fr);
  gap: 2.2mm;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* ------------------------------------------------------------------------------
 * 3. Problem Card Architecture
 * ------------------------------------------------------------------------------ */
.elapsed-card {
  background: #FFFFFF;
  border: 1.2px solid #CBD5E1;
  border-radius: 6px;
  padding: 2mm 3mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.is-answer-key-page .elapsed-card {
  border-color: #86EFAC;
  background: #FAFCF9;
}

.elapsed-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 1.2mm;
  margin-bottom: 1mm;
  flex-shrink: 0;
}

.elapsed-card-number {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 9pt;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 4px;
}

.elapsed-card-num-badge {
  background: #EEF2FF;
  color: #4F46E5;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8pt;
  font-weight: 800;
}

.elapsed-card-mode-badge {
  font-size: 7pt;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  background: #F1F5F9;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.elapsed-card-mode-badge.badge-end {
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
}

.elapsed-card-mode-badge.badge-elapsed {
  background: #F0FDF4;
  color: #16A34A;
  border: 1px solid #BBF7D0;
}

.elapsed-card-mode-badge.badge-start {
  background: #FAF5FF;
  color: #9333EA;
  border: 1px solid #E9D5FF;
}

.elapsed-story-box {
  font-size: 7.2pt;
  line-height: 1.35;
  color: #334155;
  background: #F8FAFC;
  padding: 1.2mm 2.2mm;
  border-radius: 4px;
  border-left: 2.5px solid #6366F1;
  margin-bottom: 1mm;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------------------
 * 4. Clocks Comparison Arena
 * ------------------------------------------------------------------------------ */
.elapsed-clocks-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 1mm 0;
  flex: 1;
}

.elapsed-clock-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.elapsed-clock-label {
  font-size: 7pt;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.elapsed-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 8.5pt;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 4px;
  background: #0F172A;
  color: #FFFFFF;
  letter-spacing: 0.3px;
}

.elapsed-badge.blank-box {
  background: #FFFFFF;
  color: #64748B;
  border: 1.2px dashed #94A3B8;
  padding: 1px 8px;
}

.elapsed-badge.solution-box {
  background: #059669;
  color: #FFFFFF;
  border: none;
}

.elapsed-arrow-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 50px;
}

.elapsed-arrow-icon {
  font-size: 13pt;
  color: #4F46E5;
  line-height: 1;
}

.elapsed-duration-pill {
  font-family: 'Outfit', sans-serif;
  font-size: 7.5pt;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
  background: #EEF2FF;
  color: #3730A3;
  border: 1px solid #C7D2FE;
  text-align: center;
  white-space: nowrap;
}

.elapsed-duration-pill.blank-pill {
  background: #FFFBEB;
  color: #B45309;
  border: 1.2px dashed #F59E0B;
}

/* ------------------------------------------------------------------------------
 * 5. Open Number Line & Student Write Arena
 * ------------------------------------------------------------------------------ */
.elapsed-numberline-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 4px;
  padding: 1.5mm 2mm;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 1mm;
  flex-shrink: 0;
}

.elapsed-numberline-hint {
  font-size: 6.5pt;
  font-weight: 700;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.elapsed-answer-line-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed #CBD5E1;
  padding-top: 1.2mm;
  margin-top: 1.2mm;
  flex-shrink: 0;
}

.elapsed-answer-prompt {
  font-size: 7.8pt;
  font-weight: 700;
  color: #1E293B;
}

.elapsed-student-write-line {
  flex: 1;
  max-width: 90px;
  border-bottom: 1.5px solid #1E293B;
  height: 13pt;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 8.5pt;
  color: #059669;
}

/* Footer Line */
.elapsed-sheet .sheet-footer-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #E2E8F0;
  padding-top: 1.5mm;
  margin-top: 2mm;
  font-size: 7pt;
  color: #64748B;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------------------
 * 6. Pure Print Engine Rules
 * ------------------------------------------------------------------------------ */
@media print {
  body {
    background: transparent !important;
    padding: 0 !important;
  }

  .studio-header,
  .studio-sidebar,
  .pro-modal-backdrop {
    display: none !important;
  }

  .studio-body {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
  }

  .studio-viewport {
    padding: 0 !important;
    background: transparent !important;
    overflow: visible !important;
  }

  .a4-wrapper {
    transform: none !important;
  }

  .print-pages-container {
    gap: 0 !important;
  }

  .elapsed-sheet {
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    border-radius: 0 !important;
    page-break-after: always !important;
    break-after: page !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .elapsed-sheet:last-child {
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  .elapsed-card {
    border: 1.2px solid #000000 !important;
  }

  .elapsed-badge {
    background: #000000 !important;
    color: #FFFFFF !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .elapsed-badge.solution-box {
    background: #059669 !important;
    color: #FFFFFF !important;
  }

  .elapsed-duration-pill {
    background: #F1F5F9 !important;
    border-color: #64748B !important;
    color: #000000 !important;
  }
}
