/* 
 * Student Timetable - Main Styles
 * Modern, Glassmorphism, Premium Aesthetics
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --tt-primary: #4f46e5;      /* Indigo-600 */
  --tt-secondary: #4338ca;    /* Indigo-700 */
  --tt-accent: #6366f1;       /* Indigo-500 */
  --tt-bg: #f8fafc;           /* Slate-50 */
  --tt-card-bg: rgba(255, 255, 255, 0.85);
  --tt-glass-border: rgba(255, 255, 255, 0.4);
  --tt-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.05), 0 4px 10px -2px rgba(0, 0, 0, 0.02);
  --tt-text-main: #0f172a;    /* Slate-900 */
  --tt-text-muted: #64748b;   /* Slate-500 */
  --tt-break-bg: #f1f5f9;     /* Slate-100 */
  --tt-border: #e2e8f0;       /* Slate-200 */
}

/* Inline Toolbar */
.long-exam-toggle {
    display: flex;
    align-items: center;
    background: #475569;
    color: white;
    font-size: 9px;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    gap: 2px;
    width: fit-content;
    height: 14px;
}
.long-exam-toggle input {
    margin: 0 !important;
    width: 10px !important;
    height: 10px !important;
    min-width: 0 !important;
    box-shadow: none !important;
}

/* Colspan Unification */
.tt-cell[colspan] {
    border-right: none !important;
}

/* Visual Link in Builder */
.cell-merged-placeholder {
    background-color: rgba(0,0,0,0.03) !important;
    opacity: 0.5;
    pointer-events: none;
    position: relative;
}
.cell-merged-placeholder::after {
    content: "← Linked";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #94a3b8;
    font-weight: bold;
}

.tt-toolbar-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--tt-border);
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.5);
}

.tt-toolbar-inline input[type="date"] {
  background: white;
  border: 1px solid var(--tt-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--tt-text-main);
  outline: none;
  transition: all 0.2s ease;
}

.tt-toolbar-inline input[type="date"]:focus {
  border-color: var(--tt-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.student-timetable-grid table {
  width: 100%;
  min-width: 800px;
  border-collapse: separate;
  border-spacing: 4px;
  font-family: 'Inter', sans-serif;
  table-layout: fixed; /* Forces table to fit container and scale */
}

/* Container - Restored Zero-Scroll (v1.4.5) */
.student-timetable-grid {
  border-radius: 12px;
  background: var(--tt-bg);
  padding: 10px;
  box-shadow: var(--tt-shadow);
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 2rem;
}

/* Dedicated Exam Table Layout (v1.4.6) - Fixed 30/35/35% No-Scroll */
.exams-timetable-container, 
#batch-exam-table-wrapper {
  overflow-x: hidden !important; /* Force NO scrolling for exams */
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
}

.exams-grid, 
#batch-exam-table {
  table-layout: fixed !important;
  width: 100% !important;
  min-width: 0 !important; /* Eliminate the 800px requirement for exams */
  border-collapse: collapse !important; /* Better for merges */
}

/* Specific Column Widths: Date(30%), Session1(35%), Session2(35%) */
.exams-grid .date-col, 
.exams-grid .date-label,
#batch-exam-table .sticky-col { 
  width: 30% !important; 
  min-width: 30% !important;
  max-width: 30% !important;
  position: static !important; /* Remove sticky logic for exams */
}

.exams-grid th:nth-child(2), 
.exams-grid td:nth-child(2),
#batch-exam-table th:nth-child(2),
#batch-exam-table td:nth-child(2) { 
  width: 35% !important; 
}

.exams-grid th:nth-child(3), 
.exams-grid td:nth-child(3),
#batch-exam-table th:nth-child(3),
#batch-exam-table td:nth-child(3) { 
  width: 35% !important; 
}

/* Bulletproof Merge Support */
.exams-grid td[colspan="2"] {
  width: 70% !important;
  display: table-cell !important; /* Ensure it stays a table cell */
}

/* Weekly Builder Specifics (v1.5.2) */
.inline-edit-grid-weekly {
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
  padding: 5px;
}

.clear-weekly-cell-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 14px;
  line-height: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  opacity: 0;
  transition: all 0.2s ease;
}

.tt-cell:hover .clear-weekly-cell-btn {
  opacity: 1;
}

.clear-weekly-cell-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* Glassmorphism Headers */
.student-timetable-grid th {
  background: var(--tt-card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--tt-glass-border);
  padding: 10px 5px;
  text-align: center;
  font-weight: 600;
  color: var(--tt-text-main);
  border-radius: 8px;
  word-wrap: break-word;
  font-size: clamp(0.7rem, 1vw, 0.95rem);
}

/* Sticky Days Column for horizontal mobile scrolling */
.student-timetable-grid th.sticky-col,
.student-timetable-grid td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 80px !important;
  min-width: 80px !important;
  max-width: 80px !important;
}

.student-timetable-grid th.sticky-col {
  z-index: 11;
}

.day-label {
  font-size: 0.7rem !important;
  color: var(--tt-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
  background: #ffffff !important;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 3px 0px 8px rgba(0,0,0,0.06);
  overflow: hidden;
  word-break: break-word;
  padding: 6px 4px !important;
  line-height: 1.2 !important;
}

/* Cells */
.tt-cell {
  background: #ffffff;
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  transition: all 0.3s ease;
  min-height: 80px;
  position: relative;
  border: 1px solid #e2e8f0;
  word-wrap: break-word;
  vertical-align: middle;
}

.tt-cell:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 2;
}

/* Subject Styling */
.subject-title {
  font-weight: 700;
  font-size: clamp(0.7rem, 1vw, 1rem);
  color: #ffffff;
  margin-bottom: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  line-height: 1.2;
}

.teacher-name, .room-number {
  font-size: clamp(0.6rem, 0.8vw, 0.8rem);
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.1;
}

/* Break Styling */
.is-break {
  background: var(--tt-break-bg) !important;
  border: 1px dashed #cbd5e1;
}

.break-text {
  font-weight: 600;
  color: var(--tt-text-muted);
  font-style: italic;
}

/* Current Period Highlighter */
.current-session {
  border: 3px solid var(--tt-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { box-shadow: 0 0 20px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

/* Setup Modal */
.tt-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
}

.tt-modal-content {
  background-color: #ffffff;
  margin: 8% auto;
  padding: 40px;
  border-radius: 24px;
  width: 450px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.15);
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.tt-close {
  position: absolute;
  right: 25px;
  top: 20px;
  font-size: 28px;
  cursor: pointer;
  color: var(--tt-text-muted);
  transition: color 0.3s ease;
}

.tt-close:hover {
  color: #ef4444;
}

.field-group {
  margin-bottom: 25px;
}

.field-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--tt-text-main);
  font-size: 0.95rem;
}

.field-group input, .field-group select {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.field-group input:focus, .field-group select:focus {
  border-color: var(--tt-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Premium Dashboard UI */
.premium-dashboard {
  background: linear-gradient(145deg, #ffffff, #f8fafc);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.05);
  border: 1px solid rgba(255,255,255,0.7);
  margin-bottom: 30px;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.header-titles h2 {
  margin: 0 0 8px 0;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--tt-text-main);
  letter-spacing: -0.5px;
}

.header-titles p {
  margin: 0;
  color: var(--tt-text-muted);
  font-size: 1rem;
}

.modern-controls, .tt-universal-controls {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 16px;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.5), 0 4px 10px rgba(0,0,0,0.03);
  margin-bottom: 30px;
  border: 1px solid #e2e8f0;
}

.control-group {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.select-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 150px;
}

.select-wrapper label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--tt-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.select-wrapper select {
  padding: 12px 40px 12px 15px !important;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background-color: white !important;
  font-weight: 500;
  font-size: 1rem;
  color: var(--tt-text-main);
  cursor: pointer;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 15px center !important;
  background-size: 16px !important;
  transition: all 0.2s ease;
  height: auto !important;
  min-height: 48px !important;
  line-height: normal !important;
  box-sizing: border-box !important;
  max-width: 100%;
}

.select-wrapper select:hover {
  border-color: var(--tt-primary);
}

.select-wrapper select:focus {
  outline: none;
  border-color: var(--tt-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.action-group {
  display: flex;
  gap: 12px;
}

.tt-btn {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
}

.tt-btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--tt-primary), var(--tt-secondary));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.9);
  color: var(--tt-text-main);
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-glass:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}

.action-group .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* Admin UI Cleanup */
.student-timetable-admin .timetable-tab-content {
  background: white;
  padding: 25px;
  border-radius: 0 0 12px 12px;
  border: 1px solid #e2e8f0;
  border-top: none;
}

/* Exams Grid Specifics */
.exams-grid {
  border-spacing: 0;
  width: 100%;
}

.exams-grid th {
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  padding: 15px;
}

.day-col {
  width: 120px;
  background: #f1f5f9;
  font-weight: 600;
  color: #475569;
}

.date-label {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}

.exams-grid td.tt-cell {
  min-width: 150px;
  height: 80px;
  vertical-align: middle;
  border: 1px solid #f1f5f9;
  transition: all 0.2s ease;
  padding: 10px;
}

.exams-grid .tt-cell.is-exam {
  background: #fff;
  border-left: 4px solid #4f46e5;
}

.exams-grid .tt-cell:hover {
  background: #f8fafc;
}

.exams-grid .subject-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.exams-grid .room-number {
  font-size: 0.85rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
}

.exams-grid .room-number .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
}

/* Batch Grid Builder Styles */
.batch-builder .cell-input-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  height: 100%;
  padding: 8px;
}

.batch-builder select, 
.batch-builder input {
  width: 100%;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  color: white; /* Contrast for colored backgrounds */
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.batch-builder select {
  font-weight: 700;
  cursor: pointer;
  appearance: none;
}

.batch-builder select option {
  color: #334155;
  background: white;
}

.batch-builder input {
  font-size: 0.8rem;
  opacity: 0.8;
}

.batch-builder input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.batch-builder td:hover select,
.batch-builder td:hover input {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
}

.batch-builder select:focus,
.batch-builder input:focus {
  background: white !important;
  color: var(--tt-text-main) !important;
  border-color: white !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  outline: none;
}

.batch-builder select:focus option {
  color: var(--tt-text-main);
}

.row-meta-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.date-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.day-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  color: #64748b;
  font-weight: 600;
}

.inline-edit-cell.is-dirty {
  box-shadow: inset 0 0 0 2px #fbbf24 !important;
}

.spin {
  animation: spin 2s linear infinite;
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

.delete-date-row {
  opacity: 0.3;
  transition: all 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  color: #ef4444;
}

.date-label:hover .delete-date-row {
  opacity: 1;
}

.delete-date-row:hover {
  transform: scale(1.2);
}

.tt-btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
}

.exams-builder-grid .tt-cell {
  cursor: pointer;
}

.exams-builder-grid .tt-cell:hover {
  border-color: #4f46e5;
  background: #eff6ff;
}

.exams-grid td.has-entry {
  background: white !important;
  box-shadow: inset 4px 0 0 var(--tt-primary);
}

.exams-grid td.has-entry:hover {
  background: #fdfdfd !important;
}

.text-primary {
  color: var(--tt-primary);
}

.empty-cell {
  color: #cbd5e1;
  font-weight: 200;
}

/* Modal Enhancements */
.tt-modal-content h3 {
  margin-top: 0;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 15px;
  margin-bottom: 20px;
  font-size: 1.25rem;
  color: #0f172a;
}

/* Toggle Switch Styling for Admin */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: #4f46e5;
}

input:focus + .slider {
  box-shadow: 0 0 1px #4f46e5;
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 24px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Inline Edit Grid (Weekly & Exams) */
.inline-edit-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.tt-inline-select, .tt-inline-input {
  width: 100% !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  color: #ffffff !important;
  text-align: center;
  font-size: 0.85rem !important;
  padding: 2px 4px !important;
  transition: all 0.2s ease !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  height: auto !important;
  min-height: 24px !important;
}

.tt-inline-select {
  font-weight: 700 !important;
  font-size: 0.9rem !important;
  cursor: pointer;
}

.tt-inline-select option {
  color: var(--tt-text-main);
  background: white;
}

.tt-inline-input {
  font-size: 0.75rem !important;
  opacity: 0.85;
}

.tt-inline-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.tt-cell:hover .tt-inline-select,
.tt-cell:hover .tt-inline-input {
  background: rgba(255, 255, 255, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

.tt-inline-select:focus,
.tt-inline-input:focus {
  background: #ffffff !important;
  color: var(--tt-text-main) !important;
  border-color: var(--tt-primary) !important;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  outline: none !important;
  opacity: 1 !important;
}

/* Dirty State (Unsaved Changes) */
.tt-cell.is-dirty {
  position: relative;
  box-shadow: inset 0 0 0 2px #fbbf24 !important;
}

.tt-cell.is-dirty::after {
  content: "●";
  position: absolute;
  top: 2px;
  right: 5px;
  color: #fbbf24;
  font-size: 10px;
}

/* Toolbar Refinement */
.tt-toolbar-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: white;
  padding: 12px 20px;
  border-radius: 16px;
  border: 1px solid var(--tt-border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  margin-bottom: 20px;
}

.tt-toolbar-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tt-toolbar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--tt-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tt-toolbar-date {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--tt-border);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  color: var(--tt-text-main);
  outline: none;
  background: #f8fafc;
}

.tt-toolbar-divider {
  width: 1px;
  height: 32px;
  background: var(--tt-border);
}

.btn-accent {
  background: var(--tt-accent);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-accent:hover {
  background: var(--tt-primary);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

/* Precise Table Alignment */
.student-timetable-grid th.sticky-col,
.student-timetable-grid td.sticky-col {
  width: 140px !important;
  min-width: 140px !important;
  max-width: 140px !important;
}

.row-meta-wrapper strong {
  font-size: 0.95rem;
  color: var(--tt-text-main);
}

.day-badge {
  background: var(--tt-primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
}

/* Frontend Tabs Refinement */
.timetable-setup-wrapper .nav-tab-wrapper {
  border-bottom: 2px solid var(--tt-border);
  margin-bottom: 30px !important;
  display: flex;
  gap: 10px;
  padding: 0 5px;
}

.timetable-setup-wrapper .nav-tab {
  background: transparent;
  border: none !important;
  color: var(--tt-text-muted);
  font-weight: 600;
  padding: 10px 15px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  position: relative;
  margin: 0 !important;
}

.timetable-setup-wrapper .nav-tab:hover {
  color: var(--tt-primary);
}

.timetable-setup-wrapper .nav-tab-active {
  color: var(--tt-primary) !important;
}

.timetable-setup-wrapper .nav-tab-active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--tt-primary);
  border-radius: 2px;
}

/* Dashboard Notices */
.tt-notice {
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tt-notice.is-info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.tt-notice.is-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Sticky Column Contrast */
.student-timetable-grid .sticky-col {
  background: white !important;
  box-shadow: 4px 0 10px rgba(0,0,0,0.02);
}

.student-timetable-grid th.sticky-col {
  background: var(--tt-bg) !important;
  z-index: 20;
}

/* Print Optimization */
@media print {
  .dashboard-header, .nav-tab-wrapper, .action-group {
    display: none !important;
  }
  .student-timetable-view {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
  .student-timetable-grid {
    overflow: visible !important;
  }
  .sticky-col {
    position: relative !important;
  }
}

/* Teacher View Controls */
.tt-view-controls-wrap {
  background: var(--tt-bg);
  border: 1px solid var(--tt-border);
  box-shadow: var(--tt-shadow);
  transition: all 0.3s ease;
}

.tt-view-controls-wrap:hover {
  border-color: var(--tt-accent);
}

.tt-toolbar-label {
  color: var(--tt-text-main);
  font-family: 'Inter', sans-serif;
}

.tt-toolbar-inline {
  display: flex;
  align-items: center;
  gap: 15px;
}

.tt-toolbar-group {
  display: flex;
  align-items: center;
}

.tt-toolbar-select {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--tt-border);
  background: white;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--tt-text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 180px;
  font-size: 0.9rem;
}

.tt-toolbar-select:focus {
  border-color: var(--tt-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  outline: none;
}

.tt-toolbar-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f1f5f9;
}

.btn-glass {
  background: white;
  border: 1px solid var(--tt-border);
  color: var(--tt-text-main);
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.btn-glass:hover {
  background: var(--tt-primary);
  color: white;
  border-color: var(--tt-primary);
}

.btn-glass .dashicons {
  font-size: 18px;
  width: 18px;
  height: 18px;
}

@media (max-width: 768px) {
  .tt-toolbar-inline {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }
  
  .tt-toolbar-group {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }
  
  .tt-toolbar-group label {
    margin-bottom: 5px;
    display: block;
  }
  
  .tt-toolbar-select {
    width: 100%;
  }
  
  .btn-glass {
    width: 100%;
    justify-content: center;
  }
}

/* FINAL UNIFIED BLOCK DESIGN (Below 500px) - VERSION 1.1.0 */
@media (max-width: 500px) {
  
  /* Reset theme-level table leakage globally for the plugin */
  .student-timetable-grid table {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    min-width: 0 !important;
    border-collapse: separate !important; /* REQUIRED for sticky columns to work */
    border-spacing: 0 !important; /* Achieves the zero-gap look */
  }

  /* --------------------------------------------------------- */
  /* 1. WEEKLY SCHEDULE: FORCED WIDE-SCROLL                  */
  /* --------------------------------------------------------- */
  #student-weekly-grid.student-timetable-grid {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    padding: 0 !important;
  }

  #student-weekly-grid table {
    width: 750px !important; 
    min-width: 750px !important;
    table-layout: fixed !important;
    border-spacing: 0 !important;
  }

  #student-weekly-grid .sticky-col {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 20 !important;
    background: #ffffff !important;
    font-size: 0.65rem !important;
    padding: 8px 2px !important;
    white-space: normal !important;
    word-break: break-all !important;
    border-right: 2px solid #e2e8f0 !important;
  }

  /* --------------------------------------------------------- */
  /* 2. EXAM SCHEDULE: BLOCK-STYLE SURGICAL CLAMP            */
  /* --------------------------------------------------------- */
  #student-exam-grid.exams-timetable-container {
    overflow: hidden !important; 
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
  }

  #student-exam-grid table.exams-grid {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    border-spacing: 0 !important;
    border: 1px solid #e2e8f0 !important;
  }

  /* Header Compression: 'Date & Day' -> 'Date' */
  #student-exam-grid th.date-col {
    font-size: 0 !important;
    padding: 12px 2px !important;
    background: #f8fafc !important;
  }
  #student-exam-grid th.date-col::after {
    content: "Date" !important;
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    display: block;
  }

  /* DATE COLUMN CLAMP (Strict 30%) */
  #student-exam-grid .sticky-col {
    width: 30% !important;
    max-width: 30% !important;
    min-width: 30% !important;
    padding: 6px 2px !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
  }

  #student-exam-grid td.sticky-col strong {
    display: block !important;
    font-size: 0.55rem !important;
    line-height: 1.1 !important;
    word-break: break-word !important;
    margin-bottom: 4px !important;
  }

  #student-exam-grid .day-badge {
    display: inline-block !important; 
    margin: 2px auto 0 !important;
    font-size: 0.48rem !important;
    padding: 2px 6px !important;
    background: #4f46e5 !important;
    color: white !important;
    border-radius: 4px !important;
    text-transform: uppercase;
    font-weight: 700 !important;
  }

  #student-exam-grid .day-label, 
  #student-exam-grid .day-col {
    display: none !important; 
  }

  /* SESSION COLUMNS CLAMP (Strict 35% Each) */
  #student-exam-grid th:not(.sticky-col):not(.day-col),
  #student-exam-grid td.tt-cell:not(.day-label) {
    width: 35% !important;
    max-width: 35% !important;
    min-width: 35% !important;
    padding: 0 !important; /* ZERO PADDING FOR BLOCK LOOK */
    box-sizing: border-box !important;
    border: 0.5px solid rgba(255,255,255,0.2) !important;
  }

  /* Premium Colorful Cells - ZERO GAPS */
  #student-exam-grid .tt-cell.is-exam {
    background-size: cover !important;
    box-shadow: inset 0 0 0 1000px rgba(0,0,0,0.05) !important;
    border-radius: 0 !important; /* Flat edges for blocks */
  }

  /* Aggressive Content Wrapping & Scaling */
  .subject-title, .p-name, .p-time {
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1 !important;
  }

  .subject-title { 
    font-size: 0.65rem !important; 
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3) !important;
    padding: 4px 2px !important;
  }

  .p-name { font-size: 0.52rem !important; }
  .p-time { font-size: 0.48rem !important; }

  .tt-cell {
    min-height: 70px !important;
    padding: 0 !important;
    vertical-align: middle !important;
  }

  #student-weekly-grid .day-label strong {
    font-size: 0.75rem !important;
    color: #4f46e5 !important;
    letter-spacing: 1px !important;
  }
}
