/* --- CSS VARIABLES --- */
:root {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-main: #e0e0e0;
  --text-muted: #a0a0a0;
  --border-color: #333;
  --accent-color: #bb86fc;
  --accent-hover: #9965f4;
  --header-bg: #2c2c2c;
   
  /* Slot Type Markers */
  --lec-marker: #90caf9;
  --tut-marker: #ffcc80;
  --lab-marker: #ef9a9a;
  --break-marker: #424242; 
   
  --active-glow: 0 0 15px rgba(187, 134, 252, 0.5);

  /* Break Card Colors */
  --break-bg: #000000;
  --break-border: #333;
}

[data-theme="light"] {
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-main: #333333;
  --text-muted: #555555;
  --border-color: #e0e0e0;
  --accent-color: #6200ea;
  --accent-hover: #5000c9;
  --header-bg: #ffffff;

  /* Slot Type Markers */
  --lec-marker: #0d47a1;
  --tut-marker: #e65100;
  --lab-marker: #c62828;
  --break-marker: #9e9e9e;

  --active-glow: 0 0 15px rgba(98, 0, 234, 0.4);

  /* Break Card Colors Light */
  --break-bg: #e0e0e0;
  --break-border: #ccc;
}

/* --- GLOBAL --- */
* { 
  box-sizing: border-box; 
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  transition: background-color 0.3s ease;
}

/* --- HEADER --- */
header {
  flex: 0 0 auto;
  width: 100%;
  height: 70px;
  padding: 0 15px;
  background: var(--header-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  z-index: 1100;
  position: relative;
  transition: all 0.3s ease;
}

.brand-container {
  display: flex; 
  align-items: center; 
  gap: 15px;

  padding-right: 12px;                    /* Space between "Planner" and the line */
  border-right: 2px solid var(--border-color); /* The vertical divider line */
  margin-right: 5px;                      /* Tiny gap after the line */
  height: 45px;
}

.app-logo {
  height: 45px; 
  width: 45px; 
  border-radius: 8px; 
  object-fit: cover; 
  border: 1px solid var(--border-color);
  transition: border-color 0.3s ease;
}

h1 {
  font-weight: 800; 
  font-size: 1.3rem; 
  margin: 0;
  background: linear-gradient(90deg, var(--accent-color), #03dac6);
  -webkit-background-clip: text; 
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-controls { 
  display: flex; 
  gap: 10px; 
  align-items: center; 
}

.icon-btn {
  background: transparent; 
  border: none; 
  color: var(--text-main);
  font-size: 1.4rem; 
  cursor: pointer; 
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(128, 128, 128, 0.1);
}

/* --- RECTANGULAR DROPDOWN --- */
.batch-dropdown-container {
  position: relative;
  width: 100%;
  margin-bottom: 15px;
}

.dropdown-trigger {
  width: 100%;
  padding: 12px 15px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-trigger:hover,
.dropdown-trigger:focus {
  border-color: var(--accent-color);
  outline: none;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 300px;
  overflow-y: auto;
  background: var(--header-bg);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  margin-top: 8px;
  padding: 15px;
  z-index: 200;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  transition: all 0.3s ease;
}

.dropdown-content.show {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.batch-btn {
  padding: 10px 5px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  text-align: center;
}

.batch-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
}

.batch-btn:active {
  transform: translateY(0);
}

.batch-btn.active-batch {
  background: rgba(187, 134, 252, 0.15);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

/* --- FILTER PANEL --- */
.filter-toggle-btn {
  background: var(--accent-color); 
  color: #fff;
  border: none; 
  padding: 8px 16px; 
  border-radius: 20px;
  font-weight: 700; 
  font-size: 0.9rem; 
  cursor: pointer;
  display: flex; 
  align-items: center; 
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(187,134,252,0.25);
}

.filter-toggle-btn:hover { 
  background: var(--accent-hover); 
}

#filter-panel {
  background: var(--header-bg);
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0.0, 0.2, 1);
  border-bottom: 1px solid var(--border-color);
  position: relative;
  z-index: 90;
  flex: 0 0 auto;
}

#filter-panel.expanded {
  max-height: 80vh;
  overflow-y: auto;
}

.filter-content { 
  padding: 20px 20px; 
  display: flex; 
  flex-direction: column; 
  gap: 25px; 
}

.filter-group { 
  display: flex; 
  flex-direction: column; 
  gap: 12px; 
  position: relative; 
  z-index: 10;
}

.filter-label { 
  font-size: 0.85rem; 
  color: var(--text-muted); 
  font-weight: 700; 
  text-transform: uppercase; 
  letter-spacing: 1.5px; 
  margin-left: 4px;
}

.filter-options { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 12px; 
  justify-content: flex-start;
}

.toggle-btn {
 flex: 1; /* Makes them share full width */
  padding: 12px 10px;
  background: var(--card-bg); 
  border: 2px solid var(--border-color);
  color: var(--text-muted); 
  font-weight: 600; 
  border-radius: 10px;
  cursor: pointer; 
  transition: all 0.2s ease; 
  min-width: 65px;
  font-size: 0.85rem;
}

.toggle-btn:hover {
  border-color: var(--accent-color);
}

.toggle-btn.active {
  background: rgba(187, 134, 252, 0.15); 
  color: var(--accent-color);
  border-color: var(--accent-color);
}

.day-btn {
  width: 42px; 
  height: 42px; 
  border-radius: 12px;
  background: var(--card-bg); 
  border: 2px solid var(--border-color);
  color: var(--text-muted); 
  font-weight: 700; 
  font-size: 0.9rem;
  display: flex; 
  align-items: center; 
  justify-content: center;
  cursor: pointer; 
  transition: all 0.2s ease;
  flex-grow: 1; /* Allows them to stretch slightly */
  max-width: 50px;
}

.day-btn:hover {
  border-color: var(--accent-color);
}

.day-btn.active-day {
  background: var(--accent-color); 
  color: #fff; 
  border-color: var(--accent-color);
  box-shadow: 0 4px 12px rgba(187, 134, 252, 0.3);
}

/* --- VIEW CONTAINERS --- */
.view-container { 
  flex: 1; 
  position: relative; 
  overflow: hidden; 
  width: 100%; 
  transition: opacity 0.3s ease;
}

.hidden-view { 
  display: none !important; 
}

#timetable-container { 
  cursor: grab; 
  touch-action: pan-y; 
  user-select: none;
}

#timetable-container:active { 
  cursor: grabbing; 
}

.days-track { 
  display: flex; 
  height: 100%; 
  width: 600vw; 
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.5, 1); 
}

.day-view { 
  width: 100vw; 
  height: 100%; 
  overflow-y: auto; 
  padding: 15px; 
  padding-bottom: 80px; 
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) transparent;
}

.day-view::-webkit-scrollbar {
  width: 4px;
}

.day-view::-webkit-scrollbar-track {
  background: transparent;
}

.day-view::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 20px;
}

.day-header {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 8px 0 16px;
  color: var(--accent-color);
  text-align: center;
  position: sticky;
  top: 0;
  padding: 10px 0;
  background: linear-gradient(
    to bottom,
    rgba(18,18,18,0.95),
    rgba(18,18,18,0.7),
    transparent
  );
  z-index: 10;
}
body[data-theme="light"] .day-header {
  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.95),
    rgba(255,255,255,0.75),
    transparent
  );
}




.floating-batch {
  position: absolute;
  top: 15px;
  right: 15px;
  background-color: rgba(30, 30, 30, 0.85);
  color: var(--accent-color);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.85rem;
  z-index: 50;
  pointer-events: auto !important; /* <--- CHANGE THIS from 'none' to 'auto' */
  cursor: pointer;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  letter-spacing: 0.5px;
  transition: opacity 0.2s ease;
}
.floating-batch.hide-self {
  opacity: 0;
  pointer-events: none;
}
[data-theme="light"] .floating-batch {
  background-color: rgba(255, 255, 255, 0.85);
}

.class-card { 
  background: var(--card-bg); 
  border-radius: 16px; 
  padding: 15px; 
  margin-bottom: 15px; 
  border: none;
  box-shadow: 0 6px 18px rgba(0,0,0,0.35); 
  position: relative; 
  overflow: hidden; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
  transition: all 0.3s ease;
}

.class-card::before { 
  content: ''; 
  position: absolute; 
  left: 0; 
  top: 0; 
  height: 100%; 
  width: 5px; 
}

.type-lec::before { 
  background-color: var(--lec-marker); 
}

.type-tut::before { 
  background-color: var(--tut-marker); 
}

.type-lab::before { 
  background-color: var(--lab-marker); 
}

.active-now { 
  border: 2px solid var(--accent-color) !important; 
  box-shadow: var(--active-glow) !important; 
  position: relative;
  z-index: 5;
  animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: var(--active-glow);
  }
  50% {
    box-shadow: 0 0 20px rgba(187, 134, 252, 0.8);
  }
}

.time-slot { 
  font-size: 1rem; 
  color: var(--accent-color); 
  font-weight: 700; 
  display: flex; 
  align-items: center; 
  gap: 8px;
  margin-bottom: 4px;
}

.time-slot::before { 
  content: '•'; 
  color: var(--accent-color); 
  opacity: 0.6;
  font-size: 1rem; 
}

.subject-name { 
  font-size: 1.5rem; 
  font-weight: 800; 
  margin: 4px 0; 
  line-height: 1.2;
  letter-spacing: 0.5px;
}

.card-footer { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 12px; 
  margin-top: 12px; 
  padding-top: 14px; 
  border-top: 1px solid var(--border-color); 
  font-size: 0.8rem; 
  color: var(--text-muted); 
}

.info-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  color: rgba(255,255,255,0.95);
  border: 1px solid rgba(255,255,255,0.1);
}




.break-card { 
  background: var(--break-bg); 
  border: 1px solid var(--break-border); 
  border-radius: 20px; 
  padding: 15px; 
  margin-bottom: 15px; 
  display: flex; 
  flex-direction: column; 
  gap: 6px; 
  transition: all 0.3s ease;
}

.break-header { 
  font-size: 1rem; 
  font-weight: 700; 
  color: var(--text-main); 
}

.break-time-text { 
  font-size: 0.85rem; 
  color: var(--text-muted); 
  font-family: monospace; 
}

/* --- TABLE VIEW --- */
#compact-container { 
  display: block;
  width: 100%;
  height: 100%;            /* Fills vertical space */
  overflow-x: auto;        
  overflow-y: hidden;      
  padding: 0;
  padding-bottom: 60px;    /* Keeps space for your footer */
  background-color: var(--bg-color); 
}

#compact-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#compact-container::-webkit-scrollbar-track {
  background: transparent;
}

#compact-container::-webkit-scrollbar-thumb {
  background-color: var(--accent-color);
  border-radius: 20px;
}

.weekly-table { 
  height: 100%;            /* Forces table to stretch vertically */
  width: 100%; 
  min-width: 750px;        
  border-collapse: collapse;
  table-layout: fixed;
}

.weekly-table th, .weekly-table td { 
  padding: 10px 6px; 
  text-align: center; 
  vertical-align: middle; 
  font-size: 0.8rem; 
  border-right: 1px solid var(--border-color); 
  border-bottom: 1px solid var(--border-color); 
  color: var(--text-main); 
  transition: all 0.3s ease;
}

.weekly-table thead th { 
  position: sticky; 
  top: 0; 
  height: 50px;
  vertical-align: middle;
  background-color: var(--header-bg); 
  z-index: 50; 
  border-bottom: 2px solid var(--border-color); 
  font-weight: 800; 
  text-transform: uppercase; 
  font-size: 0.75rem; 
}

/* New Fixed Column for Days (Mon, Tue, Wed...) */
.weekly-table th:first-child,
.weekly-table td:first-child,
.day-col-header {
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
  position: sticky;
  left: 0;
  z-index: 60;
  background-color: var(--card-bg);
  border-right: 2px solid var(--border-color);
  color: var(--accent-color);
  font-weight: 800;
  text-align: center;
}



.cell-lec { 
  background-color: rgba(144, 202, 249, 0.15); 
  border-left: 3px solid var(--lec-marker) !important; 
}

.cell-tut { 
  background-color: rgba(255, 204, 128, 0.15); 
  border-left: 3px solid var(--tut-marker) !important; 
}

.cell-lab { 
  background-color: rgba(239, 154, 154, 0.15); 
  border-left: 3px solid var(--lab-marker) !important; 
}

.cell-break { 
  background-color: var(--break-bg); 
  opacity: 0.7; 
}

.cell-subject { 
  font-weight: 700; 
  display: block; 
  margin-bottom: 2px; 
  font-size: 0.85rem;
}

.cell-room { 
  font-size: 0.7rem; 
  color: var(--text-muted); 
  display: block; 
}

/* --- HIGHLIGHT CURRENT DAY ROW (Table View) --- */
.weekly-table tr.active-day-row {
  background-color: rgba(187, 134, 252, 0.08) !important; 
  position: relative;
  z-index: 5; 
}

/* --- FIX FOR TEXT OVERLAP --- */
.weekly-table tr.active-day-row td:first-child {
  border-left: 4px solid var(--accent-color) !important;
  
  /* 1. We MUST use a SOLID background color to block text scrolling behind */
  background-color: var(--card-bg) !important; 

  /* 2. We apply the purple tint as an "Image" layer on top of the solid color */
  background-image: linear-gradient(
    rgba(187, 134, 252, 0.15), 
    rgba(187, 134, 252, 0.15)
  ) !important;
}

/* Light Mode Support */
[data-theme="light"] .weekly-table tr.active-day-row {
  background-color: rgba(98, 0, 234, 0.08) !important;
}

[data-theme="light"] .weekly-table tr.active-day-row td:first-child {
  background-color: var(--card-bg) !important; /* Solid White */
  background-image: linear-gradient(
    rgba(98, 0, 234, 0.08), 
    rgba(98, 0, 234, 0.08)
  ) !important;
}
/* -------------------------------------------------- */
.weekly-table td.active-now {
  border: 2px solid var(--accent-color) !important;
  background-color: rgba(187, 134, 252, 0.2) !important;
  box-shadow: 0 0 15px rgba(187, 134, 252, 0.4) !important;
  z-index: 25;
  position: relative;
  animation: tablePulse 2s infinite;
}

@keyframes tablePulse {
  0%, 100% {
    box-shadow: inset 0 0 10px var(--accent-color);
  }
  50% {
    box-shadow: inset 0 0 15px var(--accent-color);
  }
}
/* In the TABLE VIEW section, add: */



.weekly-table th {
  width: 11%; /* Roughly 100% / 9 */
  min-width: 60px;
}

.weekly-table td {
  height: auto !important; /* Allows rows to expand */
  vertical-align: middle;
  padding: 3px !important;
  white-space: normal;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}



/* Ensure rowspan cells don't break layout */
.weekly-table td[rowspan] {
  position: relative;
}

.cell-lec[colspan],
.cell-tut[colspan],
.cell-lab[colspan] {
  background-image: linear-gradient(
    135deg,
    rgba(0, 0, 0, 0.2) 0%,   
    rgba(0, 0, 0, 0.2) 90%, 
    var(--border-color) 90%, 
    var(--border-color) 100%
  );
  background-blend-mode: multiply;
}
/* --- FOOTER (Restored Vibe) --- */
/* --- FOOTER (Tab Style - Flush to Bottom) --- */
.footer-sig { 
  position: fixed !important; 
  bottom: 0 !important;                  /* 1. Touches the bottom edge */
  left: 50% !important; 
  transform: translateX(-50%) !important; 
  
  width: auto !important;                
  max-width: 90% !important;
  
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  
  /* 2. The Look: Tab style (Flat bottom, rounded top) */
  background: rgba(30, 30, 30, 0.98) !important; 
  backdrop-filter: blur(10px) !important;
  
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-bottom: none !important;        /* No border on bottom edge */
  border-radius: 16px 16px 0 0 !important; /* Top-left, Top-right, Bottom-right, Bottom-left */
  
  padding: 6px 24px !important;          
  padding-bottom: calc(6px + env(safe-area-inset-bottom)) !important; /* Respects iPhone home bar */
  
  /* Text Styles (Unchanged) */
  color: var(--text-muted) !important; 
  font-size: 0.75rem !important;          
  font-weight: 600 !important;
  white-space: nowrap !important;
  
  /* Layering */
  z-index: 9999 !important;              
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3) !important; /* Shadow points UP now */
}

/* Light Mode Support */
[data-theme="light"] .footer-sig {
  background: rgba(255, 255, 255, 0.98) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-bottom: none !important;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1) !important;
}

.signature { 
  color: var(--accent-color) !important; 
  font-weight: 800 !important;
  margin: 0 4px !important;
}
/* --- LOADING STATE --- */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* --- ACCESSIBILITY --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
  .batch-grid {
    grid-template-columns: repeat(2, 1fr);
  }
.info-badge {
    font-size: 0.9rem;
    padding: 6px 12px;
  }
  
  .filter-options {
    justify-content: center;
  }
  
  h1 {
    font-size: 1.1rem;
  }
  
  .class-card {
    padding: 18px;
    margin-bottom: 18px;
  }
  
  .subject-name {
    font-size: 1.4rem;
    line-height: 1.3;
  }
}
/* Ensure day view scrolls properly */
.day-view { 
  width: 100vw; 
  height: 100%; 
  overflow-y: auto !important;
  overflow-x: hidden;
  padding: 15px; 
  padding-bottom: 80px; 
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) transparent;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  overscroll-behavior: contain; /* Prevent scroll chaining */
  touch-action: pan-y; /* Allow vertical panning */
}

/* Improve touch experience */
.class-card, .break-card {
  touch-action: pan-y; /* Allow scrolling on cards */
}

/* Prevent text selection during swipe */
.days-track {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

body[data-theme="light"] .info-badge {
  background: rgba(0,0,0,0.06);
  color: rgba(0,0,0,0.75);
}



/* --- DUAL DROPDOWN STYLES --- */
.batch-selector-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 15px;
}

select.dropdown-trigger {
  appearance: none; /* Remove default arrow to use our style if needed, or keep native */
  background-color: var(--card-bg);
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 10px;
  /* Add a custom arrow if you want, or rely on browser default */
}

.half-width {
  width: 50%;
  text-align: center;
  text-align-last: center; /* Centers text in dropdown for Chrome */
}

select:focus {
  border-color: var(--accent-color);
  outline: none;
}
/* --- BATCH TABS (Inside Dropdown) --- */
.batch-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
  box-shadow: 0 2px 8px rgba(187, 134, 252, 0.25);
}

/* Fix grid to ensure buttons look good */
.batch-btn {
  font-family: monospace; /* Makes alignment of A1, A10 cleaner */
  font-size: 0.9rem;
}

/* --- EMBEDDED BATCH SELECTOR --- */
.batch-selection-embedded {
  display: block; /* Forces it to show */
  width: 100%;
  position: relative;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-top: 10px;
}
/* --- CONTAINER FOR CONTROLS --- */
.filter-group {
  position: relative; /* Crucial for floating positioning */
  z-index: 10;
}

.batch-selector-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

/* --- THE CONTROLS (Left & Right) --- */
.dropdown-trigger {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.half-width {
  flex: 1; /* Both take equal space */
  width: 50%;
}

/* --- THE FLOATING GRID (The Fix) --- */
.floating-grid {
  position: absolute; /* Floats on top! */
  top: 75px;          /* Pushes it below the buttons */
  left: 0;
  width: 100%;
  background-color: var(--header-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px;
  z-index: 999;       /* Ensures it sits ABOVE everything else */
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  max-height: 250px;  /* Scrollable if too long */
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 Columns */
  gap: 8px;
}

/* Hide it by default */
.floating-grid.hidden {
  display: none;
}

/* Scrollbar for the grid */
.floating-grid::-webkit-scrollbar { width: 4px; }
.floating-grid::-webkit-scrollbar-thumb { background: var(--accent-color); border-radius: 4px; }

/* --- FIX LAYERING ISSUE --- */
.bring-to-front {
  position: relative;
  z-index: 1000; /* Forces this group ABOVE the View Mode group */
}

/* Ensure the grid background is solid so you can't see buttons behind it */
.floating-grid {
  background-color: var(--header-bg); /* Opaque background */
  box-shadow: 0 10px 40px rgba(0,0,0,0.8); /* Stronger shadow */
}

/* --- TEACHER MODE STYLES --- */

/* The Circular Button */
#teacher-mode-btn {
  height: 40px;
  padding: 0 16px;           /* More padding for text */
  border-radius: 20px;       /* Pill shape, not circle */
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 700;
  margin-right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;                  /* Space between Icon and Text */
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  width: auto;
}

.t-icon {
  font-size: 1.2rem;
  line-height: 1;
}
/* Glowing Active State */
#teacher-mode-btn.active-mode {
  background: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;               /* White text when active */
  box-shadow: 0 0 15px var(--accent-color);
  transform: scale(1.05);
  z-index: 101;
}

@media (max-width: 480px) {
  #teacher-mode-btn {
    width: 40px;             /* Fixed width */
    padding: 0;              /* Remove padding */
    justify-content: center; /* Center the icon */
    border-radius: 50%;      /* Back to circle */
  }

  .t-label {
    display: none;           /* Hide the text "Find Teacher" */
  }
  
  .t-icon {
    margin: 0;
  }
}

/* Hide Elements Class */
.hidden {
  display: none !important;
}

/* Search Bar Styling */
.search-wrapper {
  position: relative;
  width: 100%;
  z-index: 1000;
}

#teacher-search {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
}

#teacher-search:focus {
  border-color: var(--accent-color);
}

/* Suggestions Dropdown */
.suggestions-list {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 250px;
  overflow-y: auto;
  background: var(--header-bg);
  border: 1px solid var(--border-color);
  border-radius: 0 0 12px 12px;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  margin-top: 5px;
  z-index: 1001;
}

.suggestion-item {
  padding: 12px 15px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background: rgba(187, 134, 252, 0.1); }

.s-code { font-weight: 800; color: var(--accent-color); }
.s-name { opacity: 0.8; font-size: 0.9rem; }

/* --- MODAL STYLES --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.hidden-modal {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background-color: #1e1e1e; /* Dark Card BG */
  width: 90%;
  max-width: 400px;
  border-radius: 16px;
  padding: 25px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
  position: relative;
  transform: scale(1);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hidden-modal .modal-content {
  transform: scale(0.9);
}

/* Light Theme Override */
[data-theme="light"] .modal-content {
  background-color: #ffffff;
}

.modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 5px;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 5px;
  margin-right: 20px; /* Space for close btn */
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  font-family: monospace;
}

.modal-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

.modal-row:last-child {
  border-bottom: none;
}

.modal-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.modal-value {
  font-weight: 600;
  color: var(--accent-color);
  font-size: 1rem;
  text-align: right;
}
/* --- TEACHER MODE HINT --- */
.teacher-hint {
  position: absolute;
  top: 10px;
  right: 140px; /* Positions it nicely under the buttons */
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-color);
  font-weight: 700;
  font-size: 0.9rem;
  pointer-events: none; /* Allows clicking through it */
  animation: bounceHint 1.5s infinite alternate ease-in-out;
  z-index: 20;
}

/* Curved Arrow Styling */
.hint-arrow {
  font-size: 1.4rem;
  line-height: 1;
  /* Flip the arrow so it curves UP and LEFT towards the Teacher button */
  transform: scaleX(-1) rotate(-10deg); 
  display: inline-block;
}

/* Bouncing Animation */
@keyframes bounceHint {
  from { transform: translateY(0); opacity: 0.6; }
  to { transform: translateY(-5px); opacity: 1; }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
  .teacher-hint {
    right: 95px; /* Move closer for smaller screens */
    font-size: 0.8rem;
  }
}

/* --- FIX FOR BLANK SCREEN (Critical) --- */
#student-controls {
  display: block;
  width: 100%;
}

.filter-content {
  position: relative;
  background-color: var(--header-bg);
  min-height: 200px; /* Ensures panel is never 0px height */
}

/* --- CLICKABLE BADGE --- */
.clickable-badge {
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  position: relative;
  z-index: 10; /* Ensures it sits above other card clicks if any */
}

.clickable-badge:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.clickable-badge:active {
  transform: scale(0.95);
}
/* --- ROOM INFO POPUP --- */
#room-info-popup {
  position: absolute;
  background-color: var(--card-bg); /* Matches your card theme */
  color: var(--text-main);
  border: 1px solid var(--accent-color);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999; /* Sits on top of everything */
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  display: none; /* Hidden by default */
  max-width: 220px;
  pointer-events: none; /* Allows touches to pass through (helps with quick dismissal) */
  line-height: 1.4;
  backdrop-filter: blur(5px);
}

/* Add a tiny arrow (optional, looks nice) */
#room-info-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 10px;
  width: 10px;
  height: 10px;
  background: var(--card-bg);
  border-left: 1px solid var(--accent-color);
  border-top: 1px solid var(--accent-color);
  transform: rotate(45deg);
}
/* --- CARD VIEW ICON (Bordered & Larger) --- */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;       /* Fixed width for circle */
  height: 22px;      /* Fixed height for circle */
  border: 2px solid var(--accent-color); /* The Border */
  border-radius: 50%; /* Make it a circle */
  margin-left: 8px;
  
  font-family: serif; /* Serif font makes the 'i' look better */
  font-style: italic;
  font-weight: 900;
  font-size: 14px;
  color: var(--accent-color);
  background: rgba(0,0,0,0.2); /* Slight contrast background */
}

/* --- TABLE MODAL ICON (Glowing Button) --- */
.modal-glow-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 10px;
  border-radius: 50%;
  vertical-align: middle;
  
  /* The Glow Look */
  background: rgba(187, 134, 252, 0.15); /* Low opacity accent bg */
  border: 1px solid var(--accent-color);
  color: #fff; /* White text to stand out from accent color */
  box-shadow: 0 0 8px var(--accent-color); /* The Glow */
  font-family: serif;
  font-style: italic;
  font-weight: bold;
  font-size: 1.1rem;
  
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-glow-btn:hover {
  transform: scale(1.15);
  background: var(--accent-color);
  box-shadow: 0 0 15px var(--accent-color), 0 0 25px var(--accent-color); /* Stronger glow on hover */
  text-shadow: none;
}
/* ================= FONT SIZE FIXES ================= */

/* 1. Swipe Cards: Make Subject Bigger & Bolder */
.subject-name {
  font-size: 1.35rem !important; /* Increased from default */
  font-weight: 700 !important;   /* Make it thick like Inter */
  letter-spacing: 0.5px;         /* Adds breathing room */
  margin-bottom: 6px;
}

/* 2. Table View: Make Time Column Readable */
/* Targets the first column (Time) specifically */
.weekly-table td:first-child {
  font-weight: 700;              /* Make 09:00 stand out */
  min-width: 65px;               /* Ensure it doesn't get squished */
}

.weekly-table td:first-child div {
  font-size: 0.95rem !important; /* Bigger time text */
}

.weekly-table td:first-child span {
  font-size: 0.8rem !important;  /* Bigger "09:50" text */
  opacity: 0.8 !important;       /* Make it easier to see */
}

/* 3. Global Text Boost (Optional) */
body {
  /* This tells the browser to use the clearest system font available */
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}
/* ================= FINAL TABLE LAYOUT (Adjusted v2) ================= */

/* 1. The Cells: Reduced padding to fit screen */
.weekly-table td {
  padding-top: 3px !important;    /* Reduced from 5px to 3px */
  padding-bottom: 3px !important; /* Reduced from 5px to 3px */
  height: auto !important;
}

/* 2. The Time Column: Tightened line height */
.weekly-table td:first-child div {
  line-height: 1.15 !important;   /* Tightened from 1.3 */
  margin-bottom: 1px !important;  
  font-size: 0.9rem !important;   
}

/* 3. Subject Text: Compact */
.cell-subject {
  line-height: 1.1 !important;
  margin-bottom: 1px !important;
  display: block;
}

.cell-room {
  line-height: 1 !important;
  margin-top: 0px !important;     /* Removed top margin */
}

/* 4. The Bottom Hint: Kept tiny */
.weekly-table tr:last-child td {
  padding: 2px !important;        
  font-size: 0.7rem !important;  
  line-height: 1 !important;
}
/* ================= SWIPE VIEW BOOSTER (Big & Tight) ================= */

/* 1. Day Header */
.day-header {
  font-size: 1.8rem !important;
  font-weight: 800 !important;
  margin-bottom: 20px !important;
  color: var(--accent-color);
}

/* 2. The Card Container */
.class-card {
  padding: 15px 18px !important;
  margin-bottom: 16px !important;
}

/* 3. Time Slot: MADE BIGGER */
.time-slot {
  font-size: 1.1rem !important;   /* Increased from 0.95rem */
  font-weight: 600 !important;
  opacity: 1 !important;          /* Fully visible */
  letter-spacing: 0.5px;
  margin-bottom: 2px !important;  /* Keep close to subject */
  color: var(--accent-color);     /* Ensure it pops */
}

/* 4. Subject Name: HUGE & NO GAP */
.subject-name {
  font-size: 1.8rem !important;   /* Increased from 1.45rem to 1.8rem */
  font-weight: 800 !important;
  line-height: 1.1 !important;
  margin-top: 4px !important;
  margin-bottom: 4px !important;  /* REDUCED GAP (Was 10px) */
}

/* 5. The Badges */
.info-badge {
  font-size: 0.9rem !important;
  padding: 8px 12px !important;
  font-weight: 500 !important;
}

/* 6. Break Card */
.break-card { padding: 20px !important; }
.break-header { font-size: 1.2rem !important; }

/* --- BATCH SCROLL OVERLAY (V3 - Centered & Filtered) --- */
.batch-scroll-overlay {
  position: fixed; /* Breaks out of the container! */
  top: 85px;       /* Exact position of the badge (70px Header + 15px Margin) */
  right: 15px;
  width: 120px;
  height: 0px;
  
  /* Centers the list on the badge */
  transform: translateY(-50%);
  
  background: rgba(18, 18, 18, 0.98);
  backdrop-filter: blur(12px);
  border: 1px solid var(--accent-color);
  border-radius: 16px;
  
  /* MAX Z-INDEX: Ensures it sits on top of the Header */
  z-index: 9999; 
  
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: height 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 10px 50px rgba(0,0,0,0.8);
  
  /* Cool Borders */
  border-top: 2px solid var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
}

.batch-scroll-overlay.active {
  height: 175px; /* SMALLER: 5 items x 35px = 175px */
  opacity: 1;
  pointer-events: auto;
}

/* COMPACT ITEMS (To save space) */
.scroll-item {
  height: 35px; /* Reduced from 48px */
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.5;
}

.scroll-item.current {
  color: var(--accent-color);
  font-size: 1.2rem;
  font-weight: 800;
  opacity: 1;
  transform: scale(1.1);
  background: rgba(187, 134, 252, 0.05);
  border-left: 3px solid var(--accent-color);
  border-right: 3px solid var(--accent-color);
}
.weekly-table tr.active-now {
    /* If you want to highlight the whole row (Day) */
    background-color: rgba(187, 134, 252, 0.05); 
}
.weekly-table td:first-child, 
.day-col-header {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
  position: sticky;
  left: 0;
  z-index: 20;
  background-color: var(--card-bg);
  border-right: 2px solid var(--border-color);
  font-weight: 800;
  color: var(--accent-color);
  font-size: 0.9rem;
}


/* --- FIX: POINTER UP, LABEL DOWN (No Search Bar Movement) --- */

/* 1. Lift the Floating Pointer UP */
.teacher-hint {
  top: -1px !important;       /* Was 10px, now higher */
}

/* 2. Push the Label DOWN (into the gap) */
#teacher-controls .filter-label {
  margin-top: 8px !important;    /* Pushes label down */
  margin-bottom: -8px !important; /* Pulls search bar back UP so it doesn't move */
  position: relative;
  z-index: 5;
}







