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

/* Default Theme (Dark) */
:root, body.theme-dark {
  --primary: #007f66; /* Viridian Green */
  --primary-hover: #005f4c;
  --primary-glow: rgba(0, 127, 102, 0.15);
  --secondary: #6b8e23; /* Olive Green / Pharmacy */
  --secondary-glow: rgba(107, 142, 35, 0.15);
  --accent: #d97706; /* Amber / Warning */
  --accent-purple: #8b5cf6; /* Exam Purple */
  --accent-blue: #0ea5e9; /* Make-up blue */
  --danger: #ef4444; /* Overdue / Delete */
  --success: #22c55e; /* Completed */
  
  --bg-dark: #070a13;
  --bg-sidebar: #0b1120;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(30, 41, 59, 0.75);
  --bg-input: rgba(15, 23, 42, 0.8);
  --border-color: rgba(255, 255, 255, 0.06);
  --border-color-hover: rgba(0, 127, 102, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Outfit', 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 12px;

  /* Theme-specific day colors & subtle item variables */
  --day-mon: #facc15;
  --day-tue: #f472b6;
  --day-wed: #34d399;
  --day-thu: #fb923c;
  --day-fri: #60a5fa;
  --bg-item-subtle: rgba(255, 255, 255, 0.03);
  --bg-item-subtle-hover: rgba(255, 255, 255, 0.06);
  --bg-item-success: rgba(34, 197, 94, 0.05);
  --bg-todo-col: rgba(11, 17, 32, 0.5);
  --blue-glow: rgba(14, 165, 233, 0.15);
  --amber-glow: rgba(217, 119, 6, 0.15);
  --purple-glow: rgba(139, 92, 246, 0.15);
}

/* Light Theme */
body.theme-light {
  --primary: #007f66;
  --primary-hover: #005f4c;
  --primary-glow: rgba(0, 127, 102, 0.1);
  --secondary: #6b8e23;
  --secondary-glow: rgba(107, 142, 35, 0.1);
  --accent: #b45309;
  --accent-purple: #6d28d9;
  --accent-blue: #0369a1;
  --danger: #dc2626;
  --success: #16a34a;
  
  --bg-dark: #f1f5f9; /* Slate 100 */
  --bg-sidebar: #ffffff; /* White sidebar */
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-input: rgba(248, 250, 252, 0.9);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-color-hover: rgba(0, 127, 102, 0.3);
  
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #475569; /* Slate 600 */
  --text-dim: #64748b;
  --shadow-lg: 0 10px 30px -10px rgba(15, 23, 42, 0.05);

  /* Theme-specific day colors & subtle item variables */
  --day-mon: #b45309;
  --day-tue: #be185d;
  --day-wed: #047857;
  --day-thu: #c2410c;
  --day-fri: #1d4ed8;
  --bg-item-subtle: rgba(0, 0, 0, 0.02);
  --bg-item-subtle-hover: rgba(0, 0, 0, 0.04);
  --bg-item-success: rgba(22, 163, 74, 0.08);
  --bg-todo-col: rgba(0, 0, 0, 0.02);
  --blue-glow: rgba(3, 105, 161, 0.12);
  --amber-glow: rgba(180, 83, 9, 0.12);
  --purple-glow: rgba(109, 40, 217, 0.12);
}

/* Rx Tone (Olive, Viridian, Cream, White) */
body.theme-rxtone {
  --primary: #007f66; /* Viridian */
  --primary-hover: #005f4c;
  --primary-glow: rgba(0, 127, 102, 0.1);
  --secondary: #6b8e23; /* Olive */
  --secondary-glow: rgba(107, 142, 35, 0.1);
  --accent: #92400e;
  --accent-purple: #5b21b6;
  --accent-blue: #075985;
  --danger: #991b1b;
  --success: #166534;
  
  --bg-dark: #fdfbf7; /* Cream background */
  --bg-sidebar: #ffffff; /* White sidebar */
  --bg-card: rgba(255, 255, 255, 0.85); /* White card */
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-input: rgba(253, 251, 247, 0.9);
  --border-color: rgba(107, 142, 35, 0.15); /* Olive border tint */
  --border-color-hover: rgba(0, 127, 102, 0.45);
  
  --text-main: #2f3e23; /* Very deep olive/slate */
  --text-muted: #556b2f; /* Olive green text */
  --text-dim: #7f8c6d;
  --shadow-lg: 0 10px 30px -10px rgba(47, 62, 35, 0.04);

  /* Theme-specific day colors & subtle item variables */
  --day-mon: #854d0e;
  --day-tue: #9d174d;
  --day-wed: #065f46;
  --day-thu: #9a3412;
  --day-fri: #1e3a8a;
  --bg-item-subtle: rgba(107, 142, 35, 0.05);
  --bg-item-subtle-hover: rgba(107, 142, 35, 0.1);
  --bg-item-success: rgba(22, 163, 74, 0.08);
  --bg-todo-col: rgba(107, 142, 35, 0.04);
  --blue-glow: rgba(7, 89, 133, 0.12);
  --amber-glow: rgba(146, 64, 14, 0.12);
  --purple-glow: rgba(91, 33, 182, 0.12);
}

/* Minimal Theme (Cream, Brown, Beige) */
body.theme-minimal {
  --primary: #8c6239; /* Warm earthy brown */
  --primary-hover: #734f2d;
  --primary-glow: rgba(140, 98, 57, 0.1);
  --secondary: #a67c52; /* Warm sand/tan */
  --secondary-glow: rgba(166, 124, 82, 0.1);
  --accent: #bf8f54; /* Amber / warm wheat */
  --accent-purple: #805060; /* Dusty rose/mauve */
  --accent-blue: #5b7b8c; /* Slate blue */
  --danger: #995050;
  --success: #5a7862;
  
  --bg-dark: #fbf9f6; /* Very soft cream/beige background */
  --bg-sidebar: #f3eade; /* Soft light sand sidebar */
  --bg-card: rgba(255, 255, 255, 0.9); /* Clean white card */
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-input: #f3eade;
  --border-color: rgba(140, 98, 57, 0.12); /* Brown tint */
  --border-color-hover: rgba(140, 98, 57, 0.4);
  
  --text-main: #4a3a2e; /* Deep espresso brown */
  --text-muted: #7c6857; /* Soft brown */
  --text-dim: #a29182;
  --shadow-lg: 0 10px 30px -10px rgba(74, 58, 46, 0.04);

  /* Theme-specific day colors & subtle item variables */
  --day-mon: #c2842e;
  --day-tue: #b06b74;
  --day-wed: #608066;
  --day-thu: #b57550;
  --day-fri: #5c7c8c;
  --bg-item-subtle: rgba(140, 98, 57, 0.04);
  --bg-item-subtle-hover: rgba(140, 98, 57, 0.08);
  --bg-item-success: rgba(90, 120, 98, 0.08);
  --bg-todo-col: rgba(140, 98, 57, 0.03);
  --blue-glow: rgba(91, 123, 140, 0.12);
  --amber-glow: rgba(194, 132, 46, 0.12);
  --purple-glow: rgba(128, 80, 96, 0.12);
}

/* Colorful Theme (Vibrant Neon Pink, Cyan, Deep Violet) */
body.theme-colorful {
  --primary: #ff007f; /* Vibrant neon pink */
  --primary-hover: #cc0066;
  --primary-glow: rgba(255, 0, 127, 0.25);
  --secondary: #00f0ff; /* Neon cyan */
  --secondary-glow: rgba(0, 240, 255, 0.25);
  --accent: #ffd700; /* Neon yellow */
  --accent-purple: #a020f0; /* Neon purple */
  --accent-blue: #1f51ff; /* Neon blue */
  --danger: #ff3333;
  --success: #39ff14; /* Neon green */
  
  --bg-dark: #090514; /* Deep violet-black space */
  --bg-sidebar: #120a24; /* Deep violet sidebar */
  --bg-card: rgba(28, 15, 52, 0.75); /* Semi-transparent deep violet card */
  --bg-card-hover: rgba(40, 22, 72, 0.85);
  --bg-input: rgba(18, 10, 36, 0.9);
  --border-color: rgba(0, 240, 255, 0.2); /* Cyan tint */
  --border-color-hover: rgba(255, 0, 127, 0.45); /* Pink tint */
  
  --text-main: #ffffff;
  --text-muted: #c0b3d6; /* Muted lavender */
  --text-dim: #897b9c;
  --shadow-lg: 0 10px 30px -10px rgba(0, 240, 255, 0.15);

  /* Theme-specific day colors & subtle item variables */
  --day-mon: #ffd700;
  --day-tue: #ff1493;
  --day-wed: #00ff7f;
  --day-thu: #ff4500;
  --day-fri: #1e90ff;
  --bg-item-subtle: rgba(255, 255, 255, 0.04);
  --bg-item-subtle-hover: rgba(255, 255, 255, 0.08);
  --bg-item-success: rgba(57, 255, 20, 0.08);
  --bg-todo-col: rgba(28, 15, 52, 0.6);
  --blue-glow: rgba(30, 144, 255, 0.2);
  --amber-glow: rgba(255, 215, 0, 0.2);
  --purple-glow: rgba(160, 32, 240, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  background-attachment: fixed;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body.theme-dark {
  background-image: 
    radial-gradient(at 10% 10%, rgba(0, 127, 102, 0.08) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(107, 142, 35, 0.06) 0px, transparent 50%);
}

body.theme-light {
  background-image: 
    radial-gradient(at 10% 10%, rgba(0, 127, 102, 0.03) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(107, 142, 35, 0.02) 0px, transparent 50%);
}

body.theme-rxtone {
  background-image: 
    radial-gradient(at 10% 10%, rgba(0, 127, 102, 0.05) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(107, 142, 35, 0.04) 0px, transparent 50%);
}

body.theme-minimal {
  background-image: 
    radial-gradient(at 10% 10%, rgba(140, 98, 57, 0.04) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(166, 124, 82, 0.03) 0px, transparent 50%);
}

body.theme-colorful {
  background-image: 
    radial-gradient(at 10% 10%, rgba(255, 0, 127, 0.12) 0px, transparent 50%),
    radial-gradient(at 90% 90%, rgba(0, 240, 255, 0.1) 0px, transparent 50%);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.03); opacity: 1; }
}

/* Auth Screens */
#auth-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #030806;
  background-image: radial-gradient(circle at 50% 50%, #072218 0%, #020906 100%);
  padding: 20px;
  overflow: hidden;
}

/* Ambient Floating Blobs styling */
.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  -webkit-filter: blur(100px);
  opacity: 0.16;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: floatMotion 20s infinite alternate ease-in-out;
  z-index: 1;
}

.blob-1 {
  width: 450px;
  height: 450px;
  background: linear-gradient(135deg, var(--primary), #10b981);
  top: -10%;
  left: -10%;
  animation-duration: 22s;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: linear-gradient(135deg, var(--secondary), #34d399);
  bottom: -10%;
  right: -10%;
  animation-duration: 28s;
  animation-delay: -7s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: linear-gradient(135deg, #0f766e, #059669);
  top: 40%;
  left: 35%;
  animation-duration: 35s;
  animation-delay: -14s;
}

@keyframes floatMotion {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
  }
  33% {
    transform: translate(70px, -50px) scale(1.15) rotate(120deg);
  }
  66% {
    transform: translate(-50px, 60px) scale(0.9) rotate(240deg);
  }
  100% {
    transform: translate(0, 0) scale(1) rotate(360deg);
  }
}

/* Role Selector Styling */
.role-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 10px;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
  cursor: pointer;
  text-align: left;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.role-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--primary);
  transform: translateY(-5px) scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 127, 102, 0.15);
}

.role-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.4rem;
  color: white;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.role-card:hover .role-icon-wrapper {
  transform: scale(1.15) rotate(5deg);
}

.role-icon-wrapper.student-color {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 0 10px var(--primary-glow);
}

.role-icon-wrapper.admin-color {
  background: linear-gradient(135deg, var(--accent), var(--danger));
  box-shadow: 0 0 10px var(--amber-glow);
}

.role-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 4px 0;
}

.role-content p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.3;
}


.login-card {
  position: relative;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(25px) saturate(180%);
  -webkit-backdrop-filter: blur(25px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  text-align: center;
  z-index: 5;
}

.login-card h2:not(.main-logo-title),
.login-card h3,
.login-card h4,
.login-card label {
  color: #facc15 !important;
  background: none !important;
  -webkit-text-fill-color: initial !important;
  background-clip: initial !important;
  -webkit-background-clip: initial !important;
  font-weight: 700 !important;
}

.login-card .main-logo-title {
  font-size: 1.8rem;
  font-weight: 800 !important;
  background: linear-gradient(90deg, #10b981, #007f66, #34d399, #10b981) !important;
  background-size: 300% 100% !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: logoShimmer 6s infinite ease-in-out !important;
  letter-spacing: 0.5px;
  display: inline-block;
}

@keyframes logoShimmer {
  0% {
    background-position: 0% 50%;
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.2));
  }
  50% {
    background-position: 100% 50%;
    filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.5));
  }
  100% {
    background-position: 0% 50%;
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.2));
  }
}

.login-card .logo-sub,
.login-card p,
.login-card .login-hint p,
.login-card .show-password-below span,
.login-card .back-btn {
  color: #ffffff !important;
}

/* Card Spring Entrance Animation */
@keyframes cardEntrance {
  0% {
    opacity: 0;
    transform: translateY(50px) scale(0.92);
  }
  70% {
    transform: translateY(-8px) scale(1.015);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-card[style*="display: block"],
.login-card[style*="display: flex"] {
  animation: cardEntrance 0.65s cubic-bezier(0.25, 1.1, 0.5, 1) forwards !important;
}

.logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 30px;
}

.logo-icon {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.2rem;
  color: white;
  margin-bottom: 15px;
  box-shadow: 0 0 20px var(--primary-glow);
}

.logo-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(120deg, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 5px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 8px;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input-wrapper {
  position: relative;
}

.input-wrapper i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.1rem;
}

.login-form input, .modal input, .modal select, .modal textarea {
  width: 100%;
  padding: 14px 16px;
  padding-left: 45px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.login-form input:focus, .modal input:focus, .modal select:focus, .modal textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(0, 166, 153, 0.2);
}

.login-btn {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 166, 153, 0.4);
}

.login-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 20px;
  line-height: 1.4;
}

.error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: -10px;
  display: none;
}

/* App Shell Layout */
#app-container {
  display: none;
  min-height: 100vh;
}

.app-wrapper {
  display: flex;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  height: 100vh;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 25px;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 25px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.3rem;
  color: white;
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.brand-dept {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 18px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-item.active a, .nav-item a:hover {
  background: rgba(0, 166, 153, 0.1);
  color: var(--primary);
}

.nav-item.active a {
  border-left: 4px solid var(--primary);
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  font-weight: 600;
}

.user-profile {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.profile-details {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 600;
  font-size: 1rem;
  color: white;
}

.profile-info {
  display: flex;
  flex-direction: column;
}

.profile-role {
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-id {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
}

.logout-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-content {
  margin-left: 280px;
  flex-grow: 1;
  padding: 40px;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
}

.header-title h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 5px;
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: var(--font-sans);
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
}

/* Section Controls & Filters */
.filters-bar {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  padding: 10px 15px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-input-wrapper i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

.search-input-wrapper input {
  padding-left: 42px !important;
}

/* Content Sections (Page view tabs) */
.content-section {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.content-section.active {
  display: block;
}

/* Dashboard Styles */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1-fraction);
  gap: 25px;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-color-hover);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: white;
}

.stat-icon.blue { background: var(--blue-glow); color: var(--accent-blue); }
.stat-icon.teal { background: var(--primary-glow); color: var(--primary); }
.stat-icon.amber { background: var(--amber-glow); color: var(--accent); }
.stat-icon.purple { background: var(--purple-glow); color: var(--accent-purple); }

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Cards default styling */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}

.panel-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

/* Lists styling inside panels */
.dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.dashboard-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background: var(--bg-item-subtle);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: var(--transition);
  cursor: pointer;
}

.dashboard-list-item:hover {
  background: var(--bg-item-subtle-hover);
  transform: translateX(3px);
}

.item-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.item-time-badge {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(0, 166, 153, 0.1);
  color: var(--primary);
  text-align: center;
  min-width: 90px;
}

.item-content {
  display: flex;
  flex-direction: column;
}

.item-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.item-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-high { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-medium { background: rgba(217, 119, 6, 0.15); color: var(--accent); }
.badge-low { background: rgba(14, 165, 233, 0.15); color: var(--accent-blue); }
.badge-success { background: rgba(34, 197, 94, 0.15); color: var(--success); }

/* Schedule Component Styling */
.schedule-grid-wrap {
  overflow-x: auto;
  margin-top: 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  text-align: left;
}

.schedule-table th {
  background: var(--bg-sidebar);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.schedule-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

.day-cell {
  font-weight: 700;
  font-size: 1rem;
  width: 120px;
}

.day-monday { color: var(--day-mon); }
.day-tuesday { color: var(--day-tue); }
.day-wednesday { color: var(--day-wed); }
.day-thursday { color: var(--day-thu); }
.day-friday { color: var(--day-fri); }

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-slot {
  background: var(--bg-item-subtle);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px 16px;
  transition: var(--transition);
  position: relative;
}

.schedule-slot:hover {
  background: var(--bg-item-subtle-hover);
  transform: translateY(-2px);
}

.schedule-slot.lab {
  border-left-color: var(--secondary);
}

.slot-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.slot-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 4px 0;
}

.slot-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  gap: 12px;
}

.slot-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.slot-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  opacity: 0;
  transition: var(--transition);
}

.schedule-slot:hover .slot-actions {
  opacity: 1;
}

/* Schedule View Toggle Button Styling */
.view-toggle-group {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.view-toggle-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

body.theme-light .view-toggle-btn:hover,
body.theme-rxtone .view-toggle-btn:hover,
body.theme-minimal .view-toggle-btn:hover {
  background: rgba(0, 0, 0, 0.03);
}

.view-toggle-btn.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Weekly Timetable Grid Styles */
.weekly-timetable {
  width: 100%;
  min-width: 1100px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.timetable-header {
  display: flex;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  align-items: stretch;
}

.timetable-day-header-label {
  width: 110px;
  flex-shrink: 0;
  padding: 12px 15px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.1);
}

body.theme-light .timetable-day-header-label,
body.theme-rxtone .timetable-day-header-label,
body.theme-minimal .timetable-day-header-label {
  background: rgba(0, 0, 0, 0.02);
}

.timetable-timeline-header {
  display: flex;
  flex-grow: 1;
}

.time-header-cell {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
  border-right: 1px solid var(--border-color);
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.time-header-cell:last-child {
  border-right: none;
}

.time-header-range {
  font-size: 0.72rem;
  opacity: 0.8;
  margin-top: 2px;
}

.timetable-body {
  display: flex;
  flex-direction: column;
}

.timetable-row {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  align-items: stretch;
  min-height: 95px;
}

.timetable-row:last-child {
  border-bottom: none;
}

.timetable-day-label {
  width: 110px;
  flex-shrink: 0;
  padding: 15px;
  font-weight: 700;
  font-size: 0.95rem;
  border-right: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.05);
  text-align: center;
}

body.theme-light .timetable-day-label,
body.theme-rxtone .timetable-day-label,
body.theme-minimal .timetable-day-label {
  background: rgba(0, 0, 0, 0.01);
}

.timetable-slots-container {
  position: relative;
  flex-grow: 1;
  padding: 10px 0;
}

.timetable-grid-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  pointer-events: none;
  z-index: 1;
}

.grid-cell-bg {
  flex: 1;
  border-right: 1px dashed var(--border-color);
  height: 100%;
  opacity: 0.6;
}

.grid-cell-bg:last-child {
  border-right: none;
}

/* Timetable Cards positioning */
.timetable-card {
  position: absolute;
  top: 10px;
  bottom: 10px;
  background: var(--bg-item-subtle);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 8px 10px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  min-width: 0;
}

body.theme-light .timetable-card,
body.theme-rxtone .timetable-card,
body.theme-minimal .timetable-card {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.timetable-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  background: var(--bg-item-subtle-hover);
  z-index: 10;
}

body.theme-light .timetable-card:hover,
body.theme-rxtone .timetable-card:hover,
body.theme-minimal .timetable-card:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.timetable-card.lab {
  border-left-color: var(--secondary);
}

.timetable-card-name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-main);
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.25;
  min-width: 0;
}

.timetable-card-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.timetable-card-meta {
  font-size: 0.7rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
  gap: 4px;
  min-width: 0;
}

.timetable-card-meta-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  flex-shrink: 1;
  min-width: 0;
}

.timetable-card-meta-left span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.68rem;
  line-height: 1.15;
  min-width: 0;
}

.timetable-card-time {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex-shrink: 0;
}

.timetable-card.lab .timetable-card-time {
  color: var(--secondary);
}

.timetable-card .slot-actions {
  top: 5px;
  right: 5px;
  bottom: auto;
}

.timetable-card:hover .slot-actions {
  opacity: 1 !important;
}

/* Course Explorer Grid */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
}

.course-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-lg);
}

.course-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.course-code {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  padding: 3px 8px;
  background: var(--primary-glow);
  border-radius: 6px;
  border: 1px solid rgba(0, 166, 153, 0.2);
}

.course-credits {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.course-name {
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1.4;
  margin-bottom: 10px;
}

.course-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.course-grading {
  background: var(--bg-item-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
}

.grading-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}

.grading-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.grading-row-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
}

.grading-progress-bg {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.grading-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
}

.course-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
}

/* Homework To-Do Board */
.todo-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 25px;
  align-items: start;
}

@media (max-width: 992px) {
  .todo-board {
    grid-template-columns: 1fr;
  }
}

.todo-column {
  background: var(--bg-todo-col);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.column-title {
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.column-title::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

#todo-col .column-title::before { background: var(--danger); }
#progress-col .column-title::before { background: var(--accent); }
#done-col .column-title::before { background: var(--success); }

.column-count {
  font-size: 0.8rem;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-height: 200px;
}

.task-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
  cursor: grab;
  position: relative;
}

.task-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-lg);
}

.task-priority-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.task-subject {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.task-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.4;
  margin-bottom: 8px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.task-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.task-card .task-subject,
.task-card .task-meta,
.task-card .task-meta span,
.task-card .task-meta strong {
  white-space: normal !important;
  word-break: break-all !important;
  overflow-wrap: anywhere !important;
}

.task-deadline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
}

.countdown-wrap {
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

.task-countdown-container {
  padding: 6px 10px;
  background: var(--bg-item-subtle);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 8px;
}

.task-countdown-container.completed {
  color: var(--success);
  background: var(--bg-item-success);
  border-color: rgba(22, 163, 74, 0.15);
}

.task-divider-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.countdown-active {
  color: var(--accent);
}

.countdown-urgent {
  color: var(--danger);
  animation: pulse 1.5s infinite;
}

.countdown-overdue {
  color: var(--text-dim);
  text-decoration: line-through;
}

.task-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transition: var(--transition);
}

.task-card:hover .task-actions {
  opacity: 1;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.icon-btn.danger-hover:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
}

/* Exam & Make-up Cards Grid */
.exam-grid, .makeup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
}

.event-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  gap: 15px;
  transition: var(--transition);
  position: relative;
}

.event-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
}

.event-date-badge {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent-purple);
  width: 65px;
  height: 75px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  border: 1px solid rgba(139, 92, 246, 0.15);
}

.event-date-badge.blue {
  background: rgba(14, 165, 233, 0.1);
  color: var(--accent-blue);
  border-color: rgba(14, 165, 233, 0.15);
}

.date-day {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.date-month {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-top: 3px;
}

.event-details {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex-grow: 1;
}

.event-subject-code {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.event-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
}

.event-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.event-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.event-actions {
  position: absolute;
  right: 15px;
  bottom: 15px;
  opacity: 0;
  transition: var(--transition);
}

.event-card:hover .event-actions {
  opacity: 1;
}

/* Lecturer Directory Card */
.lecturer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 25px;
}

.lecturer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 25px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: var(--transition);
  position: relative;
}

.lecturer-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-lg);
}

.lec-avatar {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.8rem;
  color: white;
  font-weight: 700;
  margin-bottom: 15px;
  box-shadow: 0 5px 15px rgba(0, 166, 153, 0.2);
}

.lec-name {
  font-weight: 700;
  font-size: 1rem;
}

.lec-dept {
  font-size: 0.8rem;
  color: var(--primary);
  margin: 6px 0 15px 0;
  font-weight: 500;
}

.lec-contact {
  width: 100%;
  padding-top: 15px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: left;
}

.lec-contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lec-contact-item i {
  color: var(--text-dim);
  width: 15px;
}

.lec-actions {
  position: absolute;
  right: 15px;
  bottom: 15px;
  opacity: 0;
  transition: var(--transition);
}

.lecturer-card:hover .lec-actions {
  opacity: 1;
}

/* Modals Overlay & Content */
.modal {
  display: none; /* hidden by default */
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 10, 19, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color-hover);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  border-left: 3px solid var(--primary);
  padding-left: 10px;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: var(--transition);
}

.close-modal:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 25px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color-hover);
  border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

.modal-body form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.modal-body .form-group input, 
.modal-body .form-group select, 
.modal-body .form-group textarea {
  padding-left: 15px; /* no icon inside inputs in modal */
}

.modal-body textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-footer {
  padding: 15px 25px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

/* Responsiveness adjustments & Buttons */
.mobile-menu-toggle-btn {
  display: none;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1.2rem;
  padding: 10px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin-right: 5px;
}

.mobile-menu-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-color-hover);
}

.mobile-sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px;
  align-items: center;
  justify-content: center;
}

.mobile-sidebar-close-btn:hover {
  color: var(--danger);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: 240px;
    padding: 20px 15px;
  }
  .main-content {
    margin-left: 240px;
    padding: 25px;
  }
}

@media (max-width: 768px) {
  .mobile-menu-toggle-btn {
    display: inline-flex;
  }
  
  .mobile-sidebar-close-btn {
    display: inline-flex;
  }

  .sidebar {
    width: 280px;
    height: 100vh;
    left: -280px; /* Hide to the left */
    position: fixed;
    top: 0;
    z-index: 100;
    padding: 25px;
    display: flex;
    flex-direction: column;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
  }

  .sidebar.active {
    left: 0; /* Slide in */
  }

  .brand-info, .nav-item span, .profile-info, .logout-btn {
    display: flex !important; /* Keep them visible inside the sliding menu */
  }

  .sidebar-brand {
    justify-content: space-between;
    padding-bottom: 25px;
    margin-bottom: 25px;
  }

  .nav-item a {
    justify-content: flex-start;
    padding: 12px 18px;
  }

  .user-profile {
    justify-content: space-between;
    margin-top: auto;
    padding-top: 20px;
  }

  .main-content {
    margin-left: 0; /* No margin since sidebar is overlay */
    padding: 20px;
  }

  .stat-row {
    grid-template-columns: 1fr;
  }
  
  .top-header {
    margin-bottom: 25px;
  }
  
  .header-title h1 {
    font-size: 1.5rem;
  }
  
  .header-title p {
    font-size: 0.82rem;
  }
}

@media (max-width: 480px) {
  .login-card {
    padding: 30px 20px;
  }
  
  .top-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ==================== 5. PASSWORD EYE TOGGLE & THEME DROPDOWN ==================== */
.show-password-below {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.show-password-below span {
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: var(--transition);
  user-select: none;
  font-weight: 500;
}

.show-password-below span:hover {
  color: var(--primary);
}

.theme-switcher-wrapper {
  position: relative;
  display: inline-block;
}

.theme-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 120%;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 190px;
  z-index: 600;
  animation: fadeIn 0.2s ease-out;
}

.theme-dropdown.active {
  display: block;
}

.theme-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

.theme-option:hover {
  background: var(--primary-glow);
  color: var(--primary);
}

.theme-option.active {
  background: var(--primary);
  color: white !important;
}

.theme-option.active .theme-dot {
  border-color: white;
}

.theme-previews {
  display: flex;
  gap: 4px;
}

.theme-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}


input::placeholder, select::placeholder, textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.8;
}

/* ==================== 6. PASSCODE INPUT READABILITY ENHANCEMENTS ==================== */
/* Modals Styling Enhancements for High Readability */
.modal-content {
  border: 1px solid var(--border-color-hover);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

body.theme-light .modal-content,
body.theme-rxtone .modal-content,
body.theme-minimal .modal-content {
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}
body.theme-colorful .modal-content {
  box-shadow: 0 20px 50px rgba(0, 240, 255, 0.15);
}

.modal label {
  color: var(--text-main) !important;
  font-weight: 600 !important;
  font-size: 0.95rem !important;
  margin-bottom: 2px;
}

.modal input, .modal select, .modal textarea {
  font-size: 1.05rem !important;
  font-weight: 500 !important;
  transition: all 0.2s ease;
}

/* Theme Dark styles for all modal inputs */
body.theme-dark .modal input,
body.theme-dark .modal select,
body.theme-dark .modal textarea {
  background-color: #0f172a !important; /* Dark slate */
  color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
}
body.theme-dark .modal input:focus,
body.theme-dark .modal select:focus,
body.theme-dark .modal textarea:focus {
  border-color: var(--primary) !important;
  background-color: #1e293b !important;
  box-shadow: 0 0 0 3px rgba(0, 127, 102, 0.25) !important;
}

/* Theme Light styles for all modal inputs */
body.theme-light .modal input,
body.theme-light .modal select,
body.theme-light .modal textarea {
  background-color: #f1f5f9 !important; /* Light gray-blue */
  color: #0f172a !important;
  border: 1.5px solid rgba(0, 0, 0, 0.25) !important;
}
body.theme-light .modal input:focus,
body.theme-light .modal select:focus,
body.theme-light .modal textarea:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 127, 102, 0.2) !important;
}

/* Theme RxTone styles for all modal inputs */
body.theme-rxtone .modal input,
body.theme-rxtone .modal select,
body.theme-rxtone .modal textarea {
  background-color: #f5efe6 !important; /* Rich cream-beige */
  color: #2f3e23 !important;
  border: 1.5px solid rgba(107, 142, 35, 0.45) !important;
}
body.theme-rxtone .modal input:focus,
body.theme-rxtone .modal select:focus,
body.theme-rxtone .modal textarea:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 127, 102, 0.2) !important;
}

/* Theme Minimal styles for all modal inputs */
body.theme-minimal .modal input,
body.theme-minimal .modal select,
body.theme-minimal .modal textarea {
  background-color: #f5efe0 !important;
  color: #4a3728 !important;
  border: 1.5px solid rgba(139, 90, 43, 0.35) !important;
}
body.theme-minimal .modal input:focus,
body.theme-minimal .modal select:focus,
body.theme-minimal .modal textarea:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.2) !important;
}

/* Theme Colorful styles for all modal inputs */
body.theme-colorful .modal input,
body.theme-colorful .modal select,
body.theme-colorful .modal textarea {
  background-color: #150d44 !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(0, 240, 255, 0.4) !important;
}
body.theme-colorful .modal input:focus,
body.theme-colorful .modal select:focus,
body.theme-colorful .modal textarea:focus {
  border-color: var(--primary) !important;
  background-color: #1e135a !important;
  box-shadow: 0 0 0 3px rgba(255, 0, 127, 0.3) !important;
}

/* Placeholders for all modal inputs */
.modal input::placeholder,
.modal select::placeholder,
.modal textarea::placeholder {
  font-size: 0.9rem;
  letter-spacing: normal;
}
body.theme-dark .modal input::placeholder,
body.theme-dark .modal select::placeholder,
body.theme-dark .modal textarea::placeholder {
  color: #64748b !important;
  opacity: 0.95 !important;
}
body.theme-light .modal input::placeholder,
body.theme-light .modal select::placeholder,
body.theme-light .modal textarea::placeholder {
  color: #475569 !important;
  opacity: 0.95 !important;
}
body.theme-rxtone .modal input::placeholder,
body.theme-rxtone .modal select::placeholder,
body.theme-rxtone .modal textarea::placeholder {
  color: #556b2f !important;
  opacity: 0.95 !important;
}
body.theme-minimal .modal input::placeholder,
body.theme-minimal .modal select::placeholder,
body.theme-minimal .modal textarea::placeholder {
  color: #8b7d70 !important;
  opacity: 0.95 !important;
}
body.theme-colorful .modal input::placeholder,
body.theme-colorful .modal select::placeholder,
body.theme-colorful .modal textarea::placeholder {
  color: #897b9c !important;
  opacity: 0.95 !important;
}

/* Improve eye toggles color & spacing */
.modal .show-password-below span {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.modal .show-password-below span:hover {
  color: var(--primary);
}

/* Improve input wrapper icons */
.modal .input-wrapper i {
  color: var(--text-dim);
  font-size: 1.1rem;
}
body.theme-light .modal .input-wrapper i,
body.theme-minimal .modal .input-wrapper i {
  color: #475569 !important;
}
body.theme-rxtone .modal .input-wrapper i {
  color: #556b2f !important;
}
body.theme-colorful .modal .input-wrapper i {
  color: #00f0ff !important;
}

/* Login Page Passcode Styling Enhancements for High Readability */
body.theme-dark .login-form input {
  background-color: #0f172a !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
}
body.theme-dark .login-form input:focus {
  border-color: var(--primary) !important;
  background-color: #1e293b !important;
  box-shadow: 0 0 0 3px rgba(0, 127, 102, 0.25) !important;
}

body.theme-light .login-form input {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
  border: 1.5px solid rgba(0, 0, 0, 0.25) !important;
}
body.theme-light .login-form input:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 127, 102, 0.2) !important;
}

body.theme-rxtone .login-form input {
  background-color: #f5efe6 !important;
  color: #2f3e23 !important;
  border: 1.5px solid rgba(107, 142, 35, 0.45) !important;
}
body.theme-rxtone .login-form input:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(0, 127, 102, 0.2) !important;
}

body.theme-minimal .login-form input {
  background-color: #f5efe0 !important;
  color: #4a3728 !important;
  border: 1.5px solid rgba(139, 90, 43, 0.35) !important;
}
body.theme-minimal .login-form input:focus {
  border-color: var(--primary) !important;
  background-color: #ffffff !important;
  box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.2) !important;
}

body.theme-colorful .login-form input {
  background-color: #150d44 !important;
  color: #ffffff !important;
  border: 1.5px solid rgba(0, 240, 255, 0.4) !important;
}
body.theme-colorful .login-form input:focus {
  border-color: var(--primary) !important;
  background-color: #1e135a !important;
  box-shadow: 0 0 0 3px rgba(255, 0, 127, 0.3) !important;
}

/* Placeholders for login input */
body.theme-dark .login-form input::placeholder {
  color: #64748b !important;
  opacity: 0.95 !important;
}
body.theme-light .login-form input::placeholder {
  color: #475569 !important;
  opacity: 0.95 !important;
}
body.theme-rxtone .login-form input::placeholder {
  color: #556b2f !important;
  opacity: 0.95 !important;
}
body.theme-minimal .login-form input::placeholder {
  color: #8b7d70 !important;
  opacity: 0.95 !important;
}
body.theme-colorful .login-form input::placeholder {
  color: #897b9c !important;
  opacity: 0.95 !important;
}

/* Icon in login passcode input wrapper */
body.theme-light .login-form .input-wrapper i,
body.theme-minimal .login-form .input-wrapper i {
  color: #475569 !important;
}
body.theme-rxtone .login-form .input-wrapper i {
  color: #556b2f !important;
}
body.theme-colorful .login-form .input-wrapper i {
  color: #00f0ff !important;
}

/* Secondary Button Contrast Enhancements in Light & Rx Tone Themes */
body.theme-light .btn-secondary {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #0f172a !important;
  border: 1px solid rgba(0, 0, 0, 0.15) !important;
}
body.theme-light .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.1) !important;
}

body.theme-rxtone .btn-secondary {
  background: rgba(107, 142, 35, 0.08) !important;
  color: #2f3e23 !important;
  border: 1px solid rgba(107, 142, 35, 0.25) !important;
}
body.theme-rxtone .btn-secondary:hover {
  background: rgba(107, 142, 35, 0.15) !important;
}

body.theme-minimal .btn-secondary {
  background: rgba(140, 98, 57, 0.08) !important;
  color: #4a3a2e !important;
  border: 1px solid rgba(140, 98, 57, 0.25) !important;
}
body.theme-minimal .btn-secondary:hover {
  background: rgba(140, 98, 57, 0.15) !important;
}

body.theme-colorful .btn-secondary {
  background: rgba(0, 240, 255, 0.08) !important;
  color: #ffffff !important;
  border: 1px solid rgba(0, 240, 255, 0.25) !important;
}
body.theme-colorful .btn-secondary:hover {
  background: rgba(0, 240, 255, 0.15) !important;
}



/* Admin Guide Banner */
.admin-banner {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-left: 5px solid #d97706;
  border-radius: 8px;
  padding: 15px 20px;
  margin-bottom: 25px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  color: var(--text-main);
  animation: fadeIn 0.4s ease;
}

.admin-banner .banner-icon {
  color: #d97706;
  font-size: 1.3rem;
  margin-top: 2px;
}

.admin-banner .banner-text {
  font-size: 0.95rem;
  line-height: 1.5;
}

body.theme-light .admin-banner {
  background: rgba(217, 119, 6, 0.05);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

body.theme-rxtone .admin-banner {
  background: rgba(217, 119, 6, 0.06);
  border: 1px solid rgba(217, 119, 6, 0.18);
}

body.theme-minimal .admin-banner {
  background: rgba(194, 132, 46, 0.05);
  border: 1px solid rgba(194, 132, 46, 0.15);
}

body.theme-colorful .admin-banner {
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.25);
}

/* Navigation buttons for dashboard schedule */
.nav-arrow-btn {
  background: var(--bg-card, rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  cursor: pointer;
  color: var(--text-main, #ffffff);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  outline: none;
}

.nav-arrow-btn:hover {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
  transform: translateY(-1px);
}

.nav-arrow-btn:active {
  transform: translateY(1px);
}

/* For Light, Rx Tone & Minimal Themes */
body.theme-light .nav-arrow-btn,
body.theme-rxtone .nav-arrow-btn,
body.theme-minimal .nav-arrow-btn {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--text-main);
}

body.theme-light .nav-arrow-btn:hover,
body.theme-rxtone .nav-arrow-btn:hover,
body.theme-minimal .nav-arrow-btn:hover {
  background: var(--primary);
  color: #ffffff !important;
}

/* For Colorful Theme */
body.theme-colorful .nav-arrow-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: var(--text-main);
}

body.theme-colorful .nav-arrow-btn:hover {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Admin Modal Fields Optimization */
#admin-modal input, 
#admin-modal select, 
#admin-modal textarea {
  padding: 10px 14px !important;
  font-size: 0.95rem !important;
  border-radius: 8px !important;
}

#admin-modal label {
  font-size: 0.88rem !important;
  margin-bottom: 4px !important;
}

#admin-modal .form-group {
  gap: 6px !important;
}

/* Course Prerequisites and English Descriptions styling */
.course-prereq {
  font-size: 0.8rem;
  background: rgba(217, 119, 6, 0.05);
  border: 1px dashed rgba(217, 119, 6, 0.25);
  color: var(--warning, #d97706);
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

body.theme-light .course-prereq {
  background: rgba(217, 119, 6, 0.08);
  color: #b45309;
}

body.theme-minimal .course-prereq {
  background: rgba(194, 132, 46, 0.08);
  color: #c2842e;
}

body.theme-colorful .course-prereq {
  background: rgba(255, 215, 0, 0.1);
  color: #ffd700;
}

.course-desc-eng {
  font-size: 0.8rem;
  color: var(--text-dim, #a3a3a3);
  line-height: 1.45;
  font-style: italic;
  margin-top: -10px;
  margin-bottom: 20px;
  border-left: 2px solid var(--border-color);
  padding-left: 8px;
}

/* ==================== 8. CHAT ROOM STYLING ==================== */
.chat-inbox-layout {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 160px);
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.chat-sidebar-users {
  width: 300px;
  border-right: 1px solid var(--border-color);
  background: var(--bg-item-subtle);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--bg-main-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-user-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-user-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 4px solid transparent;
}

.chat-user-item:hover {
  background: var(--bg-item-subtle-hover);
}

.chat-user-item.active {
  background: rgba(194, 132, 46, 0.08);
  border-left-color: var(--primary);
}

.chat-user-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.chat-user-item-name {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-user-item-time {
  font-size: 0.65rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

.chat-user-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.chat-select-prompt {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  flex: 1;
  color: var(--text-muted);
  gap: 12px;
  padding: 30px;
  text-align: center;
}

.chat-select-prompt i {
  font-size: 3rem;
  color: var(--text-dim);
}

.chat-back-btn {
  display: none;
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0;
  margin-right: 12px;
  align-items: center;
  justify-content: center;
}

@media (max-width: 768px) {
  .chat-inbox-layout .chat-sidebar-users {
    width: 100%;
  }
  .chat-inbox-layout .chat-main-area {
    display: none;
  }
  
  .chat-inbox-layout.show-chat .chat-sidebar-users {
    display: none;
  }
  .chat-inbox-layout.show-chat .chat-main-area {
    display: flex;
    width: 100%;
  }
  .chat-inbox-layout.show-chat .chat-back-btn {
    display: inline-flex;
  }
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.chat-header {
  padding: 16px 20px;
  background: var(--bg-item-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header-info h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.chat-status {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

.chat-status i {
  color: #10b981;
  font-size: 0.5rem;
}

.chat-status.disconnected i {
  color: #ef4444;
}

.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: var(--bg-body);
}

.chat-message-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 75%;
}

.chat-message-group.self {
  align-self: flex-end;
}

.chat-message-group.others {
  align-self: flex-start;
}

.chat-msg-sender {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
}

.chat-message-group.self .chat-msg-sender {
  justify-content: flex-end;
  margin-left: 0;
  margin-right: 6px;
}

.chat-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-main);
  position: relative;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chat-message-group.self .chat-msg-bubble {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.chat-message-group.others .chat-msg-bubble {
  background: var(--bg-item-subtle);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border-color);
}

/* Specific bubble styling adjustments for colorful theme */
body.theme-colorful .chat-message-group.self .chat-msg-bubble {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  box-shadow: 0 4px 12px var(--primary-glow);
}

.chat-msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.65rem;
  margin-top: 2px;
  color: var(--text-dim);
  justify-content: flex-start;
  margin-left: 6px;
}

.chat-message-group.self .chat-msg-meta {
  justify-content: flex-end;
  margin-left: 0;
  margin-right: 6px;
}

.chat-msg-delete-btn {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.7rem;
  opacity: 0.6;
  transition: var(--transition);
}

.chat-msg-delete-btn:hover {
  opacity: 1;
}

.chat-input-area {
  padding: 16px 20px;
  background: var(--bg-item-subtle);
  border-top: 1px solid var(--border-color);
}

#chat-message-input {
  flex: 1;
  height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: var(--transition);
}

#chat-message-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-system-message {
  align-self: center;
  background: rgba(0, 0, 0, 0.05);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  margin: 6px 0;
}

body.theme-dark .chat-system-message {
  background: rgba(255, 255, 255, 0.05);
}

.chat-date-separator {
  align-self: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  background: var(--bg-item-subtle);
  padding: 3px 10px;
  border-radius: 8px;
  margin: 10px 0;
  border: 1px solid var(--border-color);
}


/* ==================== 9. ACADEMIC CALENDAR ==================== */
.calendar-view-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  background: var(--bg-main-card);
  padding: 16px 20px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.calendar-view-buttons {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.calendar-view-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-view-btn.active {
  background: var(--bg-main-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.calendar-month-nav {
  display: flex;
  align-items: center;
  gap: 15px;
}

.calendar-month-nav h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  min-width: 140px;
  text-align: center;
}

.calendar-grid-wrapper {
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background: var(--bg-item-subtle);
  border-bottom: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
}

.calendar-grid-header-cell {
  padding: 12px 6px;
  border-right: 1px solid var(--border-color);
}
.calendar-grid-header-cell:last-child {
  border-right: none;
}

.calendar-grid-header-cell:nth-child(1) { color: #ef4444; } /* Sunday */
.calendar-grid-header-cell:nth-child(7) { color: #2563eb; } /* Saturday */

.calendar-grid-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-day-cell {
  min-height: 110px;
  padding: 8px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-main-card);
  transition: background 0.15s ease;
  position: relative;
}

.calendar-day-cell:nth-child(7n) {
  border-right: none;
}

.calendar-day-cell:hover {
  background: var(--bg-item-subtle);
}

.calendar-day-cell.other-month {
  background: var(--bg-body);
  opacity: 0.5;
}

.calendar-day-header-number-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-day-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.calendar-day-cell.today .calendar-day-number {
  border: 2px solid #ef4444;
  border-radius: 50%;
  color: #ef4444;
  font-weight: 800;
  box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
}

.calendar-day-add-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--primary);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.calendar-day-cell:hover .calendar-day-add-btn {
  opacity: 1;
}

.calendar-day-add-btn:hover {
  background: rgba(var(--primary-rgb), 0.1);
}

.calendar-events-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  overflow: visible;
}

.calendar-event-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid transparent;
  transition: filter 0.15s ease;
}

.calendar-event-badge:hover {
  filter: brightness(0.92);
}

.calendar-legend-bar {
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.calendar-legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}

.calendar-legend-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.calendar-weekly-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.calendar-weekly-day-card {
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 15px 20px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
}

.calendar-weekly-day-card.today {
  border-left: 4px solid #ef4444;
}

.calendar-weekly-day-header {
  width: 120px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.calendar-weekly-day-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
}

.calendar-weekly-date-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.calendar-weekly-day-card.today .calendar-weekly-date-label {
  color: #ef4444;
  font-weight: 700;
}

.calendar-weekly-events-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-weekly-empty-text {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
}

.calendar-daily-container {
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.calendar-daily-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.calendar-daily-title h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.calendar-daily-title span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.calendar-agenda-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.calendar-agenda-item {
  background: var(--bg-main-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.calendar-agenda-item:hover {
  transform: translateY(-2px);
}

.calendar-agenda-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.calendar-agenda-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-agenda-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.calendar-agenda-notes {
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--bg-body);
  padding: 6px 12px;
  border-radius: 6px;
  border-left: 3px solid var(--border-color);
  margin-top: 4px;
}

.calendar-event-card {
  background: var(--bg-item-subtle);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  transition: background 0.15s ease;
}

.calendar-event-card:hover {
  background: var(--bg-input);
}

.category-mgmt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

@media (max-width: 768px) {
  .calendar-grid-header {
    font-size: 0.75rem;
  }
  
  .calendar-day-cell {
    min-height: 75px;
    padding: 4px;
  }
  
  .calendar-day-number {
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
  }
  
  .calendar-event-badge {
    font-size: 0.6rem;
    padding: 1.5px 3px;
  }
  
  .calendar-weekly-day-card {
    flex-direction: column;
    gap: 10px;
  }
  
  .calendar-weekly-day-header {
    width: 100%;
  }
}

/* Placeholder support for contenteditable */
[contenteditable=true]:empty:before {
  content: attr(placeholder);
  color: var(--text-muted);
  opacity: 0.6;
}

/* Rich Text Editor Select elements style */
.editor-select {
  padding: 6px 10px;
  background: var(--bg-body);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}
.editor-select:focus {
  border-color: var(--primary);
}

/* Announcement Card Style */
.announcement-card {
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.03) 100%);
  border: 1px solid var(--border-color);
  border-left: 5px solid #ef4444;
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.announcement-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-color-hover);
}

/* Dashboard Quick Nav Shortcuts */
.shortcut-card {
  transition: all 0.25s ease-in-out;
}
.shortcut-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-md);
  background: var(--bg-hover) !important;
}

/* Global Search Results */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 1px solid var(--border-color);
}
.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background-color: var(--bg-item-subtle);
}
.search-result-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.search-result-info {
  flex-grow: 1;
}

/* Urgency Timeline Styles */
.timeline-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  position: relative;
  padding-left: 10px;
}
.timeline-section {
  border-left: 2px solid var(--border-color);
  padding-left: 20px;
  position: relative;
  padding-bottom: 5px;
}
.timeline-section::before {
  content: '';
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}
.timeline-section.due-today::before {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}
.timeline-section.due-3days::before {
  background-color: var(--accent);
}
.timeline-section.due-future::before {
  background-color: var(--success);
}
.timeline-section-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}
.timeline-section.due-today .timeline-section-title { color: var(--danger); }
.timeline-section.due-3days .timeline-section-title { color: var(--accent); }
.timeline-section.due-future .timeline-section-title { color: var(--success); }

/* Smart Notifications Badge */
.smart-alert-card {
  display: flex;
  gap: 15px;
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(239, 68, 68, 0.02) 100%);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--danger);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  align-items: flex-start;
  animation: pulse-border 2s infinite alternate;
}
@keyframes pulse-border {
  from { border-left-color: var(--danger); }
  to { border-left-color: rgba(239, 68, 68, 0.4); }
}

@keyframes pulse-urgency {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

/* ==========================================
   EXAM SCHEDULE PLANNER (จัดตารางสอบ) STYLES
   ========================================== */
.exam-planner-container {
  display: flex;
  gap: 20px;
  flex-direction: row;
  align-items: flex-start;
  width: 100%;
}

@media (max-width: 992px) {
  .exam-planner-container {
    flex-direction: column;
  }
  .exam-planner-sidebar {
    width: 100% !important;
    min-width: 100% !important;
  }
}

.exam-planner-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}

.exam-planner-table th {
  border-right: 1px solid var(--border-color);
  border-bottom: 2px solid var(--border-color);
}

.exam-planner-table th:last-child {
  border-right: none;
}

.exam-planner-table td {
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
  padding: 8px;
}

.exam-planner-table td:last-child {
  border-right: none;
}

.exam-planner-table tr:last-child td {
  border-bottom: none;
}

.exam-day-cell {
  background: var(--bg-sidebar);
  text-align: center;
  padding: 12px 8px !important;
}

.exam-day-cell .day-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-main);
}

.exam-day-cell .day-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}

.exam-grid-cell {
  min-height: 110px;
  height: 100%;
  background: var(--bg-card);
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px !important;
}

.exam-grid-cell.drag-over {
  background: rgba(139, 92, 246, 0.12) !important;
  outline: 2px dashed #8b5cf6;
  outline-offset: -3px;
}

.exam-grid-cell.has-conflict {
  background: rgba(239, 68, 68, 0.05) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.exam-conflict-badge {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Scheduled Course Card inside Table Cell */
.exam-card-scheduled {
  background: var(--bg-sidebar);
  border: 1.5px solid rgba(139, 92, 246, 0.3);
  border-left: 4px solid #8b5cf6;
  border-radius: 8px;
  padding: 8px 10px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  position: relative;
  cursor: grab;
}

.exam-card-scheduled:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #8b5cf6;
}

.exam-card-scheduled.dragging {
  opacity: 0.4;
  transform: scale(0.95);
}

.exam-card-code {
  font-weight: 800;
  font-size: 0.85rem;
  color: #8b5cf6;
}

.exam-card-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.3;
  margin: 2px 0 4px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.exam-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.exam-meta-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
}

.exam-card-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
  justify-content: flex-end;
}

.exam-card-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  transition: background 0.2s, color 0.2s;
}

.exam-card-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #8b5cf6;
}

.exam-card-btn.remove-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Sidebar Course Cards */
.exam-sidebar-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px;
  transition: all 0.2s ease;
  cursor: grab;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.exam-sidebar-card:hover {
  border-color: #8b5cf6;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.exam-sidebar-card.dragging {
  opacity: 0.4;
}

.exam-sidebar-card.is-scheduled {
  border-left: 4px solid #10b981;
}

.exam-sidebar-card.is-pending {
  border-left: 4px solid #f59e0b;
}

.exam-sidebar-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.exam-status-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.exam-status-tag.scheduled {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.exam-status-tag.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}




