/* =============================================
   ระบบจองรถออนไลน์ โรงพยาบาลสวนปรุง
   Design System — Sea Blue / Teal Theme
   ============================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@200;300;400;500;600;700&display=swap');

/* =============================================
   CSS Variables (Design Tokens)
   ============================================= */
:root {
  /* Primary Colors - Sea Blue / Teal */
  --primary: #0891B2;
  --primary-dark: #0E7490;
  --primary-darker: #155E75;
  --primary-light: #22D3EE;
  --primary-50: #ECFEFF;
  --primary-100: #CFFAFE;
  --primary-200: #A5F3FC;
  --primary-300: #67E8F9;
  --primary-400: #22D3EE;
  --primary-500: #06B6D4;
  --primary-600: #0891B2;
  --primary-700: #0E7490;
  --primary-800: #155E75;
  --primary-900: #164E63;

  /* Accent - Teal */
  --accent: #14B8A6;
  --accent-dark: #0D9488;
  --accent-light: #5EEAD4;

  /* Neutrals */
  --white: #FFFFFF;
  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  /* Semantic Colors */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --info: #3B82F6;
  --info-light: #DBEAFE;

  /* Backgrounds */
  --bg-body: #F0F9FF;
  --bg-card: #FFFFFF;
  --bg-sidebar: linear-gradient(180deg, #0C4A6E 0%, #0E7490 50%, #0891B2 100%);
  --bg-header: #FFFFFF;
  --bg-hero: linear-gradient(135deg, #0E7490 0%, #0891B2 40%, #06B6D4 100%);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(8, 145, 178, 0.08);

  /* Border Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;

  /* Sidebar */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;

  /* Header */
  --header-height: 65px;

  /* Font */
  --font-family: 'Kanit', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =============================================
   Base Styles
   ============================================= */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gray-800);
  background-color: var(--bg-body);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

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

a:hover {
  color: var(--primary-dark);
}

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

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* =============================================
   Layout
   ============================================= */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--white);
  z-index: 1040;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-brand-logo {
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  backdrop-filter: blur(10px);
}

.sidebar-brand-text {
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0.95;
}

.sidebar-brand-text strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.sidebar-menu {
  padding: 10px 0;
  flex: 1;
}

/* Sidebar Menu Group Collapsible */
.sidebar-group {
  margin-bottom: 6px;
}

.sidebar-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.4px;
  cursor: pointer;
  border-radius: 8px;
  margin: 3px 10px;
  transition: all 0.2s ease;
  user-select: none;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.sidebar-group-header:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.15);
}

.sidebar-group-header.active-group {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.22);
}

.sidebar-group-header .group-title {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-group-header .group-icon {
  font-size: 0.95rem;
  color: #38bdf8;
  flex-shrink: 0;
}

.sidebar-group-header .group-arrow {
  font-size: 0.75rem;
  transition: transform 0.25s ease;
  color: rgba(255, 255, 255, 0.45);
  margin-left: 6px;
  flex-shrink: 0;
}

.sidebar-group-header.collapsed .group-arrow {
  transform: rotate(-90deg);
}

.sidebar-group-items {
  padding: 3px 0 5px;
}

.sidebar-menu-label {
  padding: 16px 20px 6px;
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-menu-item {
  position: relative;
}

.sidebar-menu-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 18px 8px 32px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 300;
  transition: var(--transition-fast);
  border-left: 3px solid transparent;
  text-decoration: none;
}

.sidebar-menu-link:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
  border-left-color: rgba(255, 255, 255, 0.4);
}

.sidebar-menu-link.active {
  color: var(--white);
  background: rgba(56, 189, 248, 0.15);
  border-left-color: #38bdf8;
  font-weight: 400;
}

.sidebar-menu-link .menu-icon {
  width: 18px;
  font-size: 1rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.sidebar-menu-link .menu-badge {
  margin-left: auto;
  background: rgba(239, 68, 68, 0.95);
  color: white;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-menu-link .menu-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.sidebar-footer-contact {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  font-size: 0.75rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
}

.sidebar-footer-contact strong {
  display: block;
  color: var(--white);
  font-weight: 500;
  margin-bottom: 3px;
}

/* =============================================
   Header / Navbar
   ============================================= */
.top-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  z-index: 1030;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  transition: var(--transition);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  font-size: 1.3rem;
  color: var(--gray-700);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  transition: all 0.2s ease;
}

.sidebar-toggle:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-light);
}

/* Desktop Collapsed Sidebar State (icon-only rail) */
@media (min-width: 992px) {
  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .top-header {
    left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .content-wrapper {
    max-width: none;
  }

  body.sidebar-collapsed .sidebar-brand {
    padding: 16px 0;
    justify-content: center;
  }

  body.sidebar-collapsed .sidebar-brand-text,
  body.sidebar-collapsed .sidebar-group-header .group-title span,
  body.sidebar-collapsed .sidebar-group-header .group-title ~ div,
  body.sidebar-collapsed .sidebar-menu-link .menu-text,
  body.sidebar-collapsed .sidebar-menu-label,
  body.sidebar-collapsed .sidebar-footer {
    display: none;
  }

  body.sidebar-collapsed .sidebar-group-header {
    justify-content: center;
    padding: 10px 0;
    margin: 3px 8px;
  }

  body.sidebar-collapsed .sidebar-group-header .group-title {
    flex: 0 0 auto;
    gap: 0;
  }

  body.sidebar-collapsed .sidebar-group-header .group-icon {
    font-size: 1.1rem;
  }

  body.sidebar-collapsed .sidebar-menu-link {
    position: relative;
    justify-content: center;
    padding: 10px 0;
    gap: 0;
  }

  body.sidebar-collapsed .sidebar-menu-link .menu-icon {
    width: auto;
    font-size: 1.1rem;
  }

  body.sidebar-collapsed .sidebar-menu-link .menu-badge {
    position: absolute;
    top: 4px;
    right: 10px;
    margin-left: 0;
    padding: 1px 5px;
    font-size: 0.6rem;
  }
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--gray-500);
}

.header-breadcrumb i {
  font-size: 1rem;
  color: var(--primary);
}

.header-breadcrumb span {
  font-weight: 400;
  color: var(--gray-700);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-search {
  position: relative;
}

.header-search input {
  width: 240px;
  padding: 8px 16px 8px 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-family: var(--font-family);
  font-size: 0.8rem;
  background: var(--gray-50);
  transition: var(--transition);
}

.header-search input:focus {
  outline: none;
  border-color: var(--primary-300);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.1);
  width: 280px;
}

.header-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.85rem;
}

.header-icon-btn {
  position: relative;
  background: none;
  border: none;
  padding: 8px;
  border-radius: var(--radius);
  color: var(--gray-500);
  font-size: 1.15rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.header-icon-btn:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.header-icon-btn .notification-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--danger);
  color: white;
  font-size: 0.6rem;
  font-weight: 600;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition-fast);
}

.header-user:hover {
  background: var(--gray-50);
}

.header-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
}

.header-user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.header-user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--gray-800);
}

.header-user-role {
  font-size: 0.7rem;
  color: var(--gray-400);
}

/* =============================================
   Main Content
   ============================================= */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  transition: var(--transition);
}

.content-wrapper {
  padding: 24px;
  max-width: none;
  width: 100%;
}

/* =============================================
   Hero Section (Welcome Banner)
   ============================================= */
.hero-banner {
  background: var(--bg-hero);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  color: white;
  position: relative;
  overflow: hidden;
  margin-bottom: 24px;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -30%;
  right: 5%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-greeting {
  font-size: 1.55rem;
  font-weight: 500;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-username {
  font-size: 1.25rem;
  font-weight: 400;
  opacity: 0.95;
  margin-bottom: 6px;
}

.hero-subtitle {
  font-size: 0.95rem;
  font-weight: 200;
  opacity: 0.75;
}

.hero-date {
  position: absolute;
  top: 28px;
  right: 32px;
  text-align: right;
  font-size: 0.95rem;
  opacity: 0.85;
  z-index: 1;
}

.hero-date .date-large {
  font-size: 1rem;
  font-weight: 400;
}

.hero-date .time-large {
  font-size: 1.25rem;
  font-weight: 500;
}

.hero-image {
  position: absolute;
  right: 80px;
  bottom: 0;
  height: 140px;
  opacity: 0.15;
  z-index: 0;
}

/* =============================================
   Cards
   ============================================= */
.card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  overflow: hidden;
  background: var(--bg-card);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 16px 20px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header .card-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 500;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-header .card-title i {
  color: var(--primary);
}

.card-body {
  padding: 20px;
}

.card-footer {
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  padding: 12px 20px;
}

/* Stat Cards */
.stat-card {
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--white);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

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

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  transform: scaleX(0);
  transition: var(--transition);
}

.stat-card:hover::after {
  transform: scaleX(1);
}

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

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.stat-card-icon.bg-primary-soft {
  background: var(--primary-100);
  color: var(--primary-700);
}

.stat-card-icon.bg-success-soft {
  background: var(--success-light);
  color: var(--success);
}

.stat-card-icon.bg-warning-soft {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-card-icon.bg-danger-soft {
  background: var(--danger-light);
  color: var(--danger);
}

.stat-card-icon.bg-info-soft {
  background: var(--info-light);
  color: var(--info);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card-label {
  font-size: 0.92rem;
  color: var(--gray-500);
  font-weight: 400;
}

.stat-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.86rem;
  color: var(--primary);
  margin-top: 8px;
}

.stat-card-link:hover {
  color: var(--primary-dark);
}

/* =============================================
   Tables
   ============================================= */
.table-responsive {
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table {
  margin-bottom: 0;
  font-size: 1rem;
}

.table thead th {
  background: var(--gray-50);
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--gray-200);
  padding: 12px 16px;
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.table tbody tr {
  transition: var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--primary-50);
}

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

/* =============================================
   Badges
   ============================================= */
.badge {
  font-family: var(--font-family);
  font-weight: 400;
  font-size: 0.86rem;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
  font-family: var(--font-family);
  font-weight: 400;
  font-size: 0.85rem;
  border-radius: var(--radius);
  padding: 8px 18px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 8px rgba(8, 145, 178, 0.3);
  transform: translateY(-1px);
}

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

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(8, 145, 178, 0.2);
}

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

.btn-sm {
  font-size: 0.92rem;
  padding: 5px 12px;
}

.btn-lg {
  font-size: 0.95rem;
  padding: 12px 28px;
}

/* =============================================
   Forms
   ============================================= */
.form-control, .form-select {
  font-family: var(--font-family);
  font-size: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-300);
  padding: 10px 14px;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.form-label {
  font-weight: 400;
  font-size: 0.97rem;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-text {
  font-size: 0.88rem;
  color: var(--gray-400);
}

.input-group-text {
  background: var(--gray-50);
  border-color: var(--gray-300);
  color: var(--gray-500);
  font-size: 1rem;
}

/* =============================================
   Alerts
   ============================================= */
.alert {
  border: none;
  border-radius: var(--radius-lg);
  font-size: 0.97rem;
  padding: 14px 18px;
  border-left: 4px solid;
}

.alert-success {
  background: var(--success-light);
  border-left-color: var(--success);
  color: #065F46;
}

.alert-warning {
  background: var(--warning-light);
  border-left-color: var(--warning);
  color: #92400E;
}

.alert-danger {
  background: var(--danger-light);
  border-left-color: var(--danger);
  color: #991B1B;
}

.alert-info {
  background: var(--info-light);
  border-left-color: var(--info);
  color: #1E40AF;
}

/* =============================================
   Calendar Widget
   ============================================= */
.calendar-widget {
  background: var(--white);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--gray-50);
}

.calendar-header .month-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  padding: 8px;
}

.calendar-day-header {
  padding: 6px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-400);
}

.calendar-day {
  padding: 6px;
  text-align: center;
  font-size: 0.78rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--gray-600);
}

.calendar-day:hover {
  background: var(--primary-50);
  color: var(--primary);
}

.calendar-day.today {
  background: var(--primary);
  color: white;
  font-weight: 500;
  border-radius: 50%;
}

.calendar-day.has-event {
  position: relative;
}

.calendar-day.has-event::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}

.calendar-day.other-month {
  color: var(--gray-300);
}

/* =============================================
   Process Steps
   ============================================= */
.process-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  gap: 8px;
  overflow-x: auto;
}

.process-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 100px;
  text-align: center;
}

.process-step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
}

.process-step-icon {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.process-step-title {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--gray-600);
  line-height: 1.3;
}

.process-arrow {
  font-size: 1.2rem;
  color: var(--gray-300);
  flex-shrink: 0;
}

/* =============================================
   Timeline
   ============================================= */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--gray-200);
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -26px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: var(--white);
  z-index: 1;
}

.timeline-dot.active {
  background: var(--primary);
}

.timeline-dot.success {
  border-color: var(--success);
  background: var(--success);
}

.timeline-dot.danger {
  border-color: var(--danger);
  background: var(--danger);
}

.timeline-dot.pending {
  border-color: var(--gray-300);
  background: var(--white);
}

.timeline-content {
  padding: 4px 0;
}

.timeline-date {
  font-size: 0.72rem;
  color: var(--gray-400);
  font-weight: 400;
}

.timeline-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-800);
}

.timeline-text {
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 2px;
}

/* =============================================
   Announcement / News Items
   ============================================= */
.news-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}

.news-item:last-child {
  border-bottom: none;
}

.news-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.news-content {
  flex: 1;
  min-width: 0;
}

.news-title {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--gray-700);
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-date {
  font-size: 0.85rem;
  color: var(--gray-400);
}

/* =============================================
   Dropdown Notifications
   ============================================= */
.notification-dropdown {
  width: 350px;
  max-height: 400px;
  overflow-y: auto;
  border: none;
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
}

.notification-dropdown .dropdown-header {
  font-weight: 500;
  font-size: 0.85rem;
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
}

.notification-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-50);
  transition: var(--transition-fast);
}

.notification-item:hover {
  background: var(--primary-50);
}

.notification-item.unread {
  background: var(--primary-50);
}

/* =============================================
   Modal
   ============================================= */
.modal-content {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  border-bottom: 1px solid var(--gray-100);
  padding: 18px 24px;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  border-top: 1px solid var(--gray-100);
  padding: 16px 24px;
}

/* modal-dialog-scrollable ที่มี <form> ครอบ header/body/footer:
   ให้ form เป็น flex column เพื่อให้ modal-body เลื่อนได้ (header/footer อยู่กับที่) */
.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
.modal-dialog-scrollable .modal-content > form > .modal-body {
  overflow-y: auto;
}

/* =============================================
   Empty State
   ============================================= */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 3rem;
  color: var(--gray-300);
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 0.95rem;
  color: var(--gray-400);
  margin-bottom: 16px;
}

/* =============================================
   Loading Spinner
   ============================================= */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

/* =============================================
   Login Page
   ============================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  background: var(--bg-body);
}

.login-left {
  flex: 1;
  background: var(--bg-hero);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 70%);
  border-radius: 50%;
}

.login-left::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 70%);
  border-radius: 50%;
}

.login-left-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
}

.login-logo-icon {
  width: 90px;
  height: 90px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 24px;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-hospital-name {
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-system-name {
  font-size: 1.1rem;
  font-weight: 300;
  opacity: 0.85;
  margin-bottom: 32px;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  max-width: 320px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 300;
  opacity: 0.8;
}

.login-feature i {
  font-size: 1.1rem;
  opacity: 0.9;
}

.login-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-form-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-form-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
}

.login-form-subtitle {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-bottom: 32px;
}

.login-form .form-control {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
}

.login-form .form-label {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--gray-600);
}

.login-form .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-md);
}

/* =============================================
   Pagination
   ============================================= */
.pagination {
  gap: 4px;
}

.page-link {
  font-family: var(--font-family);
  font-size: 0.8rem;
  border-radius: var(--radius) !important;
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
  padding: 6px 12px;
}

.page-item.active .page-link {
  background: var(--primary);
  border-color: var(--primary);
}

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
  }
  
  .sidebar-overlay.show {
    display: block;
  }
  
  .top-header {
    left: 0;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .header-search {
    display: none;
  }
  
  .header-user-info {
    display: none;
  }
  
  .hero-date {
    display: none;
  }
  
  .hero-banner {
    padding: 20px;
  }
  
  .content-wrapper {
    padding: 16px;
  }
}

@media (max-width: 767.98px) {
  .stat-cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  
  .process-steps {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .stat-cards-grid {
    grid-template-columns: 1fr !important;
  }
  
  .hero-greeting {
    font-size: 1.1rem;
  }
  
  .hero-username {
    font-size: 0.9rem;
  }
}

/* =============================================
   Utility Classes
   ============================================= */
.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--gray-500) !important; }
.bg-primary-soft { background: var(--primary-100) !important; }
.bg-success-soft { background: var(--success-light) !important; }
.bg-warning-soft { background: var(--warning-light) !important; }
.bg-danger-soft { background: var(--danger-light) !important; }
.bg-info-soft { background: var(--info-light) !important; }

.fs-xs { font-size: 0.875rem; }
.fs-sm { font-size: 0.975rem; }
.fw-300 { font-weight: 300; }
.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

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

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out;
}

.animate-slide-in {
  animation: slideInLeft 0.3s ease-out;
}

/* View all link */
.view-all-link {
  font-size: 0.88rem;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 400;
}

.view-all-link:hover {
  color: var(--primary-dark);
}

/* Section Title */
.section-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray-800);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  color: var(--primary);
}
