/* =========================================
   LAKSHYAONE — Weekly Report CSS
   Screen styles + @media print overrides
   ========================================= */

/* ── ACTION BAR ── */

.rpt-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #141414;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
}

.rpt-back-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary, #4E5FC0);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.rpt-back-btn:hover {
  opacity: 0.8;
}

.rpt-week-nav-label {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary, #8e8e93);
}

.rpt-topbar-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.rpt-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s;
}

.rpt-btn:hover { opacity: 0.85; }

.rpt-btn-primary {
  background: #4E5FC0;
  color: #fff;
}

.rpt-btn-secondary {
  background: rgba(255,255,255,.08);
  color: var(--text, #f0f0f5);
  border: 1px solid rgba(255,255,255,.1);
}

/* ── PAGE WRAP ── */

.rpt-page-wrap {
  min-height: calc(100vh - 53px);
  background: var(--bg, #111113);
  padding: 32px 24px 64px;
  display: flex;
  justify-content: center;
}

/* ── DOCUMENT ── */

.rpt-doc {
  width: 100%;
  max-width: 720px;
  background: var(--surface, #1c1c1e);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
}

/* ── LOADING ── */

.rpt-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px 24px;
  color: var(--secondary, #8e8e93);
  font-size: 14px;
}

.rpt-loading-ring {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: #4E5FC0;
  border-radius: 50%;
  animation: rpt-spin .8s linear infinite;
}

@keyframes rpt-spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ── REPORT CONTENT ── */

#rpt-content {
  padding: 40px 40px 48px;
}

/* ── HEADER ── */

.rpt-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.rpt-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rpt-logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #4E5FC0;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rpt-brand-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text, #f0f0f5);
  letter-spacing: -0.3px;
}

.rpt-brand-sub {
  font-size: 12px;
  color: var(--secondary, #8e8e93);
  margin-top: 2px;
}

.rpt-header-right {
  text-align: right;
}

.rpt-week-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text, #f0f0f5);
}

.rpt-student-label {
  font-size: 12px;
  color: var(--secondary, #8e8e93);
  margin-top: 4px;
}

/* ── DIVIDER ── */

.rpt-rule {
  height: 1px;
  background: rgba(255,255,255,.07);
  margin-bottom: 28px;
}

/* ── STATS GRID ── */

.rpt-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.rpt-stat-box {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-top: 3px solid var(--accent, #4E5FC0);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
}

.rpt-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent, #4E5FC0);
  line-height: 1;
  letter-spacing: -1px;
}

.rpt-stat-denom {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.6;
}

.rpt-stat-label {
  font-size: 11px;
  color: var(--secondary, #8e8e93);
  margin-top: 6px;
  font-weight: 500;
}

/* ── MESSAGE ── */

.rpt-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(78,95,192,.07);
  border-left: 3px solid #4E5FC0;
  border-radius: 0 10px 10px 0;
  padding: 14px 16px;
  margin-bottom: 28px;
}

.rpt-message-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.rpt-message p {
  font-size: 13px;
  color: var(--text, #f0f0f5);
  line-height: 1.6;
  margin: 0;
}

/* ── SECTIONS ── */

.rpt-section {
  margin-bottom: 28px;
}

.rpt-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--secondary, #8e8e93);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.rpt-empty-note {
  font-size: 13px;
  color: var(--secondary, #8e8e93);
  font-style: italic;
  margin: 0;
}

/* ── SUBJECT PROGRESS ── */

.rpt-subject-total {
  font-size: 12px;
  color: var(--secondary, #8e8e93);
  margin-bottom: 12px;
}

.rpt-subject-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.rpt-subject-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text, #f0f0f5);
  width: 130px;
  flex-shrink: 0;
}

.rpt-subject-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,.08);
  border-radius: 3px;
  overflow: hidden;
}

.rpt-subject-bar-fill {
  height: 100%;
  background: #30D158;
  border-radius: 3px;
  transition: width .4s ease;
  min-width: 0;
}

.rpt-subject-pct {
  font-size: 12px;
  font-weight: 700;
  color: #30D158;
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* ── MOCKS ── */

.rpt-mock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255,255,255,.04);
  border-radius: 9px;
  margin-bottom: 8px;
}

.rpt-mock-label {
  font-size: 13px;
  color: var(--secondary, #8e8e93);
  font-weight: 500;
  flex: 1;
}

.rpt-mock-score {
  font-size: 15px;
  font-weight: 700;
  color: #4E5FC0;
}

.rpt-mock-date {
  font-size: 12px;
  color: var(--secondary, #8e8e93);
}

/* ── CHAPTERS MASTERED ── */

.rpt-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rpt-chapter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text, #f0f0f5);
}

.rpt-chapter-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(48,209,88,.15);
  color: #30D158;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rpt-chapter-subject {
  margin-left: auto;
  font-size: 11px;
  color: var(--secondary, #8e8e93);
  background: rgba(255,255,255,.06);
  padding: 2px 8px;
  border-radius: 5px;
}

/* ── FOOTER ── */

.rpt-footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rpt-footer-brand {
  font-size: 12px;
  font-weight: 700;
  color: #4E5FC0;
  letter-spacing: 0.2px;
}

.rpt-footer-date {
  font-size: 11px;
  color: var(--secondary, #8e8e93);
}

/* ── TOAST ── */

.rpt-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #2c2c2e;
  color: #f0f0f5;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
  z-index: 9999;
}

.rpt-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── RESPONSIVE ── */

@media (max-width: 600px) {
  #rpt-content {
    padding: 24px 20px 36px;
  }

  .rpt-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .rpt-header {
    flex-direction: column;
    gap: 10px;
  }

  .rpt-header-right {
    text-align: left;
  }

  .rpt-topbar {
    gap: 8px;
    padding: 10px 16px;
  }

  .rpt-week-nav-label {
    display: none;
  }

  .rpt-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  /* Body padding for mobile bottom nav */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

  /* Toast above bottom nav */
  .rpt-toast { bottom: 80px; }

  /* Subject bars: allow name to shrink so bar has room */
  .rpt-subject-name {
    width: auto;
    min-width: 80px;
    max-width: 110px;
    font-size: 12px;
  }

  /* Chapter item: allow subject tag to wrap below */
  .rpt-chapter-item {
    flex-wrap: wrap;
    gap: 6px;
  }
  .rpt-chapter-subject {
    margin-left: 30px;
  }

  /* Mock row: allow wrapping */
  .rpt-mock-row {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ════════════════════════════════════════
   PRINT STYLES
   ════════════════════════════════════════ */

@media print {
  /* Hide UI chrome */
  .no-print { display: none !important; }

  /* Reset page */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #fff !important;
    color: #111 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  }

  /* Remove outer wrapper */
  .rpt-page-wrap {
    background: #fff !important;
    padding: 0 !important;
    min-height: unset;
    display: block;
  }

  /* Document fills the page */
  .rpt-doc {
    background: #fff !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  #rpt-content {
    padding: 28px 32px 36px !important;
  }

  /* Header */
  .rpt-brand-name { color: #111 !important; }
  .rpt-brand-sub  { color: #555 !important; }
  .rpt-week-label { color: #111 !important; }
  .rpt-student-label { color: #555 !important; }

  .rpt-rule {
    background: #e0e0e0 !important;
  }

  /* Stat boxes — white with coloured border */
  .rpt-stat-box {
    background: #fff !important;
    border: 1px solid #e0e0e0 !important;
    border-top: 3px solid var(--accent, #4E5FC0) !important;
    break-inside: avoid;
  }

  .rpt-stat-value {
    color: var(--accent, #4E5FC0) !important;
  }

  .rpt-stat-label { color: #666 !important; }

  /* Message */
  .rpt-message {
    background: rgba(78,95,192,.06) !important;
    border-left-color: #4E5FC0 !important;
  }

  .rpt-message p { color: #222 !important; }

  /* Section titles */
  .rpt-section-title { color: #777 !important; border-bottom-color: #e0e0e0 !important; }
  .rpt-empty-note    { color: #888 !important; }
  .rpt-subject-total { color: #888 !important; }

  /* Subject bars */
  .rpt-subject-name { color: #111 !important; }
  .rpt-subject-bar-wrap { background: #e8e8e8 !important; }
  .rpt-subject-bar-fill { background: #30D158 !important; }
  .rpt-subject-pct  { color: #30D158 !important; }

  /* Mocks */
  .rpt-mock-row { background: #f6f6f8 !important; break-inside: avoid; }
  .rpt-mock-label { color: #555 !important; }
  .rpt-mock-score { color: #4E5FC0 !important; }
  .rpt-mock-date  { color: #888 !important; }

  /* Chapters */
  .rpt-chapter-item { color: #111 !important; }
  .rpt-chapter-check {
    background: rgba(48,209,88,.12) !important;
    color: #1a8a3a !important;
  }
  .rpt-chapter-subject {
    background: #f0f0f5 !important;
    color: #666 !important;
  }

  /* Footer */
  .rpt-footer { border-top-color: #e0e0e0 !important; }
  .rpt-footer-brand { color: #4E5FC0 !important; }
  .rpt-footer-date  { color: #888 !important; }

  /* Page break hints */
  .rpt-section { break-inside: avoid; }
  .rpt-stats-grid { break-inside: avoid; }
}
