/* Custom CSS Properties */
:root {
  --sidebar-width: 250px;
  --primary-color: #2563EB;
  --primary-dark: #1D4ED8;
  --secondary-color: #10B981;
  --secondary-dark: #059669;
  --danger-color: #EF4444;
  --danger-dark: #DC2626;
  --warning-color: #F59E0B;
  --warning-dark: #D97706;
  --success-color: #10B981;
  --success-dark: #059669;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --surface-color: #FFFFFF;
  --background-color: #F3F4F6;
  --border-color: #E5E7EB;
}

/* Base Layout */
html {
  height: 100%;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  font-family: "Sarabun", sans-serif;
  background-color: #f3f4f6;
  margin: 0;
  overflow-x: hidden;
  color: var(--text-primary);
  line-height: 1.5;
}

/* Layout Components */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main-content {
  flex-grow: 1;
  padding: 0;
  width: 100%;
  margin-left: var(--sidebar-width);
  margin-top: 65px;
  transition: margin-left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* When sidebar is not active, main-content expands to full width */
body:has(.sidebar:not(.active)) .main-content {
  margin-left: 0;
}

.content-container {
  width: 100%;
  padding: 1rem;
  box-sizing: border-box;
  overflow-x: hidden;
}

@media (min-width: 768px) {
  .content-container {
    padding: 1.5rem;
  }
}

/* Form Components */
/* Form Components */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  color: #374151;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.5rem 1rem;
  border: 1px solid #D1D5DB;
  border-radius: 0.375rem;
  outline: none;
}

.form-input:focus {
  border-color: #4A90E2;
  box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* Button Components */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(74, 144, 226, 0.25);
  transition: all 0.3s ease;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #357ABD 0%, #2563EB 100%);
  box-shadow: 0 6px 12px rgba(74, 144, 226, 0.35);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(74, 144, 226, 0.25);
}

.btn-secondary {
  background-color: #50C878;
  color: white;
}

.btn-secondary:hover {
  background-color: #3DA75E;
}

.btn-danger {
  background: linear-gradient(135deg, #FF6B6B 0%, #E65252 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(255, 107, 107, 0.25);
  transition: all 0.3s ease;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #E65252 0%, #DC2626 100%);
  box-shadow: 0 6px 12px rgba(255, 107, 107, 0.35);
  transform: translateY(-2px);
}

.btn-danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(255, 107, 107, 0.25);
}

.btn-cancel {
  background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
  color: #374151;
  border: none;
  box-shadow: 0 2px 8px rgba(55, 65, 81, 0.08);
  transition: all 0.3s ease;
}

.btn-cancel:hover {
  background: linear-gradient(135deg, #D1D5DB 0%, #9CA3AF 100%);
  box-shadow: 0 4px 12px rgba(55, 65, 81, 0.12);
  transform: translateY(-1px);
}

.btn-cancel:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(55, 65, 81, 0.08);
}

/* Add Task Button - Special Styling */
.btn-add-task {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
}

.btn-add-task:hover {
  background: linear-gradient(135deg, #357ABD 0%, #2563EB 100%);
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.35);
  transform: translateY(-2px);
}

.btn-add-task:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.btn-add-task .icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-add-task .icon-circle svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.5;
}

/* Logout Button - Red variant */
.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #FF6B6B 0%, #E65252 100%);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.25);
}

.btn-logout:hover {
  background: linear-gradient(135deg, #E65252 0%, #D63A3A 100%);
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.35);
  transform: translateY(-2px);
}

.btn-logout:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

/* Reset Button - Secondary variant */
.btn-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 1rem;
  background: linear-gradient(135deg, #E5E7EB 0%, #D1D5DB 100%);
  color: #374151;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(55, 65, 81, 0.08);
}

.btn-reset:hover {
  background: linear-gradient(135deg, #D1D5DB 0%, #9CA3AF 100%);
  box-shadow: 0 4px 12px rgba(55, 65, 81, 0.12);
  transform: translateY(-1px);
}

.btn-reset:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(55, 65, 81, 0.08);
}

/* Action Buttons - Edit & Delete */
.btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #4A90E2 0%, #357ABD 100%);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.25);
}

.btn-edit:hover {
  background: linear-gradient(135deg, #357ABD 0%, #2563EB 100%);
  box-shadow: 0 6px 16px rgba(74, 144, 226, 0.35);
  transform: translateY(-2px);
}

.btn-edit:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.btn-edit .icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-edit .icon-circle svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.5;
}

.btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #FF6B6B 0%, #E65252 100%);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.25);
}

.btn-delete:hover {
  background: linear-gradient(135deg, #E65252 0%, #D63A3A 100%);
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.35);
  transform: translateY(-2px);
}

.btn-delete:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

.btn-delete .icon-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-delete .icon-circle svg {
  width: 1rem;
  height: 1rem;
  stroke-width: 2.5;
}


/* Notification Components */
.notification {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.3s ease-out;
}

.notification-success {
  background-color: #50C878;
}

.notification-error {
  background-color: #FF6B6B;
}

.notification-warning {
  background-color: #FFB347;
  color: #1F2937;
}

/* ===================================
   Toast System Styles
   =================================== */

/* Toast Container */
#toast-container {
  position: fixed;
  top: 80px;
  right: 1rem;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
}

/* Toast Element */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  border-left: 4px solid;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
  min-width: 300px;
  animation: slideInToast 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

/* Toast Animations */
@keyframes slideInToast {
  from {
    opacity: 0;
    transform: translateX(400px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutToast {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(400px);
  }
}

/* Toast Types */
.toast-success {
  border-left-color: #50C878;
  background: white;
}

.toast-success .toast-icon {
  color: #50C878;
}

.toast-error {
  border-left-color: #FF6B6B;
  background: white;
}

.toast-error .toast-icon {
  color: #FF6B6B;
}

.toast-warning {
  border-left-color: #FFB347;
  background: white;
}

.toast-warning .toast-icon {
  color: #FFB347;
}

.toast-info {
  border-left-color: #2563EB;
  background: white;
}

.toast-info .toast-icon {
  color: #2563EB;
}

/* Toast Icon */
.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

/* Toast Content */
.toast-content {
  flex: 1;
}

.toast-message {
  margin: 0;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: #1F2937;
  line-height: 1.4;
}

/* Toast Close Button */
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: #9CA3AF;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: #6B7280;
}

.toast-close svg {
  width: 100%;
  height: 100%;
}

/* Toast Mobile Responsive */
@media (max-width: 640px) {
  #toast-container {
    max-width: calc(100% - 2rem);
    right: 1rem;
    left: 1rem;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }
}

@keyframes fadeOutMenu {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes fadeOutOverlay {
  from {
    background-color: rgba(0, 0, 0, 0.5);
  }

  to {
    background-color: rgba(0, 0, 0, 0);
  }
}

@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

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

/* Table Components - Prevent text wrapping */
table,
table td,
table th {
  white-space: nowrap;
}

/* Table alignment - Center status column */
table thead th {
  text-align: left;
  vertical-align: middle;
}

/* Center align 3rd column (สถานะ in general-assignments) */
table thead th:nth-child(3) {
  text-align: center;
}

/* Center align 4th column (สถานะ in index/dashboard) */
table thead th:nth-child(4) {
  text-align: center;
}

table tbody td {
  vertical-align: middle;
}

/* Center align 3rd column (สถานะ in general-assignments) */
table tbody td:nth-child(3) {
  text-align: center;
}

/* Center align 4th column (สถานะ in index/dashboard) */
table tbody td:nth-child(4) {
  text-align: center;
}

/* ===================================
   Additional Navbar Enhancements
   =================================== */

/* Smooth transitions */
* {
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Prevent CLS (Cumulative Layout Shift) */
html {
  overflow-y: scroll;
}

/* Enhance focus states for accessibility */
.nav-link:focus,
.user-profile-btn:focus,
.dropdown-item:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

/* Smooth page transitions */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

body {
  animation: fadeIn 0.3s ease;
}

/* Mobile menu animations */
@keyframes slideDown {
  from {
    max-height: 0;
    opacity: 0;
  }

  to {
    max-height: 500px;
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    max-height: 500px;
    opacity: 1;
  }

  to {
    max-height: 0;
    opacity: 0;
  }
}

.nav-menu.mobile-open {
  animation: slideDown 0.3s ease forwards;
}

/* Badge style for notifications (future use) */
.nav-link.has-notification::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #FF6B6B;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* Improved spacing for main content */
main {
  padding-top: 1rem;
}

/* Loading skeleton styles */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 2s infinite;
}

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

  100% {
    background-position: -200% 0;
  }
}

/* ===================================
   New Universal Mobile Navbar Styles
   =================================== */

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 98;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

/* User Menu Dropdown */
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
}

.user-menu-btn:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}

.user-menu-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.user-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown {
  position: relative;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-dropdown-item {
  display: block;
  padding: 0.75rem 1rem;
  color: #1f2937;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.95rem;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: #f9fafb;
  color: #4A90E2;
  padding-left: 1.5rem;
}

.user-dropdown-item.danger {
  color: #FF6B6B;
}

.user-dropdown-item.danger:hover {
  background: rgba(255, 107, 107, 0.08);
  color: #FF6B6B;
}

.user-dropdown-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 0.25rem 0;
}

/* Mobile Responsive - Hide desktop menu, show mobile */
@media (max-width: 768px) {
  .mobile-menu-button {
    display: flex !important;
  }

  .nav-menu {
    display: none !important;
  }

  .user-menu {
    display: none !important;
  }

  .navbar-content {
    gap: 1rem;
  }

  .navbar-brand {
    flex: 1;
  }

  .navbar-title {
    font-size: 0.95rem;
  }

  .nav-menu-mobile {
    display: none;
  }

  .nav-menu-mobile.open {
    display: block;
  }
}

@media (max-width: 640px) {
  .navbar-brand {
    gap: 0.5rem;
  }

  .navbar-logo {
    width: 32px;
    height: 32px;
  }

  .navbar-logo svg {
    width: 18px;
    height: 18px;
  }

  .navbar-title {
    display: none;
  }

  .nav-menu-mobile {
    top: 60px;
    max-height: calc(100vh - 60px);
  }
}

/* ===================================
   Navbar Styles
   =================================== */

.navbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 65px;
  background: #FFFFFF;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 999;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--border-color);
  transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.navbar-left,
.navbar-center,
.navbar-right {
  display: flex;
  align-items: center;
}

.navbar-left {
  flex: 0;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  /* margin-left: 1rem; */
}

.navbar-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e5e7eb;
}

.navbar-date-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
}

.navbar-center {
  flex: 1;
  justify-content: center;
}

.navbar-right {
  flex: 0;
  gap: 2rem;
}

.navbar-hamburger {
  display: flex;
  background: none;
  border: none;
  cursor: pointer;
  /* padding: 0.25rem 0.4rem; */
  color: var(--text-primary);
  z-index: 1100;
  transition: all 0.3s ease;
  flex-direction: column;
  gap: 1px;
  border-radius: 4px;
}

.navbar-hamburger:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.15);
}

.navbar-hamburger:active {
  transform: scale(0.95);
}

.navbar-hamburger .hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  margin: 2px 0;
  border-radius: 2px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.navbar-hamburger.active .hamburger-line:nth-child(1) {
  transform: translateY(13px) rotate(45deg);
}

.navbar-hamburger.active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.navbar-hamburger.active .hamburger-line:nth-child(3) {
  transform: translateY(-13px) rotate(-45deg);
}

/* Reset hamburger animation when sidebar is not active (desktop) */
body:has(.sidebar:not(.active)) .navbar-hamburger.active .hamburger-line:nth-child(1),
body:has(.sidebar:not(.active)) .navbar-hamburger.active .hamburger-line:nth-child(3) {
  transform: none;
}

body:has(.sidebar:not(.active)) .navbar-hamburger.active .hamburger-line:nth-child(2) {
  opacity: 1;
}

.navbar-brand {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.navbar-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.navbar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #E5E7EB;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-color);
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 1px #E5E7EB;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.navbar-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.navbar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-logout {
  background: none;
  border: none;
  color: black;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.navbar-logout:hover {
  color: rgb(255, 58, 58);
}

.navbar-logout svg {
  width: 20px;
  height: 20px;
}

/* ===================================
   Sidebar Navigation Styles
   =================================== */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #FFFFFF;
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  color: white;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s ease,
    opacity 0.4s ease;
  will-change: transform;
  transform: translateX(-100%);
}

.sidebar.active {
  transform: translateX(0);
}

@media (min-width: 1025px) {
  .sidebar {
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar:not(.active) {
    transform: translateX(-100%);
  }
}

.sidebar-header {
  padding: 16px 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.sidebar-brand:hover {
  opacity: 0.8;
}

.sidebar-icon {
  width: 32px;
  height: 32px;
  color: var(--primary-color);
  flex-shrink: 0;
}

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

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease;
}

.sidebar-close:hover {
  background: #F3F4F6;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.sidebar-section {
  padding: 0 1rem;
}

.sidebar-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #9CA3AF;
  margin: 1rem 1rem 0.5rem 1rem;
  letter-spacing: 0.05em;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-menu li {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
}

.sidebar-link:hover {
  background: #EFF6FF;
  color: var(--primary-color);
}

.sidebar-link.active {
  background: #EFF6FF;
  color: var(--primary-color);
  font-weight: 600;
  border-right: 3px solid var(--primary-color);
}

/* .sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 4px;
  height: 100%;
  background: white;
  border-radius: 0 4px 4px 0;
} */

.sidebar-link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.sidebar-link:hover .sidebar-link-icon,
.sidebar-link.active .sidebar-link-icon {
  opacity: 1;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  /* padding: 1rem; */
  background: rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  transition: all 0.3s ease;
}

.sidebar-user-profile:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.8rem;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 1.25rem;
  background: transparent;
  color: red;
  border: 1px solid red;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  /* transition: all 0.3s ease; */
  font-size: 0.95rem;
  font-family: inherit;
}

.sidebar-logout-btn:hover {
  border-color: rgba(255, 0, 0, 0.64);
  color: rgba(255, 0, 0, 0.64);
}

.sidebar-logout-btn svg {
  width: 18px;
  height: 18px;
}

.sidebar-add-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
  transform: translateY(-2px);
}

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

.sidebar-add-btn svg {
  width: 20px;
  height: 20px;
}

/* Sidebar Toggle Button (Hamburger Menu) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  width: 48px;
  height: 48px;
  padding: 0;
  margin: 0;
  background: #fff;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  color: #2c3e50;
  z-index: 1100;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  align-items: center;
  justify-content: center;
  font-size: 0;
}

.sidebar-toggle:hover {
  background: #f0f4f8;
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.sidebar-toggle:active {
  transform: scale(0.96) translateY(0);
}

.sidebar-toggle.active {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.35);
}

.sidebar-toggle .hamburger {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 24px;
  height: 20px;
  justify-content: center;
}

.sidebar-toggle .hamburger-line {
  width: 100%;
  height: 2.5px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-origin: center;
  display: block;
}

.sidebar-toggle.active .hamburger-line:nth-child(1) {
  transform: translateY(13px) rotate(45deg);
  background: #fff;
}

.sidebar-toggle.active .hamburger-line:nth-child(2) {
  opacity: 0;
  background: #fff;
  transform: translateX(-10px);
}

.sidebar-toggle.active .hamburger-line:nth-child(3) {
  transform: translateY(-13px) rotate(-45deg);
  background: #fff;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

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

/* Reset for Desktop */
@media (min-width: 1025px) {
  .sidebar-close {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .sidebar-toggle {
    display: none;
  }

  .navbar {
    left: var(--sidebar-width);
    transition: left 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  /* When sidebar is not active, navbar moves to left 0 */
  body:has(.sidebar:not(.active)) .navbar {
    left: 0;
  }

  /* Hamburger animation on desktop */
  .navbar-hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(13px) rotate(45deg);
  }

  .navbar-hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }

  .navbar-hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-13px) rotate(-45deg);
  }
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform;
  }

  .navbar {
    padding: 0 16px;
  }

  .sidebar-header {
    padding: 12px 1rem;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .sidebar-close {
    display: block;
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-toggle {
    display: flex;
  }

  .navbar {
    left: 0;
  }

  .main-content {
    margin-left: 0;
  }

  .content-container {
    padding: 1rem;
  }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 100%;
  }

  .sidebar {
    width: 100%;
  }

  .sidebar-toggle {
    top: 1rem;
    left: 1rem;
  }

  .sidebar-header {
    padding: 12px 1rem;
  }

  .sidebar-nav {
    padding: 1rem 0;
  }

  .content-container {
    padding: 1rem 0.75rem;
  }

  .navbar-user-info {
    display: none;
  }

  .navbar-logout {
    display: none;
  }
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ================================
   Modal Styles
   ================================ */

/* Modal Backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 1rem;
}

.modal-backdrop.modal-show {
  opacity: 1;
}

.modal-backdrop.hidden {
  display: none;
}

/* Modal Container */
.modal-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(-20px);
  transition: transform 0.3s ease;
}

.modal-backdrop.modal-show .modal-container {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

/* Ensure no ::before element */
.modal-header::before {
  display: none !important;
  content: none !important;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #1f2937;
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #6b7280;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.2s, color 0.2s;
}

.modal-close-btn:hover {
  background-color: #f3f4f6;
  color: #1f2937;
}

/* Modal Body */
.modal-body {
  padding: 1.5rem;
}

/* Modal Scrollbar - Hidden */
.modal-container {
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

.modal-container::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Opera */
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .modal-container {
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    min-height: 60vh;
    border-radius: 16px 16px 0 0;
    margin: 0;
  }

  .modal-header {
    padding: 1.25rem 1rem;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    border-bottom: 2px solid #e5e7eb;
  }

  .modal-header h2 {
    font-size: 1.25rem;
  }

  .modal-body {
    padding: 1.25rem 1rem;
    padding-bottom: 2rem;
  }

  /* Form adjustments for mobile */
  .modal-body form .space-y-6>*+* {
    margin-top: 1.25rem;
  }

  .modal-body label {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
  }

  .modal-body input,
  .modal-body select,
  .modal-body textarea {
    padding: 0.875rem;
    font-size: 16px;
    /* Prevent zoom on iOS */
  }

  .modal-body textarea {
    min-height: 100px;
  }

  /* Button adjustments */
  .modal-body .grid-cols-2 {
    gap: 0.75rem;
  }

  .modal-body button {
    padding: 0.875rem 1rem;
    font-size: 1rem;
    font-weight: 500;
  }


}

/* Mobile Responsiveness Improvements */
@media (max-width: 1024px) {

  /* Sidebar Mobile Behavior */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  .sidebar.active {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  }

  /* Main Content shouldn't have margin on mobile */
  .main-content {
    margin-left: 0 !important;
    width: 100%;
  }

  /* Ensure overlay works */
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 39;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
  }
}

/* Base Mobile Padding Adjustments */
@media (max-width: 640px) {
  .content-container {
    padding: 1rem;
  }

  /* Filter Sections Stack */
  .filter-section .flex {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-section .flex>* {
    width: 100%;
  }

  /* Modal adjustments */
  .modal-container {
    width: 100%;
    margin: 0;
    border-radius: 12px 12px 0 0;
    position: absolute;
    bottom: 0;
    max-height: 90vh;
  }
}

/* Hide Navbar Date on Mobile */
@media (max-width: 640px) {

  .navbar-date,
  #navbarCurrentDate {
    display: none !important;
  }
}

/* SweetAlert Z-Index Fix */
.swal2-container {
  z-index: 10000 !important;
}