/* ECE Design Tokens & Base Styles */
:root {
  /* New Figma color theme */
  --ece-blue: #6FDFFE;
  --ece-blue-dark: #4dbcd4;
  --ece-blue-light: rgba(111, 223, 254, 0.15);
  --font-dark-blue: #4A2D8C;
  --font-grey: #D9D9D9;

  /* Legacy TU colors (kept for other pages) */
  --tu-red: #8c181c;
  --tu-red-dark: #6b1115;
  --tu-gold: #ffcf50;
  --tu-gold-dark: #e6b800;

  /* Surfaces */
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #2d2d2d;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --success: #15803d;
  --danger: #dc2626;
  --warning: #f59e0b;
  --cancelled: #9ca3af;

  --sidebar-width: 260px;
}

body {
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
}

/* =========================================
   HOME / DASHBOARD PAGE (Figma Design)
   ========================================= */

/* --- Top Navbar --- */
.home-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  /* NO backdrop-filter here — it creates a stacking context that breaks
     position:fixed children (drawer + overlay) on iOS Safari.
     The blur is handled by ::before instead. */
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

/* Blur layer lives on pseudo-element so it doesn't create a stacking
   context that traps the fixed-positioned drawer and overlay */
.home-navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.home-navbar .navbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
}

.home-navbar .navbar-brand img {
  height: 44px;
  width: auto;
}

.home-navbar .navbar-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.home-navbar .navbar-brand-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--font-dark-blue);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.home-navbar .navbar-brand-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.home-navbar .navbar-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.home-navbar .nav-link {
  color: var(--font-dark-blue);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  position: relative;
  white-space: nowrap;
}

.home-navbar .nav-link:hover {
  background-color: var(--ece-blue-light);
  color: var(--font-dark-blue);
}

.home-navbar .nav-link.active {
  background-color: var(--ece-blue);
  color: #fff;
  font-weight: 600;
}

.home-navbar .nav-link.logout-link {
  color: #dc2626;
  font-weight: 600;
}

.home-navbar .nav-link.logout-link:hover {
  background-color: rgba(220, 38, 38, 0.08);
}

/* --- Hero Section --- */
.home-hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding-top: 80px;
}

.home-hero-bg {
  position: absolute;
  inset: 0;
  background-image: url('https://engr.tu.ac.th/uploads/images_virtual_bg/2021.7.12_210712_7_.jpg');
  background-size: cover;
  background-position: center 35%;
  z-index: 0;
}

.home-hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.15) 0%,
      rgba(255, 255, 255, 0.3) 40%,
      rgba(245, 247, 250, 0.75) 85%,
      rgba(245, 247, 250, 1) 100%);
}

.home-hero-content {
  position: relative;
  z-index: 1;
  padding: 40px 20px 30px;
}

.home-hero-greeting {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--font-dark-blue);
  margin-bottom: 4px;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.6);
}

.home-hero-title {
  font-size: 3rem;
  font-weight: 900;
  color: var(--ece-blue);
  letter-spacing: 4px;
  text-transform: uppercase;
  margin-bottom: 8px;
  text-shadow: 0 2px 12px rgba(111, 223, 254, 0.3);
}

.home-hero-dept {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--font-dark-blue);
  letter-spacing: 3px;
  text-transform: uppercase;
  opacity: 0.8;
}

/* --- Action Cards --- */
.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  padding: 0 40px;
  margin-top: -20px;
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.home-action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px 28px;
  min-width: 280px;
  max-width: 340px;
  flex: 1;
  text-decoration: none;
  color: var(--text);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  position: relative;
  overflow: hidden;
}

.home-action-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(111, 223, 254, 0.05), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.home-action-card:hover {
  transform: translateY(-4px);
  border-color: var(--ece-blue);
  box-shadow: 0 12px 28px rgba(111, 223, 254, 0.15);
  text-decoration: none;
  color: var(--text);
}

.home-action-card:hover::before {
  opacity: 1;
}

.home-action-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.3rem;
}

.home-action-icon.red {
  background-color: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}

.home-action-icon.yellow {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.home-action-icon.blue {
  background-color: rgba(111, 223, 254, 0.15);
  color: #0891b2;
}

.home-action-text h5 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--font-dark-blue);
}

.home-action-text p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
}

.home-action-arrow {
  margin-left: auto;
  color: var(--text-muted);
  opacity: 0.4;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.home-action-card:hover .home-action-arrow {
  opacity: 1;
  color: var(--ece-blue);
  transform: translateX(4px);
}

/* --- Recent Bookings Section --- */
.home-recent {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 40px;
}

.home-recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.home-recent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
}

.home-recent-header h5 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--font-dark-blue);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-recent-header h5 i {
  color: var(--ece-blue);
}

.btn-view-all {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-view-all:hover {
  border-color: var(--ece-blue);
  color: var(--font-dark-blue);
  background: var(--ece-blue-light);
}

/* --- Toast Notifications (auto-dismiss) --- */
.home-toast-container {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: toastSlideIn 0.4s ease-out;
}

.home-toast-container.home-toast-hide {
  animation: toastFadeOut 0.5s ease-in forwards;
}

.home-toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--font-dark-blue);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  white-space: nowrap;
}

.home-toast i {
  font-size: 1.1rem;
}

.home-toast-success {
  background: #15803d;
}

.home-toast-danger,
.home-toast-error {
  background: #dc2626;
}

.home-toast-info {
  background: var(--font-dark-blue);
}

.home-toast-warning {
  background: #d97706;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastFadeOut {
  from {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }

  to {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
}

/* =========================================
   LOGIN PAGE (Figma Design)
   ========================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-bg-image {
  position: absolute;
  inset: 0;
  background-image: url('https://engr.tu.ac.th/uploads/images_virtual_bg/2021.7.12_210712_7_.jpg');
  background-size: cover;
  background-position: center 35%;
  z-index: 0;
}

.login-bg-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.2) 0%,
      rgba(255, 255, 255, 0.4) 50%,
      rgba(245, 247, 250, 0.7) 100%);
}

.login-logo-area {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.login-logo-area img {
  height: 70px;
  width: auto;
}

.login-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.login-logo-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--font-dark-blue);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.8);
}

.login-logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px rgba(255, 255, 255, 0.8);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 20px;
  padding: 44px 40px 36px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.login-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--font-dark-blue);
  margin-bottom: 6px;
}

.login-card-subtitle {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--font-dark-blue);
  opacity: 0.7;
  margin-bottom: 2px;
}

.login-card-faculty {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.login-form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.login-form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--font-grey);
  border-radius: 10px;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

.login-form-input:focus {
  border-color: var(--ece-blue);
  box-shadow: 0 0 0 3px rgba(111, 223, 254, 0.2);
}

.login-form-input::placeholder {
  color: #bbb;
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--ece-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Sarabun', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(111, 223, 254, 0.3);
}

.login-btn:hover {
  background: var(--ece-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(111, 223, 254, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.login-footer i {
  font-size: 1.1rem;
  color: var(--ece-blue);
}

/* Login alert animation */
.login-alert-slide {
  animation: alertSlideDown 0.3s ease-out;
}

@keyframes alertSlideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================================
   SHARED PAGE LAYOUT (All inner pages)
   ========================================= */

/* --- Page Header (compact hero for sub-pages) --- */
.page-header {
  position: relative;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding-top: 100px;
}

.page-header-bg {
  position: absolute;
  inset: 0;
  background-image: url('https://engr.tu.ac.th/uploads/images_virtual_bg/2021.7.12_210712_7_.jpg');
  background-size: cover;
  background-position: center 35%;
  z-index: 0;
}

.page-header-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 255, 255, 0.6) 40%,
      rgba(245, 247, 250, 0.9) 85%,
      rgba(245, 247, 250, 1) 100%);
}

.page-header-content {
  position: relative;
  z-index: 1;
  padding: 30px 20px 20px;
}

.page-header-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--font-dark-blue);
  margin-bottom: 6px;
  text-shadow: 0 2px 8px rgba(255, 255, 255, 0.6);
}

.page-header-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin: 0;
}

/* --- Page Content Wrapper --- */
.page-content {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 40px 40px;
}

/* --- ECE Card (Step cards, etc.) --- */
.ece-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.ece-card-header {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.ece-card-header h5 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--font-dark-blue);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.ece-card-body {
  padding: 24px 28px;
}

.ece-card-footer {
  padding: 16px 28px;
  border-top: 1px solid var(--border);
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- Step Badge --- */
.step-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.step-badge.red {
  background-color: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

.step-badge.yellow {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.step-badge.blue {
  background-color: rgba(111, 223, 254, 0.2);
  color: #0891b2;
}

/* --- ECE Form Inputs --- */
.ece-form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  display: block;
}

.ece-form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--font-grey);
  border-radius: 10px;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  outline: none;
  background: #fff;
  box-sizing: border-box;
}

.ece-form-input:focus {
  border-color: var(--ece-blue);
  box-shadow: 0 0 0 3px rgba(111, 223, 254, 0.2);
}

.ece-form-input::placeholder {
  color: #bbb;
}

/* --- ECE Detail Box --- */
.ece-detail-box {
  padding: 20px;
  background: #f8f9fb;
  border-radius: 14px;
  border: 1px solid var(--border);
}

/* --- ECE Day Check --- */
.ece-day-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ece-day-check .form-check-input:checked {
  background-color: var(--ece-blue);
  border-color: var(--ece-blue);
}

/* --- ECE Room Grid --- */
.ece-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

/* --- Room Select Card --- */
.room-select-card {
  display: block;
  text-align: left;
  padding: 16px;
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
}

.room-select-card:hover {
  border-color: var(--ece-blue);
  box-shadow: 0 4px 16px rgba(111, 223, 254, 0.12);
}

.room-check-icon {
  color: var(--ece-blue);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-check:checked+.room-select-card {
  border-color: var(--ece-blue);
  box-shadow: 0 0 0 3px rgba(111, 223, 254, 0.2);
}

.btn-check:checked+.room-select-card .room-check-icon {
  opacity: 1;
}

.btn-check:checked+.room-select-card .h5 {
  color: var(--font-dark-blue);
}

/* --- ECE Purpose Buttons --- */
.ece-purpose-btn {
  width: 100%;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font-family: 'Sarabun', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ece-purpose-btn:hover {
  border-color: var(--ece-blue);
  color: var(--font-dark-blue);
}

.ece-purpose-btn.active {
  background: var(--font-dark-blue);
  border-color: var(--font-dark-blue);
  color: #fff;
}

/* --- ECE Pill Button --- */
.ece-pill-btn {
  padding: 6px 20px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text);
}

.btn-check:checked+.ece-pill-btn {
  background: var(--ece-blue);
  border-color: var(--ece-blue);
  color: #fff;
}

/* --- ECE Primary Button --- */
.ece-btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 10px 24px;
  background: var(--ece-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(111, 223, 254, 0.3);
  text-decoration: none;
}

.ece-btn-primary:hover {
  background: var(--ece-blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(111, 223, 254, 0.4);
  color: #fff;
}

/* --- ECE Outline Danger Button --- */
.ece-btn-outline-danger {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  border: 1.5px solid #dc2626;
  border-radius: 8px;
  background: transparent;
  color: #dc2626;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ece-btn-outline-danger:hover {
  background: rgba(220, 38, 38, 0.06);
}

/* --- ECE Alert Conflict --- */
.ece-alert-conflict {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 22px;
  background: rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-left: 4px solid #dc2626;
  border-radius: 14px;
  color: #991b1b;
}

.ece-alert-conflict i {
  margin-top: 2px;
}

/* --- ECE Tab Bar --- */
.ece-tab-bar {
  display: flex;
  background: #fff;
  padding: 4px;
  border-radius: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.ece-tab {
  padding: 8px 22px;
  border: none;
  border-radius: 20px;
  background: transparent;
  font-family: 'Sarabun', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ece-tab:hover {
  color: var(--font-dark-blue);
}

.ece-tab.active {
  background: var(--ece-blue);
  color: #fff;
}

/* --- ECE Badges --- */
.ece-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.ece-badge.approved {
  background-color: var(--success);
  color: #fff;
}

.ece-badge.pending {
  background-color: var(--warning);
  color: #000;
}

.ece-badge.cancelled {
  background-color: var(--cancelled);
  color: #fff;
}

/* --- ECE Icon Box --- */
.ece-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.ece-icon-box.blue {
  background: rgba(111, 223, 254, 0.15);
  color: #0891b2;
}

.ece-icon-box.yellow {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.ece-icon-box.grey {
  background: rgba(156, 163, 175, 0.15);
  color: #6b7280;
}

/* --- ECE Pagination --- */
.ece-page-active {
  background-color: var(--ece-blue) !important;
  border-color: var(--ece-blue) !important;
}


/* =========================================
   LEGACY SIDEBAR LAYOUT (Other pages)
   ========================================= */

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background-color: var(--tu-red);
  color: white;
  padding-top: 1.5rem;
  z-index: 1000;
  border-right: 1px solid var(--tu-red-dark);
}

.sidebar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.8rem 1.5rem;
  margin: 0.2rem 0.8rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}

.sidebar .nav-link:hover {
  background-color: var(--tu-red-dark);
  color: var(--tu-gold);
}

.sidebar .nav-link.active {
  background-color: var(--tu-red-dark);
  color: var(--tu-gold);
  font-weight: 600;
}

.sidebar-logo {
  padding: 0 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 1.5rem;
}

/* Main Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 2rem;
}

/* Header Bar */
.top-header {
  height: 70px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 900;
}

/* =========================================
   ADMIN PAGES (top-navbar layout)
   ========================================= */

.admin-page-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 100px 2rem 3rem;
}

.admin-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.admin-page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

.admin-page-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #fefce8;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  overflow: hidden;
}

.admin-card-header {
  background: var(--surface);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  padding: 1.5rem;
  text-align: center;
}

.admin-stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.5rem;
}

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

/* Nav tabs in admin system page */
#systemTabs .nav-link {
  transition: all 0.2s;
  color: var(--text-muted);
}

#systemTabs .nav-link.active {
  background-color: var(--tu-red) !important;
  color: white !important;
}

#systemTabs .nav-link:hover:not(.active) {
  background-color: var(--bg);
}

/* =========================================
   Cards & Components
   ========================================= */

/* Cards & Components */
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-primary {
  background-color: var(--tu-red);
  border-color: var(--tu-red);
}

.btn-primary:hover {
  background-color: var(--tu-red-dark);
  border-color: var(--tu-red-dark);
}

.btn-outline-primary {
  color: var(--tu-red);
  border-color: var(--tu-red);
}

.btn-outline-primary:hover {
  background-color: var(--tu-red);
  color: white;
}

.badge-pending {
  background-color: var(--warning);
  color: #000;
}

.badge-approved {
  background-color: var(--success);
  color: #fff;
}

.badge-cancelled {
  background-color: var(--cancelled);
  color: #fff;
}

/* Dashboard Widgets */
.stat-card {
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-5px);
}

/* Form Styling */
.form-label {
  font-weight: 500;
  color: var(--text);
}

/* FullCalendar Customization */
.fc-toolbar-title {
  font-family: 'Sarabun', sans-serif !important;
}

.fc-event {
  border: none !important;
  padding: 2px 4px;
}

/* =========================================
   TABLE STYLES (Shared)
   ========================================= */
.table thead th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom-width: 1px;
}

.table td {
  vertical-align: middle;
  font-size: 0.9rem;
}

.table-empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}

.table-empty-state i {
  font-size: 2rem;
  display: block;
  margin-bottom: 12px;
  opacity: 0.25;
}

/* =========================================
   RESPONSIVE HAMBURGER NAVBAR
   ========================================= */

/* Hamburger button — hidden on desktop */
.navbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  box-sizing: border-box;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  z-index: 1200;
  position: relative;
  flex-shrink: 0;
  line-height: 0;
}

.navbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--font-dark-blue);
  border-radius: 2px;
  transition: all 0.3s ease;
  transform-origin: center;
  flex-shrink: 0;
}

/* Animate to X when open */
.navbar-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.navbar-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu overlay */
.navbar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1050;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.navbar-overlay.open {
  display: block;
  opacity: 1;
}

/* Nav link icons — hidden on desktop */
.home-navbar .nav-link i {
  display: none;
}

/* Divider line — hidden on desktop */
.nav-divider-mobile {
  display: none;
}


/* =========================================
   RESPONSIVE — Large tablets (≤ 992px)
   ========================================= */
@media (max-width: 992px) {
  .home-navbar {
    padding: 12px 20px;
  }

  .home-navbar .nav-link {
    font-size: 0.82rem;
    padding: 7px 12px;
  }

  .page-content {
    padding: 0 24px 40px;
  }

  .home-recent {
    padding: 0 24px;
  }

  .home-actions {
    padding: 0 24px;
  }

  .admin-page-wrapper {
    padding: 100px 1.5rem 3rem;
  }
}


/* =========================================
   RESPONSIVE — Mobile (≤ 768px)
   ========================================= */
@media (max-width: 768px) {

  /* ── Navbar: Show hamburger, hide inline nav ── */
  .navbar-hamburger {
    display: flex;
  }

  .home-navbar .navbar-nav {
    /* Slide-in drawer from right */
    position: fixed;
    top: 0;
    right: -100%;
    bottom: 0;
    width: min(280px, 85vw);
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px;
    padding: 80px 16px 24px;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    z-index: 1100;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
  }

  .home-navbar .navbar-nav.open {
    right: 0;
  }

  .home-navbar .nav-link {
    font-size: 1rem;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--font-dark-blue);
  }

  .home-navbar .nav-link i {
    display: inline-block;
    width: 20px;
    text-align: center;
    font-size: 1rem;
    opacity: 0.7;
  }

  .home-navbar .nav-link.active i,
  .home-navbar .nav-link:hover i {
    opacity: 1;
  }

  .home-navbar .nav-link.logout-link {
    margin-top: 4px;
  }

  /* Mobile divider between user/admin sections */
  .nav-divider-mobile {
    display: block;
    height: 1px;
    background: var(--border);
    margin: 8px 0;
    padding: 0;
    list-style: none;
  }

  /* ── Hero & Home ── */
  .home-hero {
    min-height: 280px;
    padding-top: 70px;
  }

  .home-hero-greeting {
    font-size: 1.5rem;
  }

  .home-hero-title {
    font-size: 1.7rem;
    letter-spacing: 2px;
  }

  .home-hero-dept {
    font-size: 0.72rem;
  }

  .home-actions {
    padding: 0 16px;
    gap: 12px;
    grid-template-columns: 1fr;
    margin-top: -10px;
  }

  .home-action-card {
    min-width: unset;
    max-width: 100%;
  }

  .home-recent {
    padding: 0 16px;
    margin: 24px auto;
  }

  /* ── Login page ── */
  .login-card {
    margin: 0 16px;
    padding: 28px 20px 24px;
  }

  .login-logo-area {
    gap: 10px;
    margin-bottom: 24px;
  }

  .login-logo-area img {
    height: 48px;
  }

  .login-logo-title {
    font-size: 0.9rem;
  }

  /* ── Page header ── */
  .page-header {
    min-height: 160px;
    padding-top: 70px;
  }

  .page-header-title {
    font-size: 1.4rem;
  }

  .page-header-subtitle {
    font-size: 0.78rem;
  }

  /* ── Page content ── */
  .page-content {
    padding: 0 16px 32px;
  }

  /* ── Tab bar ── */
  .ece-tab-bar {
    flex-wrap: wrap;
    border-radius: 14px;
    gap: 4px;
  }

  .ece-tab {
    font-size: 0.8rem;
    padding: 6px 12px;
    flex: 1 1 auto;
    text-align: center;
  }

  /* ── Cards ── */
  .ece-card-body {
    padding: 16px;
  }

  .ece-card-header {
    padding: 14px 16px;
  }

  .ece-card-footer {
    padding: 12px 16px;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  .ece-card-footer > * {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* ── Room grid — 1 column on mobile ── */
  .ece-room-grid {
    grid-template-columns: 1fr;
  }

  /* ── Day checkboxes — wrap ── */
  .d-flex.flex-wrap.gap-2 {
    gap: 6px !important;
  }

  /* ── Toast — wrap text, don't overflow ── */
  .home-toast-container {
    width: calc(100% - 32px);
    left: 16px;
    right: 16px;
    transform: none;
    top: 70px;
  }

  .home-toast {
    white-space: normal;
    word-break: break-word;
    font-size: 0.85rem;
    padding: 12px 16px;
  }

  /* ── Tables — horizontal scroll ── */
  .table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }

  .table {
    min-width: 520px;
  }

  /* ── Admin pages ── */
  .admin-page-wrapper {
    padding: 80px 16px 2rem;
  }

  .admin-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-page-badge {
    align-self: flex-start;
  }

  .admin-stat-card {
    padding: 1rem;
  }

  .admin-stat-value {
    font-size: 1.6rem;
  }

  .admin-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  /* ── Booking form ── */
  .row.g-3 > [class*="col-md"] {
    width: 100%;
  }

  /* ── Calendar ── */
  .fc-toolbar {
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
  }

  .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .fc-toolbar-title {
    font-size: 1rem !important;
  }

  .fc-button {
    font-size: 0.78rem !important;
    padding: 4px 10px !important;
  }

  /* Calendar filter card */
  .d-flex.gap-2.flex-wrap {
    flex-direction: column;
    gap: 8px !important;
  }

  /* ── My Bookings search bar ── */
  .d-flex.gap-2 .form-control,
  .d-flex.gap-2 .form-select {
    min-width: unset;
    width: 100% !important;
  }

  /* Recent bookings table header */
  .home-recent-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
  }

  .home-recent-header h5 {
    font-size: 0.9rem;
  }
}


/* =========================================
   ADMIN SYSTEM — Tab bar scrollable on mobile
   ========================================= */
@media (max-width: 768px) {
  #systemTabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #systemTabs::-webkit-scrollbar {
    display: none;
  }

  #systemTabs .nav-link {
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  /* ── Booking form — stack submit/cancel buttons ── */
  .booking-form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .booking-form-actions .ece-btn-primary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .booking-form-actions .btn-link {
    text-align: center;
  }

  /* ── Admin reports filter — stack buttons ── */
  .admin-reports-filter-btns {
    flex-direction: column;
  }

  .admin-reports-filter-btns .ece-btn-primary,
  .admin-reports-filter-btns a.btn {
    width: 100% !important;
    justify-content: center;
  }
}


/* =========================================
   RESPONSIVE — Small phones (≤ 480px)
   ========================================= */
@media (max-width: 480px) {
  .home-navbar {
    padding: 10px 14px;
  }

  .home-hero-greeting {
    font-size: 1.3rem;
  }

  .home-hero-title {
    font-size: 1.4rem;
    letter-spacing: 1px;
  }

  .page-header-title {
    font-size: 1.2rem;
  }

  .ece-room-grid {
    grid-template-columns: 1fr;
  }

  .ece-tab {
    font-size: 0.74rem;
    padding: 5px 8px;
  }

  .admin-stat-value {
    font-size: 1.4rem;
  }

  .fc-toolbar-title {
    font-size: 0.9rem !important;
  }

  .home-toast {
    font-size: 0.8rem;
    padding: 10px 14px;
  }
}