@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+Khmer:wght@100..900&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Noto Serif Khmer", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    sans-serif;
  background-color: #f8fafc;
  color: #334155;
  line-height: 1.5;
  font-weight: 400;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 600;
}

.header-brand {
  font-family: "Noto Serif Khmer", serif;
  font-size: 18px;
  font-weight: 700;
  color: #3b82f6;
  text-decoration: none;
}

.sidebar-logo-text {
  font-family: "Noto Serif Khmer", serif;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.nav-section-title {
  font-family: "Noto Serif Khmer", serif;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 20px 8px;
  margin-bottom: 4px;
}

.sidebar-nav-text {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 500;
}

.stat-label {
  font-family: "Noto Serif Khmer", serif;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-family: "Noto Serif Khmer", serif;
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
}

.card-title {
  font-family: "Noto Serif Khmer", serif;
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

/* Header Styles */
.header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  height: 64px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 24px;
  max-width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  color: #64748b;
  cursor: pointer;
  padding: 8px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 32px;
}

.header-nav-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #64748b;
  transition: all 0.2s;
  cursor: pointer;
}

.header-nav-icon:hover {
  background: #f1f5f9;
  color: #334155;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-search {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.header-search:hover {
  background: #f1f5f9;
}

.header-notifications {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.header-notifications:hover {
  background: #f1f5f9;
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Serif Khmer", serif;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.header-user:hover {
  background: #f1f5f9;
}

.user-info {
  text-align: right;
}

.user-name {
  font-family: "Noto Serif Khmer", serif;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.user-role {
  font-family: "Noto Serif Khmer", serif;
  font-size: 12px;
  color: #64748b;
  line-height: 1.2;
  font-weight: 400;
  padding-top: 3px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  font-family: "Noto Serif Khmer", serif;
}

/* Main Container */
.main-container {
  min-height: 100vh;
  padding-top: 64px;
}

/* Sidebar Styles */
.sidebar {
  width: 280px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  height: calc(100vh - 64px);
  position: fixed;
  left: 0;
  top: 64px;
  overflow-y: auto;
  z-index: 100;
  padding-bottom: 60px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: #3b82f6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
}

/* Navigation Styles */
.sidebar-nav {
  padding: 16px 0;
}

.nav-section {
  margin-bottom: 24px;
}

.sidebar-nav-item {
  margin: 0 12px 2px;
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  color: #64748b;
  text-decoration: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
}

.sidebar-nav-link:hover {
  background: #f8fafc;
  color: #334155;
}

.sidebar-nav-link.active {
  background: #eff6ff;
  color: #3b82f6;
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sidebar-nav-text {
  flex: 1;
}

.sidebar-nav-arrow {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform 0.2s;
}

.sidebar-nav-item.active>.sidebar-nav-link .sidebar-nav-arrow i {
  transform: rotate(90deg);
}

.nav-badge {
  background: #10b981;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Noto Serif Khmer", serif;
}

/* Submenu Styles */
.sidebar-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
  background: #f8fafc;
  margin: 4px 12px 0;
  border-radius: 8px;
}

.sidebar-submenu.show {
  max-height: 500px;
}

.sidebar-submenu-link {
  display: block;
  padding: 8px 16px;
  color: #64748b;
  text-decoration: none;
  font-size: 13px;
  border-radius: 6px;
  margin: 2px 4px;
  transition: all 0.2s;
  font-family: "Noto Serif Khmer", serif;
  font-weight: 400;
}

.sidebar-submenu-link:hover {
  background: #e2e8f0;
  color: #334155;
}

.sidebar-submenu-link.active {
  background: #3b82f6;
  color: white;
  font-weight: 600;
}

/* Sidebar Footer */
.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  border-top: 1px solid #f1f5f9;
  background: white;
}

.sidebar-version {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  font-family: "Noto Serif Khmer", serif;
  font-weight: 500;
}

.sidebar-version i:first-child {
  color: #94a3b8;
}

.sidebar-version i:last-child {
  margin-left: auto;
  color: #94a3b8;
  cursor: pointer;
}

.sidebar-version i:last-child:hover {
  color: #64748b;
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: 280px;
  margin-top: 64px; /* Add this line */
  padding: 24px;
  background: #f8fafc;
  min-height: calc(100vh - 64px);
}

/* Statistics Cards - Enhanced Design */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #06b6d4);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
  color: white;
  position: relative;
  box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.15);
}

.stat-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
  pointer-events: none;
}

.stat-icon.green {
  background: linear-gradient(135deg, #10b981, #059669);
}

.stat-icon.blue {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-icon.orange {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-icon.red {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-icon.cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.stat-icon.purple {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-note {
  font-size: 11px;
  color: #64748b;
  margin-top: 8px;
  font-weight: 500;
}

.stat-value.positive {
  color: #059669;
}

.stat-value.negative {
  color: #dc2626;
}

.stat-value.comparison {
  font-size: 20px;
  font-weight: 700;
}

/* Enhanced Summary Cards */
.stat-header {
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.stat-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

.stat-item:last-child {
  border-bottom: none;
}

.stat-item.cash-back {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #f59e0b;
  margin-top: 8px;
}

.stat-item .stat-label {
  font-size: 12px;
  color: #64748b;
  margin: 0;
  text-transform: none;
  letter-spacing: normal;
}

.stat-item .stat-value {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.stat-item .stat-value.amount {
  color: #059669;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 300px 300px;
  gap: 24px;
  margin-bottom: 24px;
}

/* Enhanced Card Styles */
.dashboard-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
  transition: all 0.3s ease;
}

.card-header {
  padding: 24px 28px 20px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.card-content {
  padding: 15px;
}

.card-description {
  font-family: "Noto Serif Khmer", serif;
  color: #64748b;
  font-size: 14px;
  margin: 0;
  margin-top: 6px;
  line-height: 1.5;
}

/* Enhanced Page Header */
.page-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 30px 30px, 20px 20px;
  pointer-events: none;
}

.page-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.page-title-section {
  display: flex;
  align-items: center;
  gap: 20px;
}

.page-icon {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.page-title {
  font-family: "Noto Serif Khmer", serif;
  font-size: 32px;
  font-weight: 800;
  margin: 0;
  margin-bottom: 6px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.page-subtitle {
  font-family: "Noto Serif Khmer", serif;
  font-size: 16px;
  opacity: 0.9;
  margin: 0;
  font-weight: 400;
}

.search-container {
  position: relative;
  max-width: 430px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 16px;
  z-index: 10;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-family: "Noto Serif Khmer", serif;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.search-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

/* Enhanced Table Styles */
.table-container {
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Noto Serif Khmer", serif;
  background: white;
}

.data-table th {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  padding: 11px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
  white-space: nowrap;
  position: relative;
}

.data-table th:first-child {
  border-top-left-radius: 12px;
}

.data-table th:last-child {
  border-top-right-radius: 12px;
}

.data-table td {
  padding: 11px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #334155;
  transition: all 0.2s ease;
}

.table-row {
  transition: all 0.2s ease;
}

.table-row:hover {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transform: scale(1.001);
}

.table-row:hover td {
  color: #1e293b;
}

.amount-cell {
  font-weight: 700;
  color: #059669;
  font-family: "Noto Serif Khmer", serif;
}

.table-footer {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  font-weight: 700;
  color: #374151;
}

.table-footer th {
  padding: 20px 16px;
  border-top: 2px solid #e2e8f0;
  font-size: 14px;
}

/* Enhanced No Data State */
.no-data {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.no-data-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: #64748b;
}

.no-data-icon {
  font-size: 64px;
  opacity: 0.3;
  color: #cbd5e1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.no-data h4 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.no-data p {
  font-size: 14px;
  max-width: 400px;
  line-height: 1.6;
}

/* Enhanced Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 15px;
}

.form-label {
  display: block;
  font-family: "Noto Serif Khmer", serif;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-family: "Noto Serif Khmer", serif;
  transition: all 0.3s ease;
  background: white;
  color: #1f2937;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-select {
  cursor: pointer;
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
}

.btn {
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: "Noto Serif Khmer", serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn-light {
    background-color: #ffffff; /* White background */
    color: #4f46e5;            /* A vibrant indigo/purple for the text and icon */
    border: 1px solid #e2e8f0; /* A very light gray border for definition */
}

/* Hover state: Makes the button slightly darker when the mouse is over it */
.btn-light:hover {
    background-color: #f8fafc; /* A very light off-white */
    border-color: #d1d5db;     /* A slightly more visible gray border */
}

/* Focus state: Adds a "ring" for accessibility when using the keyboard */
.btn-light:focus,
.btn-light:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.4); /* A soft blue/purple glow */
}

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4), 0 4px 6px -2px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
}

.btn-secondary:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(107, 114, 128, 0.4), 0 4px 6px -2px rgba(107, 114, 128, 0.2);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.4), 0 4px 6px -2px rgba(16, 185, 129, 0.2);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 13px;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 8px;
}

.action-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
  background: #e2e8f0;
  color: #334155;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.action-btn-danger {
  background: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fecaca !important;
}
    
    label {
        margin-bottom: 10px;
    }

.action-btn-danger:hover {
  background: #fee2e2 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(220, 38, 38, 0.2) !important;
}

/* Alert Styles */
.alert {
  border-radius: 12px;
  font-family: "Noto Serif Khmer", serif;
  display: flex;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  border: 1px solid #fecaca;
  color: #dc2626;
}

.alert-success {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border: 1px solid #bbf7d0;
  color: #166534;
}

.alert i {
  margin-right: 12px;
  font-size: 16px;
}

/* Print Styles */
.print-header {
  text-align: center;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid #e2e8f0;
}

.print-header h2 {
  color: #181a1d;
  margin-bottom: 8px;
  font-size: 24px;
}

.print-header h1 {
  color: #000000;
  margin-bottom: 16px;
  font-size: 32px;
}

.print-header p {
  color: #64748b;
  font-size: 14px;
  margin: 4px 0;
}

/* Enhanced Modal Styles - FIXED */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex !important;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 700px;
  margin: auto;
  pointer-events: none;
  transform: translateY(-50px);
  transition: transform 0.3s ease-out;
}

.modal.show .modal-dialog {
  transform: translateY(0);
  pointer-events: auto;
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  outline: 0;
  pointer-events: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #dee2e6;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
  background-color: #f8f9fa;
}

.modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #212529;
  line-height: 1.5;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  color: #000;
  opacity: 0.5;
  cursor: pointer;
  padding: 0.25rem;
  transition: opacity 0.15s ease-in-out;
}

.btn-close:hover {
  opacity: 0.75;
  transform: scale(1.1);
}

.modal-body {
  position: relative;
  flex: 1 1 auto;
  padding: 1.5rem;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid #dee2e6;
  border-bottom-right-radius: 0.5rem;
  border-bottom-left-radius: 0.5rem;
  gap: 0.5rem;
  background-color: #f8f9fa;
}

.modal-open {
  overflow: hidden;
}

/* Form Grid Layout */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -0.75rem;
  margin-left: -0.75rem;
}

.col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
  padding-right: 0.75rem;
  padding-left: 0.75rem;
}

/* Form Controls */
.form-control {
  width: 100% !important;
  padding: 9px 11px !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-family: "Noto Serif Khmer", serif !important;
  transition: all 0.3s ease !important;
  background: white !important;
  color: #1f2937 !important;
}

.form-control:focus {
  color: #212529 !important;
  background-color: #fff !important;
  border-color: #86b7fe !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

.form-control:disabled,
.form-control[readonly] {
  background-color: #e9ecef !important;
  opacity: 1 !important;
}

.form-text {
  margin-top: 0.25rem;
  font-size: 0.875em;
  color: #6c757d;
}

.text-muted {
  color: #6c757d !important;
}

.text-success {
  color: #198754 !important;
}

.font-weight-bold {
  font-weight: 700 !important;
}

/* Budget Items Section */
.budget-items-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 1rem;
}

.budget-item-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 1rem;
  align-items: end;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background-color: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.budget-item-row .form-group {
  margin-bottom: 0;
}

.budget-total-card {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
}

/* Modal Animation */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalFadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }

  to {
    opacity: 0;
    transform: scale(0.9);
  }
}

.modal.show .modal-content {
  animation: modalFadeIn 0.3s ease-out;
}

/* Additional utility classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mb-0 {
  margin-bottom: 0;
}

.mt-4 {
  margin-top: 1rem;
}

.hidden {
  display: none;
}

/* Typography Classes */
.font-khmer {
  font-family: "Noto Serif Khmer", serif;
}

.font-khmer-light {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 300;
}

.font-khmer-regular {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 400;
}

.font-khmer-medium {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 500;
}

.font-khmer-semibold {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 600;
}

.font-khmer-bold {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 700;
}

.font-khmer-extrabold {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 800;
}

.font-khmer-black {
  font-family: "Noto Serif Khmer", serif;
  font-weight: 900;
}

/* Enhanced Form Styles */
.form-group.focused .form-label {
  color: #3b82f6;
}

.field-error {
  color: #ef4444;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  animation: slideInUp 0.3s ease-out;
}

input.error,
select.error,
textarea.error {
  border-color: #ef4444 !important;
}

input.error:focus,
select.error:focus,
textarea.error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Enhanced Table Styles */
.table-responsive {
  overflow-x: auto;
}

tbody tr.selected {
  background-color: #eff6ff !important;
  color: #1e293b;
}

/* Select2 Styling */
.select2-container {
  z-index: 10000 !important;
  display: block !important;
  width: 100% !important;
}

.select2-dropdown {
  z-index: 10001 !important;
}

.select2-container--default .select2-selection--single {
  height: 48px !important;
  border: 2px solid #e2e8f0 !important;
  border-radius: 8px !important;
  background: white !important;
  transition: all 0.2s ease !important;
}

.select2-container--default .select2-selection--single:hover {
  border-color: #cbd5e1 !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
  outline: none !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 44px !important;
  padding-left: 16px !important;
  padding-right: 40px !important;
  color: #1f2937 !important;
  font-family: "Noto Serif Khmer", serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9ca3af !important;
  font-style: normal !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 44px !important;
  right: 16px !important;
  top: 2px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: #6b7280 transparent transparent transparent !important;
  border-width: 6px 5px 0 5px !important;
  margin-top: -3px !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent #6b7280 transparent !important;
  border-width: 0 5px 6px 5px !important;
}

.select2-dropdown {
  border: 2px solid #e2e8f0 !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  font-family: "Noto Serif Khmer", serif !important;
  margin-top: 4px !important;
}

.select2-container--default .select2-results__option {
  padding: 12px 16px !important;
  font-size: 14px !important;
  color: #374151 !important;
  font-family: "Noto Serif Khmer", serif !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #eff6ff !important;
  color: #1e40af !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #3b82f6 !important;
  color: white !important;
}

.select2-container--default .select2-selection__clear {
  color: #6b7280 !important;
  cursor: pointer !important;
  float: right !important;
  font-weight: bold !important;
  margin-right: 30px !important;
  margin-top: 12px !important;
}

.select2-container--default .select2-selection__clear:hover {
  color: #374151 !important;
}

.select2-container--open {
  z-index: 9999 !important;
}

.form-select.select2-hidden-accessible {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.filter-input-group .select2-container:not(:first-of-type) {
  display: none !important;
}

.form-select.select2-enabled {
  width: 100% !important;
}

.select2-container--default.select2-container--loading .select2-selection--single:after {
  content: "Loading...";
  position: absolute;
  top: 50%;
  right: 40px;
  transform: translateY(-50%);
  font-size: 12px;
  color: #6b7280;
  font-family: "Noto Serif Khmer", serif;
}

.select2-container--default .select2-selection--single:focus-within {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

.select2-container--default.select2-container--disabled .select2-selection--single {
  background-color: #f9fafb !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
}

.select2-container--default.select2-container--disabled .select2-selection__clear {
  display: none !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }
  .modal-footer {
    display: flex;
  }

  .header-nav {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 12px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .user-info {
    display: none;
  }

  .page-header-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .page-title-section {
    flex-direction: column;
    gap: 12px;
  }

  .page-title {
    font-size: 24px;
  }

  /* Improved table responsiveness with horizontal scroll */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .data-table {
    min-width: 800px;
    /* Ensure table maintains minimum width */
  }

  .data-table th,
  .data-table td {
    padding: 8px 6px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Hide less important columns on mobile */
  .data-table th:nth-child(6)
  /* Department */
  ,
  .data-table td:nth-child(6),
  .data-table th:nth-child(8)
  /* Last Updated */
  ,
  .data-table td:nth-child(8),
  .data-table th:nth-child(9)

  /* Created By */
  ,
  .data-table td:nth-child(9) {
    display: none;
  }

  .search-container {
    max-width: 100%;
    margin-bottom: 16px;
  }

  .search-input {
    font-size: 16px;
    /* Prevent zoom on iOS */
  }

  /* Better modal responsiveness */
  .modal {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-content {
    max-width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    margin: 0;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 16px;
  }

  .modal-title {
    font-size: 18px;
  }

  /* Improved form layout for mobile */
  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .form-label {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .form-control,
  .custom-select-wrapper .select-btn {
    font-size: 16px;
    /* Prevent zoom on iOS */
    padding: 12px;
    height: auto;
    min-height: 44px;
    /* Touch-friendly size */
  }

  /* Better button layout in modals */
  .modal-footer {
    display: flex;
    gap: 12px;
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  .form-actions {
    flex-direction: column;
    gap: 12px;
  }

  .form-actions .btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  /* Improved action buttons */
  .action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
  }

  .action-buttons .btn {
    min-width: 36px;
    min-height: 36px;
    padding: 8px;
  }

  .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .modal-dialog {
    margin: 8px;
    max-width: calc(100% - 16px);
    width: 100%;
  }

  /* Better select2 mobile styling */
  .select2-container--default .select2-selection--single {
    height: 44px !important;
    border-radius: 8px !important;
  }

  .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px !important;
    font-size: 16px !important;
    padding-left: 12px !important;
  }

  .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    right: 8px !important;
  }

  /* Custom select wrapper mobile improvements */
  .custom-select-wrapper .select-btn {
    min-height: 44px;
    font-size: 16px;
    padding: 12px 15px;
  }

  .custom-select-wrapper .content {
    max-height: 60vh;
    overflow-y: auto;
  }

  .custom-select-wrapper .options {
    max-height: 200px;
  }

  .custom-select-wrapper .options li {
    min-height: 44px;
    padding: 12px 13px;
    font-size: 16px;
  }

  .budget-item-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  /* File upload area improvements */
  .file-upload-area {
    padding: 16px;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .file-preview-container {
    max-height: 150px;
  }

  .file-preview-item,
  .existing-file-item {
    padding: 12px 8px;
  }

  .file-preview-name {
    font-size: 14px;
  }

  /* Pagination improvements */
  .pagination-container {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .pagination-nav ul {
    justify-content: center;
    flex-wrap: wrap;
  }

  .pagination-nav li a {
    padding: 10px 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 576px) {
  .main-content {
    padding: 8px;
  }

  .modal-dialog {
    margin: 4px;
    max-width: calc(100% - 8px);
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 12px;
  }

  .modal-title {
    font-size: 16px;
  }

  /* Further table optimization for very small screens */
  .data-table {
    min-width: 600px;
  }

  .data-table th,
  .data-table td {
    padding: 6px 4px;
    font-size: 11px;
  }

  /* Hide additional columns on very small screens */
  .data-table th:nth-child(5)

  /* Category */
  ,
  .data-table td:nth-child(5) {
    display: none;
  }

  .page-title {
    font-size: 20px;
  }

  .btn {
    font-size: 14px;
    padding: 10px 16px;
  }

  /* Compact pagination for small screens */
  .pagination-nav li:not(.active):not(:first-child):not(:last-child):not(:nth-last-child(2)):not(:nth-child(2)) {
    display: none;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .main-content {
    padding: 6px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .page-header-content .btn {
    width: auto;
    min-width: 120px;
  }

  /* Ultra-compact table for very small screens */
  .data-table {
    min-width: 500px;
  }

  .data-table th:nth-child(1)

  /* Number */
  ,
  .data-table td:nth-child(1) {
    width: 40px;
  }

  .data-table th:nth-child(11)

  /* Actions */
  ,
  .data-table td:nth-child(11) {
    width: 80px;
  }

  .action-buttons .btn {
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
    font-size: 12px;
  }
}

/* Additional responsive utilities */
@media (max-width: 320px) {
  .modal-dialog {
    margin: 2px;
    max-width: calc(100% - 4px);
  }

  .form-control,
  .custom-select-wrapper .select-btn {
    font-size: 14px;
    padding: 10px;
  }

  .data-table {
    min-width: 400px;
  }
}

/* Landscape orientation optimizations */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-content {
    max-height: 90vh;
  }

  .modal-body {
    max-height: 60vh;
    overflow-y: auto;
  }

  .file-upload-area {
    min-height: 80px;
    padding: 12px;
  }
}

/* Print Media Queries */
@media print {

  .sidebar,
  .header,
  .page-header,
  .filter-section,
  .btn,
  .form-actions,
  .modal {
    display: none !important;
  }

  .main-container {
    padding-top: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
    order: -1;
  }

  .print-header h2 {
    color: #1e293b;
    margin-bottom: 4px;
    font-size: 18px;
  }

  .print-header h1 {
    color: #3b82f6;
    margin-bottom: 8px;
    font-size: 24px;
  }

  .print-header p {
    color: #64748b;
    font-size: 12px;
    margin: 2px 0;
  }

  .dashboard-card {
    border: none;
    box-shadow: none;
    margin-bottom: 15px;
  }

  .card-header {
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
  }

  .card-header .card-title {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .card-header .card-description {
    font-size: 11px;
  }

  .card-content {
    padding: 10px 0;
  }

  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
  }

  .stat-card {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    text-align: left !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .stat-header {
    margin-bottom: 8px !important;
    display: flex !important;
    justify-content: flex-start !important;
  }

  .stat-body {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .stat-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 3px 0 !important;
    border-bottom: none !important;
    font-size: 11px !important;
  }

  .stat-item .stat-label {
    font-size: 10px;
    color: #64748b;
    margin: 0;
    font-weight: 500;
  }

  .stat-item .stat-value {
    font-size: 12px;
    font-weight: 700;
    margin: 0;
  }

  .stat-item.cash-back {
    background: #fef3c7 !important;
    padding: 6px !important;
    border-radius: 4px !important;
    border: 1px solid #f59e0b !important;
    margin-top: 4px !important;
  }

  .data-table {
    font-size: 10px !important;
    width: 100% !important;
  }

  .data-table th,
  .data-table td {
    padding: 4px 6px !important;
    font-size: 10px !important;
    border: 1px solid #e2e8f0 !important;
  }

  .data-table th {
    background: #f8fafc !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    font-size: 9px !important;
  }

  .table-footer th {
    padding: 6px !important;
    border-top: 2px solid #e2e8f0 !important;
    font-size: 10px !important;
    font-weight: 700 !important;
  }

  .stat-header span,
  .data-table span[style*="background-color"] {
    font-size: 9px !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 12px !important;
  }

  .dashboard-card {
    page-break-inside: avoid;
  }

  .stats-grid {
    page-break-inside: avoid;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card,
.dashboard-card {
  animation: fadeIn 0.6s ease-out;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Accessibility Improvements */
.modal[aria-hidden="true"] {
  display: none !important;
}

.modal:focus {
  outline: none;
}

.modal-content:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .modal-content {
    border: 2px solid;
  }

  .btn-close {
    border: 1px solid;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .modal.fade {
    transition: none;
  }

  .modal-dialog {
    transition: none;
  }

  .btn-close {
    transition: none;
  }

  .modal.show .modal-content {
    animation: none;
  }
}

.purchase-section {
  margin-bottom: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.purchase-section:first-child {
  padding-top: 0;
  border-top: none;
}

.purchase-section h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #374151;
  margin: 0 0 1.5rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.add-item-section {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.5rem;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
}

.items-table th,
.items-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.items-table th {
  background-color: #f8fafc;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.total-row {
  border-top: 2px solid #e2e8f0;
  font-weight: bold;
}

.empty-items {
  text-align: center;
  padding: 2rem;
  color: #6b7280;
}

.empty-items i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
  opacity: 0.5;
}

@media (max-width: 768px) {
  .add-item-section {
    grid-template-columns: 1fr;
  }
}

/* Menu Editor Specific Styles - Add to your style.css or include separately */

/* Enhanced Form Grid for Menu Editor */
.menu-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* Menu Item Cards */
.menu-item-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 0;
  margin-bottom: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.menu-item-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #3b82f6;
}

.menu-item-card .card-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 20px 24px;
  border-bottom: none;
  position: relative;
  overflow: hidden;
}

.menu-item-card .card-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 30px 30px, 20px 20px;
  pointer-events: none;
}

.menu-item-card .card-header .card-title {
  color: white;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.menu-item-card .card-header .card-title i {
  font-size: 20px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.menu-item-card .card-content {
  padding: 24px;
}

/* Enhanced Form Groups for Menu Editor */
.menu-form-group {
  margin-bottom: 20px;
  position: relative;
}

.menu-form-group .form-label {
  font-family: "Noto Serif Khmer", serif;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.menu-form-group .form-label::before {
  content: "";
  width: 4px;
  height: 16px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 2px;
}

.menu-form-group .form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 14px;
  font-family: "Noto Serif Khmer", serif;
  transition: all 0.3s ease;
  background: white;
  color: #1f2937;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  position: relative;
}

.menu-form-group .form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1), 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.menu-form-group .form-input:hover {
  border-color: #cbd5e1;
}

/* Submenu Section Styling */
.submenu-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid #f1f5f9;
  position: relative;
}

.submenu-section::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 1px;
}

.submenu-section h5 {
  font-family: "Noto Serif Khmer", serif;
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.submenu-section h5::before {
  content: "\f0da";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  color: #3b82f6;
  font-size: 14px;
}

.submenu-item {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: all 0.2s ease;
}

.submenu-item:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  transform: translateX(4px);
}

.submenu-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 0 4px 4px 0;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.submenu-item:hover::before {
  opacity: 1;
}

/* Enhanced Action Buttons */
.menu-form-actions {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
  margin-top: 32px;
  padding: 24px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 16px;
  border: 1px solid #e2e8f0;
}

.menu-form-actions .btn {
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: "Noto Serif Khmer", serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  min-width: 180px;
  justify-content: center;
}

.menu-form-actions .btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.menu-form-actions .btn:hover::before {
  left: 100%;
}

.menu-form-actions .btn-primary {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.menu-form-actions .btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4), 0 4px 6px -2px rgba(59, 130, 246, 0.2);
}

.menu-form-actions .btn-secondary {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
}

.menu-form-actions .btn-secondary:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(107, 114, 128, 0.4), 0 4px 6px -2px rgba(107, 114, 128, 0.2);
}

/* Instructions Card Enhancement */
.instructions-card {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 16px;
  margin-top: 32px;
  overflow: hidden;
}

.instructions-card .card-header {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  border-bottom: none;
}

.instructions-card .card-header .card-title {
  color: white;
  display: flex;
  align-items: center;
  gap: 12px;
}

.instructions-card .card-header .card-title::before {
  content: "\f05a";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 20px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.instructions-card .card-content {
  padding: 24px;
}

.instructions-card h4 {
  color: #92400e;
  font-family: "Noto Serif Khmer", serif;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.instructions-card h4::before {
  content: "\f0da";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  color: #f59e0b;
  font-size: 14px;
}

.instructions-card ul {
  margin-left: 20px;
  line-height: 1.8;
}

.instructions-card ul li {
  margin-bottom: 8px;
  color: #92400e;
}

.instructions-card ul li strong {
  color: #78350f;
}

/* Icon Grid Enhancement */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.icon-grid div {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border-radius: 8px;
  font-family: "Noto Serif Khmer", serif;
  font-size: 13px;
  color: #92400e;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.icon-grid div:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.icon-grid div i {
  color: #f59e0b;
  font-size: 16px;
  width: 20px;
  text-align: center;
}

/* Alert Enhancements */
.alert {
  border-radius: 12px;
  font-family: "Noto Serif Khmer", serif;
  display: flex;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border: none;
  position: relative;
  overflow: hidden;
}

.alert::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

/* --- Fix for Custom Dropdowns & Form Layout --- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-wrapper .select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 15px;
  font-size: 14px;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 4px;
  cursor: pointer;
}

.custom-select-wrapper.active .select-btn i {
  transform: rotate(-180deg);
}

.custom-select-wrapper .content {
  display: none;
  /* Hide by default */
  position: absolute;
  /* Crucial for overlay */
  top: 100%;
  left: 0;
  width: 100%;
  margin-top: 5px;
  padding: 10px;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1050;
  /* Ensure it's on top */
}

.custom-select-wrapper.active .content {
  display: block;
  /* Show when active */
}

.custom-select-wrapper .search {
  position: relative;
}

.custom-select-wrapper .search input {
  height: 40px;
  width: 100%;
  font-size: 14px;
  padding: 0 15px 0 35px;
  border: 1px solid #B3B3B3;
  border-radius: 5px;
  outline: none;
}

.custom-select-wrapper .search i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
}


.custom-select-wrapper .options {
  margin-top: 10px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 7px;
  padding-left: 0;
  /* Remove default padding */
}

.custom-select-wrapper .options li {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 13px;
  font-size: 14px;
  list-style: none;
  /* Remove bullet points */
  cursor: pointer;
  border-radius: 5px;
}

.custom-select-wrapper .options li:hover,
.custom-select-wrapper .options li.selected {
  background: #f2f2f2;
}

.alert-success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
}

.alert-success::before {
  background: #10b981;
}

.alert-danger {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  color: #991b1b;
}

.alert-danger::before {
  background: #ef4444;
}

.alert i {
  margin-right: 12px;
  font-size: 18px;
  padding: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
}

/* Loading States */
.form-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.form-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #3b82f6;
  border-top: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .menu-editor-grid {
    grid-template-columns: 1fr;
  }

  .menu-form-actions {
    flex-direction: column;
  }

  .menu-form-actions .btn {
    width: 100%;
    min-width: auto;
  }

  .icon-grid {
    grid-template-columns: 1fr;
  }

  .menu-item-card .card-content {
    padding: 16px;
  }

  .submenu-item {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .menu-item-card .card-header {
    padding: 16px;
  }

  .menu-item-card .card-header .card-title {
    font-size: 16px;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  .menu-form-actions {
    padding: 16px;
  }
}

/* Animation Enhancements */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.menu-item-card {
  animation: fadeInUp 0.6s ease-out;
}

.menu-item-card:nth-child(2) {
  animation-delay: 0.1s;
}

.menu-item-card:nth-child(3) {
  animation-delay: 0.2s;
}

.menu-item-card:nth-child(4) {
  animation-delay: 0.3s;
}

.menu-item-card:nth-child(5) {
  animation-delay: 0.4s;
}

.menu-item-card:nth-child(6) {
  animation-delay: 0.5s;
}

/* Focus States for Accessibility */
.menu-form-group .form-input:focus,
.menu-form-actions .btn:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Print Styles */
@media print {

  .menu-form-actions,
  .instructions-card {
    display: none;
  }

  .menu-item-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #000;
  }
}