/* ===========================================
   🌸 FRESH & SWEET PASTEL THEME
   สดชื่น หวาน สะอาด หรู อ่านง่าย
   =========================================== */
:root {
  /* Primary Accent - Fresh Teal */
  --primary-color: #38B2AC;
  --secondary-color: #4FD1C5;
  --accent-color: #48BB78;

  /* Backgrounds - Clean White */
  --bg-color: #FAFBFC;
  --card-bg: #FFFFFF;

  /* Text - Deep Navy for Excellent Readability */
  --text-color: #1A2B3C;
  --heading-color: #1A2B3C;
  --muted-color: #6B7C8F;

  /* 🌈 Fresh & Sweet Functional Colors */
  --success-color: #48BB78;
  --success-light: #F0FFF4;
  --warning-color: #ECC94B;
  --warning-light: #FFFBEB;
  --danger-color: #F687B3;
  --danger-light: #FFF5F7;
  --info-color: #63B3ED;
  --info-light: #EBF8FF;

  /* Status Colors */
  --status-open: #48BB78;
  --status-open-bg: #F0FFF4;
  --status-closed: #A0AEC0;
  --status-closed-bg: #F7FAFC;

  /* Shift Colors - Sweet & Visible */
  --shift-day: #F6AD55;
  --shift-day-bg: #FFFAF0;
  --shift-night: #667EEA;
  --shift-night-bg: #EBF4FF;

  /* Layout */
  --sidebar-width: 300px;
  --header-height: 60px;
  --font-family: 'Sarabun', 'Outfit', sans-serif;

  /* 🎀 Sweet Pastel Gradients - Soft & Beautiful */
  --gradient-primary: linear-gradient(135deg, #E0F4FF 0%, #B9E6FE 100%);
  --gradient-success: linear-gradient(135deg, #C6F6D5 0%, #9AE6B4 100%);
  --gradient-danger: linear-gradient(135deg, #FED7E2 0%, #FBB6CE 100%);
  --gradient-info: linear-gradient(135deg, #BEE3F8 0%, #90CDF4 100%);
  --gradient-purple: linear-gradient(135deg, #E9D8FD 0%, #D6BCFA 100%);
  --gradient-peach: linear-gradient(135deg, #FEEBC8 0%, #FBD38D 100%);
}

body {
  font-family: var(--font-family);
  background: var(--bg-color);
  color: var(--text-color);
  transition: all 0.3s ease;
  overflow-x: hidden;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: 0.3s;
}

a:hover {
  color: var(--secondary-color);
  text-decoration: none;
}

/* Glassmorphism Utilities */
.glass-effect {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
}

/* Header */
.header {
  height: var(--header-height);
  transition: all 0.5s;
  z-index: 997;
  padding-left: 20px;
  background-color: #fff;
  /* Fallback */
  box-shadow: 0px 2px 20px rgba(1, 41, 112, 0.1);
}

.header.glass-style {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
}

.header .logo {
  line-height: 1;
}

.header .logo img {
  max-height: 26px;
  margin-right: 6px;
}

.header .logo span {
  font-size: 24px;
  font-weight: 700;
  color: var(--heading-color);
  /* Pastel: Slate instead of Navy */
  font-family: var(--font-family);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  z-index: 996;
  transition: all 0.3s;
  padding: 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #aab7cf transparent;
  background-color: #fff;
  box-shadow: 0px 0px 20px rgba(1, 41, 112, 0.1);
}

@media (max-width: 991px) {
  .sidebar {
    left: -300px;
  }
}

.sidebar-nav {
  padding: 0;
  margin: 0;
  list-style: none;
}

.sidebar-nav .nav-item {
  margin-bottom: 2px;
}

.sidebar-nav .nav-heading {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted-color);
  /* Pastel: Soft gray */
  font-weight: 700;
  margin: 15px 0 5px 15px;
  letter-spacing: 1.2px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-color);
  /* Pastel: Slate gray */
  transition: all 0.3s ease;
  background: #fff;
  padding: 12px 15px;
  border-radius: 8px;
  /* Rounder corners */
  border-left: 3px solid transparent;
}

.sidebar-nav .nav-link i {
  font-size: 18px;
  margin-right: 12px;
  color: var(--muted-color);
  /* Pastel: Soft gray icons */
  transition: 0.3s;
}

.sidebar-nav .nav-link:not(.collapsed) {
  color: var(--primary-color);
  /* Pastel: Dusty blue active */
  background: var(--bg-color);
  border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link:not(.collapsed) i {
  color: var(--primary-color);
}

.sidebar-nav .nav-link:hover {
  color: var(--primary-color);
  /* Pastel: Dusty blue hover */
  background: var(--bg-color);
  border-left-color: var(--primary-color);
}

.sidebar-nav .nav-link:hover i {
  color: var(--primary-color);
}

.sidebar-nav .nav-content {
  padding: 5px 0 0 0;
  margin: 0;
  list-style: none;
}

.sidebar-nav .nav-content a {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-color);
  /* Pastel: Slate gray */
  transition: 0.3s;
  padding: 10px 0 10px 45px;
  transition: 0.3s;
}

.sidebar-nav .nav-content a i {
  font-size: 6px;
  margin-right: 8px;
}

.sidebar-nav .nav-content a:hover,
.sidebar-nav .nav-content a.active {
  color: var(--primary-color);
  /* Pastel: Dusty blue */
}


/* Page Title and Breadcrumbs */
.pagetitle {
  margin-bottom: 25px;
}

.pagetitle h1 {
  font-size: 24px;
  margin-bottom: 0;
  font-weight: 700;
  color: var(--heading-color);
  /* Pastel: Slate */
  font-family: var(--font-family);
}

.breadcrumb {
  margin-bottom: 0;
  font-size: 14px;
  color: var(--muted-color);
  /* Pastel: Soft gray */
  font-weight: 500;
}

.breadcrumb a {
  color: var(--muted-color);
}

.breadcrumb a:hover {
  color: var(--primary-color);
  /* Pastel: Dusty blue */
}

.breadcrumb .breadcrumb-item::before {
  color: var(--muted-color);
}

.breadcrumb .active {
  color: var(--primary-color);
  font-weight: 600;
}

/* Main Content */
#main {
  margin-top: var(--header-height);
  padding: 20px 30px;
  transition: all 0.3s;
}

@media (min-width: 992px) {

  #main,
  #footer {
    margin-left: var(--sidebar-width);
  }
}

/* Card - Minimal Pastel Style */
.card {
  border: none;
  border-radius: 12px;
  /* Rounder corners */
  box-shadow: 0px 2px 12px rgba(0, 0, 0, 0.04);
  /* Softer shadow */
  margin-bottom: 30px;
  overflow: hidden;
  background: var(--card-bg);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.06);
  /* Subtle lift */
}

.card-title {
  padding: 20px 0 15px 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--heading-color);
  /* Pastel: Slate */
  font-family: var(--font-family);
}

.card-title span {
  color: var(--muted-color);
  /* Pastel: Soft gray */
  font-size: 14px;
  font-weight: 400;
}

.card-body {
  padding: 0 20px 20px 20px;
}

/* DataTable Customization */
.datatable-wrapper .datatable-container {
  border: none;
}

.table {
  --bs-table-bg: transparent;
}

.table thead th {
  border-top: none;
  border-bottom: 2px solid #E8ECF0;
  /* Pastel: Soft border */
  color: var(--muted-color);
  /* Pastel: Soft header text */
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table tbody td {
  vertical-align: middle;
  padding: 1rem 0.5rem;
  border-bottom: 1px solid #f6f6f6;
  font-size: 0.95rem;
  color: #444;
}

/* Badge Customization */
.badge {
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8rem;
}

.bg-success {
  background-color: #d1e7dd !important;
  color: #0f5132;
}

.bg-warning {
  background-color: #fff3cd !important;
  color: #664d03;
}

.bg-danger {
  background-color: #f8d7da !important;
  color: #842029;
}

/* Buttons */
.btn {
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 500;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
}

/* Filter Dropdown */
.filter .icon {
  color: #aab7cf;
  padding-right: 20px;
  padding-bottom: 5px;
  transition: 0.3s;
  font-size: 16px;
}

.filter .icon:hover,
.filter .icon:focus {
  color: #4154f1;
}

.dropdown-menu {
  border: none;
  border-radius: 10px;
  padding: 10px 0;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 5px 30px 0 rgba(82, 63, 105, 0.2);
}

.dropdown-item {
  padding: 10px 15px;
  font-size: 14px;
}

.dropdown-item:hover {
  background-color: #f6f9ff;
  color: #4154f1;
}

/* Profile */
.nav-profile img {
  max-height: 36px;
  object-fit: cover;
}

.header-nav .profile {
  min-width: 240px;
  padding-bottom: 0;
  top: 8px !important;
}

.header-nav .profile .dropdown-header h6 {
  font-size: 18px;
  margin-bottom: 0;
  font-weight: 600;
  color: #444444;
}

.header-nav .profile .dropdown-header span {
  font-size: 14px;
}

.header-nav .profile .dropdown-item {
  font-size: 14px;
  padding: 10px 15px;
  transition: 0.3s;
}

.header-nav .profile .dropdown-item i {
  margin-right: 10px;
  font-size: 18px;
  line-height: 0;
}

.header-nav .profile .dropdown-item:hover {
  background-color: #f6f9ff;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

/* Toggle Sidebar */
.toggle-sidebar-btn {
  font-size: 32px;
  padding-left: 10px;
  cursor: pointer;
  color: #012970;
}

/* Sidebar Toggle Rules (Nuclear Fix) */
@media (min-width: 992px) {

  /* On Desktop: Hide sidebar when toggle-sidebar class is present */
  html body.toggle-sidebar .sidebar,
  html body.toggle-sidebar aside#sidebar {
    left: -310px !important;
    transform: translateX(-100%) !important;
  }

  html body.toggle-sidebar #main,
  html body.toggle-sidebar #footer {
    margin-left: 0 !important;
  }
}

@media (max-width: 991px) {

  /* On Mobile: Sidebar is hidden by default */
  html body .sidebar,
  html body aside#sidebar {
    left: -310px !important;
    transform: translateX(-100%) !important;
    z-index: 2000;
  }

  /* On Mobile: Show sidebar when toggle-sidebar class is present */
  html body.toggle-sidebar .sidebar,
  html body.toggle-sidebar aside#sidebar {
    left: 0 !important;
    transform: translateX(0) !important;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.4);
  }

  html body.toggle-sidebar {
    overflow: hidden !important;
  }
}

/* Ensure smooth transitions */
#sidebar,
.sidebar,
#main,
#footer {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.header {
  z-index: 1000;
}

/* ========== Fix list bullets & icon spacing ========== */
.header-nav ul,
.header-nav ul li,
nav.header-nav ul li.nav-item {
  list-style: none !important;
  list-style-type: none !important;
  margin: 0;
  padding: 0;
}

.header-nav ul li::marker,
nav.header-nav ul li::marker {
  content: none !important;
  display: none !important;
  font-size: 0 !important;
}

.header-nav ul.d-flex {
  gap: 6px;
}

@media (min-width: 769px) {
  .header-nav ul.d-flex {
    gap: 10px;
  }
}

/* ========== Mobile Header Nav Fix ========== */
@media (max-width: 576px) {
  .header {
    padding-left: 10px;
    padding-right: 6px;
  }

  .header .logo img {
    max-height: 22px;
    margin-right: 4px;
  }

  .toggle-sidebar-btn {
    font-size: 24px;
    padding-left: 6px;
  }

  .header-nav {
    flex-shrink: 0;
  }

  .header-nav .nav-link.nav-icon {
    padding: 6px 8px;
    font-size: 1rem;
  }

  .header-nav .nav-profile img {
    width: 30px !important;
    height: 30px !important;
  }

  /* Notifications dropdown — fixed to viewport on mobile */
  .header-nav .notifications {
    position: fixed !important;
    top: var(--header-height, 60px) !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1060;
    transform: none !important;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  .header-nav .nav-link.nav-icon {
    padding: 6px 10px;
  }
}

/* ========== Online Indicator Styles ========== */
.online-dot-mini {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: onlinePulse 2s ease-in-out infinite;
}

.online-dot {
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

.online-user-item:hover {
  background-color: #f0fdf4 !important;
  border-radius: 6px;
}

/* Online dropdown on mobile */
@media (max-width: 576px) {
  #onlineUsersDropdown {
    position: fixed !important;
    top: var(--header-height, 60px) !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    max-height: 60vh;
    overflow-y: auto;
    z-index: 1060;
    transform: none !important;
  }
}

/* Chat online indicator */
.chat-online-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  background: #22c55e;
  border-radius: 50%;
  border: 2px solid #fff;
}

.chat-avatar {
  position: relative;
}