/* ============================================
   ROUTINES PAGES -- Shared styles
   (class-routine.html & exam-routine.html)
   ============================================ */

/* ===================================================
   ROUTINE SECTION -- Main wrapper
   =================================================== */
.routine-section {
  padding: var(--section-py) 0;
  background: linear-gradient(180deg, var(--white) 0%, var(--gray-50) 50%, var(--white) 100%);
  position: relative;
  overflow: hidden;
}

/* decorative background orbs */
.routine-section::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 380px; height: 380px;
  background: radial-gradient(circle, rgba(30,93,232,.05) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.routine-section::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(247,197,39,.05) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

/* ===================================================
   CLASS FILTER BAR -- Chip / pill row
   =================================================== */
.routine-filter-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem;
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--blue-200) transparent;
  position: relative;
  z-index: 2;
}

.routine-filter-bar::-webkit-scrollbar {
  height: 4px;
}
.routine-filter-bar::-webkit-scrollbar-track {
  background: transparent;
}
.routine-filter-bar::-webkit-scrollbar-thumb {
  background: var(--blue-200);
  border-radius: 4px;
}

.routine-filter-bar .filter-label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  margin-right: .25rem;
  flex-shrink: 0;
}

.class-chip {
  padding: .5rem 1.2rem;
  border-radius: var(--radius-full);
  font-size: .85rem;
  font-weight: 600;
  border: 2px solid var(--gray-200);
  color: var(--gray-600);
  background: var(--white);
  cursor: pointer;
  transition: all .3s var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.class-chip::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  opacity: 0;
  transition: opacity .3s var(--ease);
  z-index: -1;
}

.class-chip:hover {
  border-color: var(--blue-300);
  color: var(--blue-600);
  background: var(--blue-50);
  transform: translateY(-1px);
}

.class-chip.active {
  color: var(--white);
  border-color: var(--blue-600);
  box-shadow: 0 4px 14px rgba(30,93,232,.3);
  transform: translateY(-1px);
}
.class-chip.active::before { opacity: 1; }

/* Section dropdown (A/B/C) */
.section-select {
  padding: .5rem 1rem;
  border-radius: var(--radius-full);
  font-size: .85rem;
  font-weight: 600;
  border: 2px solid var(--gray-200);
  color: var(--gray-600);
  background: var(--white);
  cursor: pointer;
  transition: all .3s var(--ease);
  flex-shrink: 0;
  margin-left: .5rem;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364707e' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
}
.section-select:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(30,93,232,.12);
}

/* ===================================================
   TOOLBAR -- Print / actions
   =================================================== */
.routine-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.routine-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-800);
}
.routine-title span {
  color: var(--blue-600);
}

.routine-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.btn-print {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.25rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-600);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all .3s var(--ease);
}
.btn-print:hover {
  border-color: var(--blue-300);
  color: var(--blue-600);
  background: var(--blue-50);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30,93,232,.1);
}
.btn-print i {
  font-size: .9rem;
}

/* ===================================================
   TIMETABLE WRAPPER -- Premium card container
   =================================================== */
.timetable-wrapper {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-100);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}

.timetable-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.timetable-scroll::-webkit-scrollbar {
  height: 6px;
}
.timetable-scroll::-webkit-scrollbar-track {
  background: var(--gray-50);
}
.timetable-scroll::-webkit-scrollbar-thumb {
  background: var(--blue-200);
  border-radius: 3px;
}

/* ===================================================
   TIMETABLE GRID -- Table layout
   =================================================== */
.timetable-grid {
  width: 100%;
  min-width: 800px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .88rem;
}

.timetable-grid thead th {
  padding: 1rem .75rem;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--gray-700);
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 2px solid var(--gray-200);
}

/* Time column header */
.timetable-grid thead th:first-child {
  background: #f1f5f9;
  color: var(--gray-800);
  min-width: 120px;
  text-align: left;
  padding-left: 1.25rem;
}

/* Day column headers -- unified minimalistic */
.timetable-grid thead th.day-mon,
.timetable-grid thead th.day-tue,
.timetable-grid thead th.day-wed,
.timetable-grid thead th.day-thu,
.timetable-grid thead th.day-fri,
.timetable-grid thead th.day-sat { 
  /* Inherit the subtle background from th */
}

.timetable-grid thead th .day-full {
  display: inline;
}
.timetable-grid thead th .day-short {
  display: none;
}

/* Table body */
.timetable-grid tbody td {
  padding: .85rem .75rem;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-100);
  transition: background .2s var(--ease);
}
.timetable-grid tbody td:last-child {
  border-right: none;
}

/* Time slot column */
.timetable-grid tbody td:first-child {
  text-align: left;
  padding-left: 1.25rem;
  font-weight: 600;
  font-size: .8rem;
  color: var(--gray-500);
  background: var(--gray-50);
  white-space: nowrap;
  min-width: 120px;
  border-right: 2px solid var(--gray-200);
}

.time-slot-label {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.time-slot-label .time-range {
  font-size: .78rem;
  color: var(--gray-500);
  font-weight: 600;
}
.time-slot-label .slot-num {
  font-size: .7rem;
  color: var(--gray-400);
  font-weight: 500;
}

/* Alternating row backgrounds */
.timetable-grid tbody tr:nth-child(even) td {
  background: var(--gray-50);
}
.timetable-grid tbody tr:nth-child(even) td:first-child {
  background: var(--gray-100);
}

/* Row hover */
.timetable-grid tbody tr:hover td {
  background: var(--blue-50);
}
.timetable-grid tbody tr:hover td:first-child {
  background: var(--blue-100);
}

/* ===================================================
   SUBJECT CELL -- Content inside timetable cells
   =================================================== */
.subject-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
  transition: all .25s var(--ease);
}

.subject-cell .subject-name {
  font-weight: 700;
  font-size: .84rem;
  color: var(--gray-800);
  line-height: 1.3;
}

.subject-cell .teacher-name {
  font-size: .72rem;
  color: var(--gray-400);
  font-weight: 500;
  font-style: italic;
}

/* ===================================================
   SUBJECT COLOR CODING -- Soft pastel backgrounds
   =================================================== */
.subject-color-0, .subject-color-1, .subject-color-2, .subject-color-3, .subject-color-4, 
.subject-color-5, .subject-color-6, .subject-color-7, .subject-color-8, .subject-color-9 { 
  background: #f8fafc; 
  border: 1px solid #e2e8f0; 
}

/* ===================================================
   SPECIAL SLOTS -- Break, Lunch, Assembly, PT
   =================================================== */
.break-cell {
  background: linear-gradient(135deg, #fef3c7, #fde68a) !important;
  border-radius: var(--radius-sm);
  padding: .35rem .5rem;
}
.break-cell .subject-name {
  color: #92400e;
  font-weight: 600;
  font-size: .82rem;
}
.break-cell .break-icon {
  font-size: .75rem;
  margin-right: .2rem;
}

.assembly-cell {
  background: linear-gradient(135deg, var(--blue-50), var(--blue-100)) !important;
  border-radius: var(--radius-sm);
  padding: .35rem .5rem;
}
.assembly-cell .subject-name {
  color: var(--blue-700);
  font-weight: 600;
}

.pt-cell {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0) !important;
  border-radius: var(--radius-sm);
  padding: .35rem .5rem;
}
.pt-cell .subject-name {
  color: #065f46;
  font-weight: 600;
}

/* ===================================================
   EXAM SELECTOR -- Tabs / dropdown for exam selection
   =================================================== */
.exam-selector {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.exam-tab {
  padding: .6rem 1.5rem;
  border-radius: var(--radius-full);
  font-size: .85rem;
  font-weight: 600;
  border: 2px solid var(--gray-200);
  color: var(--gray-500);
  background: var(--white);
  cursor: pointer;
  transition: all .35s var(--ease);
  position: relative;
  overflow: hidden;
}
.exam-tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--blue-500), var(--blue-700));
  opacity: 0;
  transition: opacity .35s var(--ease);
  z-index: -1;
}
.exam-tab:hover {
  border-color: var(--blue-300);
  color: var(--blue-600);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30,93,232,.12);
}
.exam-tab.active {
  color: var(--white);
  border-color: var(--blue-600);
  box-shadow: 0 4px 16px rgba(30,93,232,.3);
  transform: translateY(-2px);
}
.exam-tab.active::before { opacity: 1; }

/* ===================================================
   EXAM TABLE -- Clean styled table
   =================================================== */
.exam-table-wrapper {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

.exam-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .9rem;
}

.exam-table thead th {
  padding: 1rem 1.25rem;
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
  color: var(--gray-700);
  background: #f8fafc;
  border-bottom: 2px solid var(--gray-200);
}
.exam-table thead th:first-child {
  padding-left: 1.5rem;
}

.exam-table tbody td {
  padding: .9rem 1.25rem;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
  transition: background .2s var(--ease);
}
.exam-table tbody td:first-child {
  padding-left: 1.5rem;
  font-weight: 600;
}

/* Alternating rows */
.exam-table tbody tr:nth-child(even) td {
  background: var(--gray-50);
}
.exam-table tbody tr:hover td {
  background: var(--blue-50);
}
.exam-table tbody tr:last-child td {
  border-bottom: none;
}

/* Subject emphasis */
.exam-table .exam-subject {
  font-weight: 700;
  color: var(--gray-800);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.status-badge.upcoming {
  background: var(--blue-100);
  color: var(--blue-700);
}
.status-badge.ongoing {
  background: #d1fae5;
  color: #059669;
}
.status-badge.completed {
  background: var(--gray-100);
  color: var(--gray-500);
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-badge.upcoming .dot  { background: var(--blue-500); }
.status-badge.ongoing .dot   { background: #0ea572; }
.status-badge.completed .dot { background: var(--gray-400); }

/* ===================================================
   LOADING SKELETON
   =================================================== */
.routine-skeleton {
  padding: 1.5rem;
}

.skeleton-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.skeleton-cell {
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  flex: 1;
}

.skeleton-cell.narrow {
  max-width: 120px;
  flex: 0 0 120px;
}

.skeleton-header {
  height: 56px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: skeletonPulse 1.5s ease-in-out infinite;
  margin-bottom: 1rem;
}

@keyframes skeletonPulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===================================================
   EMPTY STATE
   =================================================== */
.routine-empty {
  text-align: center;
  padding: 4rem 2rem;
}

.routine-empty .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-50), var(--blue-100));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  color: var(--blue-400);
}

.routine-empty h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--gray-700);
  margin-bottom: .5rem;
}

.routine-empty p {
  font-size: .92rem;
  color: var(--gray-400);
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===================================================
   SECTION TITLE -- within routine cards
   =================================================== */
.routine-section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: .5rem;
}

.routine-section-subtitle {
  font-size: .95rem;
  color: var(--gray-500);
  margin-bottom: 2rem;
}

/* ===================================================
   INFO BANNER -- Quick info strip below filters
   =================================================== */
.routine-info-strip {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1.25rem;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: .85rem;
  color: var(--blue-700);
}
.routine-info-strip i {
  font-size: 1rem;
  color: var(--blue-500);
  flex-shrink: 0;
}
.routine-info-strip strong {
  font-weight: 700;
}

/* ===================================================
   LEGEND -- subject color legend
   =================================================== */
.subject-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 1px solid var(--gray-100);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 500;
  color: var(--gray-600);
}

.legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.06);
  flex-shrink: 0;
}

/* ===================================================
   ANIMATIONS -- Fade-in for timetable
   =================================================== */
@keyframes routineFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.routine-fade-in {
  animation: routineFadeIn .5s var(--ease) forwards;
}

/* ===================================================
   PRINT STYLES
   =================================================== */
@media print {
  /* Force landscape and margins for wide tables */
  @page {
    size: landscape;
    margin: 0;
  }

  /* Hide elements that shouldn't be printed */
  .navbar, .footer, .page-hero, .breadcrumb, .routine-filter-bar, .routine-print-btn, .btn-print,
  .routine-actions, .routine-info-strip, .subject-legend, .back-to-top, section[style*="padding:3rem 0;"],
  .type-toggle, .toolbar, .routine-stats,
  .routine-section::before, .routine-section::after {
    display: none !important;
  }

  /* Reset main container spacing for print */
  body {
    padding: 10mm !important;
    margin: 0 !important;
    background: #fff !important;
  }
  
  .routine-section, .container, .routine-card-container {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* Allow normal flow so it prints across pages */
  .timetable-wrapper, .exam-table-wrapper {
    position: relative !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
  }

  /* Optimize table fonts and colors for print */
  .timetable-grid, .exam-table {
    min-width: 0 !important;
    font-size: .7rem !important;
    width: 100% !important;
    table-layout: fixed !important;
  }
  
  /* Prevent word break issues in small cells */
  .subject-cell {
    padding: .15rem !important;
    word-break: break-word !important;
  }
  
  .timetable-grid tbody td, .exam-table tbody td {
    padding: .2rem !important;
  }

  /* Make sure headers stay on each page */
  .timetable-grid thead, .exam-table thead {
    display: table-header-group;
  }
  .timetable-grid tr, .exam-table tr {
    page-break-inside: avoid;
  }

  /* Header background */
  .timetable-grid thead th, .exam-table thead th {
    background-color: #f1f5f9 !important;
    color: #1e293b !important;
    border-bottom: 2px solid #cbd5e1 !important;
    padding: .3rem !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ===================================================
   RESPONSIVE -- 1024px (tablet landscape)
   =================================================== */
@media (max-width: 1024px) {
  .routine-section {
    padding: 4rem 0;
  }
  .timetable-grid {
    font-size: .84rem;
  }
}

/* ===================================================
   RESPONSIVE -- 768px (tablet portrait)
   =================================================== */
@media (max-width: 768px) {
  .routine-section {
    padding: 3.5rem 0;
  }

  .routine-filter-bar {
    padding: .35rem;
    gap: .4rem;
    margin-bottom: 1.5rem;
  }

  .class-chip {
    padding: .45rem 1rem;
    font-size: .8rem;
  }

  .routine-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: .75rem;
  }

  .routine-title {
    font-size: 1.2rem;
  }

  .timetable-grid thead th .day-full {
    display: none;
  }
  .timetable-grid thead th .day-short {
    display: inline;
  }

  .timetable-grid thead th {
    padding: .75rem .5rem;
    font-size: .75rem;
  }

  .timetable-grid tbody td {
    padding: .65rem .5rem;
  }

  .subject-cell .subject-name {
    font-size: .78rem;
  }
  .subject-cell .teacher-name {
    font-size: .68rem;
  }

  /* Exam selector wraps */
  .exam-selector {
    gap: .4rem;
  }
  .exam-tab {
    padding: .5rem 1rem;
    font-size: .8rem;
  }

  .exam-table {
    font-size: .84rem;
  }
  .exam-table thead th,
  .exam-table tbody td {
    padding: .75rem 1rem;
  }

  .routine-empty {
    padding: 3rem 1.5rem;
  }

  .subject-legend {
    gap: .4rem;
    padding: .75rem 1rem;
  }
}

/* ===================================================
   RESPONSIVE -- 480px (phone)
   =================================================== */
@media (max-width: 480px) {
  .routine-section {
    padding: 3rem 0;
  }

  .routine-filter-bar .filter-label {
    display: none;
  }

  .class-chip {
    padding: .4rem .85rem;
    font-size: .78rem;
  }

  .section-select {
    padding: .4rem .75rem;
    font-size: .8rem;
    padding-right: 1.75rem;
  }

  .routine-title {
    font-size: 1.1rem;
  }

  .btn-print {
    padding: .5rem 1rem;
    font-size: .8rem;
  }
  .btn-print .btn-print-text {
    display: none;
  }

  .timetable-grid {
    min-width: 650px;
    font-size: .8rem;
  }
  .timetable-grid tbody td:first-child {
    min-width: 95px;
    padding-left: .75rem;
  }

  .routine-info-strip {
    font-size: .8rem;
    padding: .6rem 1rem;
  }

  .exam-table thead th,
  .exam-table tbody td {
    padding: .65rem .75rem;
    font-size: .8rem;
  }

  .routine-empty .empty-icon {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
  }
  .routine-empty h3 {
    font-size: 1.15rem;
  }
  .routine-empty p {
    font-size: .85rem;
  }
}

/* ===================================================
   RESPONSIVE -- 360px (very small phone)
   =================================================== */
@media (max-width: 360px) {
  .class-chip {
    padding: .35rem .7rem;
    font-size: .74rem;
  }

  .timetable-grid {
    min-width: 580px;
  }

  .routine-title {
    font-size: 1rem;
  }

  .exam-tab {
    padding: .4rem .75rem;
    font-size: .75rem;
  }
}

/* ===================================================
   ADDITIONAL CLASSES -- used by HTML pages
   =================================================== */

/* -- Card Container ------------------------------- */
.routine-card-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid rgba(0,0,0,.04);
}

/* -- Header Bar ----------------------------------- */
.routine-card-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-800));
  color: var(--white);
}

.routine-card-header-bar h2 {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--white);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.routine-card-header-bar h2 i { opacity: 0.8; }

/* -- Print Button --------------------------------- */
.routine-print-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
  backdrop-filter: blur(4px);
}
.routine-print-btn:hover {
  background: rgba(255,255,255,0.25);
  transform: translateY(-1px);
}

/* -- Filter Label --------------------------------- */
.routine-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-500);
  white-space: nowrap;
  margin-right: 0.25rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* -- Routine Chip (alias for class-chip used by HTML) -- */
.routine-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: var(--white);
  color: var(--gray-600);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s var(--ease);
  white-space: nowrap;
  font-family: var(--font-sans);
  flex-shrink: 0;
}
.routine-chip:hover {
  border-color: var(--blue-300);
  color: var(--blue-600);
  background: var(--blue-50);
}
.routine-chip.active {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: var(--white);
  border-color: var(--blue-600);
  box-shadow: 0 4px 12px rgba(30,93,232,0.25);
}

/* -- Subject Colors (subj-color-N alias) ---------- */
.subj-color-0, .subj-color-1, .subj-color-2, .subj-color-3, .subj-color-4,
.subj-color-5, .subj-color-6, .subj-color-7, .subj-color-8, .subj-color-9 {
  background: #f8fafc;
  color: var(--gray-800);
  border: 1px solid #e2e8f0;
}

/* -- Special Slot --------------------------------- */
.subject-cell.special-slot {
  background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
  color: var(--gray-500);
  font-style: italic;
  border: 1px dashed var(--gray-300);
}

/* -- Subject Teacher ------------------------------ */
.subject-teacher {
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: 500;
}

/* -- Empty Cell ----------------------------------- */
.empty-cell {
  color: var(--gray-300);
  font-size: 0.78rem;
  font-style: italic;
}

/* -- Routine Empty State -------------------------- */
.routine-empty-state {
  text-align: center;
  padding: 4rem 2rem;
}
.routine-empty-state .empty-icon-circle {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-50), var(--gray-100));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  color: var(--blue-300);
}
.routine-empty-state .empty-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-50), var(--gray-100));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2rem;
  color: var(--blue-300);
}
.routine-empty-state h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}
.routine-empty-state p {
  color: var(--gray-400);
  font-size: 0.88rem;
  max-width: 400px;
  margin: 0 auto;
}

/* -- Routine Loading Container -------------------- */
.routine-loading {
  animation: routineFadeIn 0.3s ease;
}

/* -- Skeleton Loaders (class-routine page) -------- */
.skel-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}
.skel-item {
  height: 20px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmerRoutine 1.5s infinite;
}

/* -- Skeleton Loaders (exam-routine page) -------- */
.skeleton-bar {
  border-radius: 8px;
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmerRoutine 1.5s infinite;
}
.skeleton-chips {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0 1rem;
}
.skeleton-chip {
  width: 80px;
  height: 34px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-50) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmerRoutine 1.5s infinite;
}
.skeleton-card {
  padding: 1.5rem;
  margin: 0 1rem;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
}

@keyframes shimmerRoutine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes routineFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* -- Exam Info Card ------------------------------- */
.exam-info-card {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--gray-100);
  background: var(--white);
}
.exam-info-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}
.exam-info-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.exam-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gray-900);
  font-family: var(--font-sans);
  margin: 0;
}
.exam-info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}
.exam-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--gray-500);
}
.exam-meta-item i {
  color: var(--blue-500);
  font-size: 0.9rem;
}

/* -- Exam Class Badges ---------------------------- */
.exam-class-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue-600);
}

/* -- Exam Status Badge ---------------------------- */
.exam-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.exam-status-badge.upcoming {
  background: var(--blue-50);
  color: var(--blue-600);
  border: 1px solid rgba(30,93,232,0.15);
}
.exam-status-badge.ongoing {
  background: #d1fae5;
  color: #059669;
  border: 1px solid rgba(5,150,105,0.15);
}
.exam-status-badge.completed {
  background: var(--gray-100);
  color: var(--gray-500);
  border: 1px solid var(--gray-200);
}

/* -- Exam Countdown ------------------------------- */
.exam-countdown {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  margin: 1rem 0;
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: #92400e;
}
.exam-countdown i { color: #d97706; }
.exam-countdown.today {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border-color: rgba(30,93,232,0.2);
  color: var(--blue-700);
}
.exam-countdown.today i { color: var(--blue-600); }

/* -- Exam Select Dropdown ------------------------- */
.exam-select-dropdown {
  padding: 8px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-800);
  background: var(--white);
  min-width: 250px;
  cursor: pointer;
  transition: border-color 0.2s ease;
}
.exam-select-dropdown:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(30,93,232,0.1);
}

/* -- Exam Table Scroll ---------------------------- */
.exam-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* -- Exam Table Column styles --------------------- */
.exam-col-num {
  width: 50px;
  text-align: center;
  font-weight: 700;
  color: var(--gray-400);
  font-size: 0.82rem;
}
.exam-col-date {
  font-weight: 700;
  color: var(--gray-900);
  white-space: nowrap;
}
.exam-col-day {
  color: var(--gray-500);
  font-weight: 500;
  white-space: nowrap;
}
.exam-col-time {
  color: var(--blue-600);
  font-weight: 600;
  white-space: nowrap;
}
.exam-col-subject {
  font-weight: 600;
  color: var(--gray-800);
}

/* -- Exam Row States ------------------------------ */
.exam-row-today {
  background: linear-gradient(90deg, rgba(30,93,232,0.06), rgba(30,93,232,0.02)) !important;
  border-left: 3px solid var(--blue-600);
}
.exam-row-today td { font-weight: 700; }

.exam-row-past {
  opacity: 0.45;
}
.exam-row-past td {
  text-decoration: line-through;
  text-decoration-color: var(--gray-300);
}

/* -- Responsive additions ------------------------- */
@media (max-width: 768px) {
  .routine-card-header-bar {
    padding: 1rem 1.25rem;
    flex-direction: column;
    align-items: flex-start;
  }
  .exam-info-card { padding: 1rem 1.25rem; }
  .exam-info-top { flex-direction: column; }
  .exam-title { font-size: 1.05rem; }
  .exam-select-dropdown { min-width: unset; width: 100%; }
  .exam-info-meta { gap: 0.75rem; }
  .routine-filter-label { display: none; }
  .routine-chip { padding: 6px 12px; font-size: 0.78rem; }
}

@media (max-width: 480px) {
  .routine-chip { padding: 5px 10px; font-size: 0.75rem; }
  .exam-col-num { display: none; }
}

/* -- Print Overrides ------------------------------ */
@media print {
  .navbar, .footer, .back-to-top, .page-hero,
  .routine-filter-bar, .routine-print-btn,
  .exam-selector, .routine-section-filter,
  .exam-countdown, #examSelectorWrap { display: none !important; }
  .routine-section { padding: 0; }
  .routine-card-container { box-shadow: none; border: 1px solid #ddd; }
  .routine-card-header-bar {
    background: #f0f4f8 !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .routine-card-header-bar h2 { color: #000 !important; }
  .subject-cell { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .exam-row-past { opacity: 1; }
  .exam-row-past td { text-decoration: none; }
}
