/* iOS 18 Design System */
:root {
  --primary-color: #007aff;
  --secondary-color: #5856d6;
  --success-color: #34c759;
  --warning-color: #ff9500;
  --error-color: #ff3b30;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --border-radius: 8px;
  --border-radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 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);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: var(--gray-800);
}

/* Glass morphism effect */
.glass-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  overflow: visible !important;
}

/* Compact iOS Buttons */
.ios-button-primary-compact {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  min-width: 80px;
}

.ios-button-primary-compact:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.ios-button-compact {
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem;
  font-weight: 500;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 80px;
}

.ios-button-compact:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Regular iOS Buttons for modals */
.ios-button-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  min-width: 100px;
}

.ios-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.ios-button-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 100px;
}

.ios-button-secondary:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Compact Form Elements */
.ios-input-compact,
.ios-select-compact {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  font-family: inherit;
}

.ios-input-compact:focus,
.ios-select-compact:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
  background: rgba(255, 255, 255, 0.95);
}

.ios-label-compact {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.25rem;
}

/* Regular form elements for modals */
.ios-input,
.ios-select,
.ios-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  font-family: inherit;
}

.ios-input:focus,
.ios-select:focus,
.ios-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-1px);
}

.ios-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.5rem;
}

/* Order Info Compact */
.order-info-compact {
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius);
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.summary-compact {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.1),
    rgba(147, 51, 234, 0.1)
  );
  border-radius: var(--border-radius);
  padding: 0.5rem;
  border: 1px solid rgba(147, 51, 234, 0.2);
}

/* Materials Catalog Table - CỐ ĐỊNH CHIỀU CAO VÀ SCROLL */
.materials-table-container {
  flex: 1; /* Sử dụng hết không gian còn lại */
  min-height: 200px; /* Giảm min-height */
  max-height: calc(100vh - 350px); /* Thêm max-height để đảm bảo scroll */
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.materials-table-scroll {
  flex: 1;
  overflow-y: auto; /* Scroll dọc */
  overflow-x: auto; /* Thay đổi từ hidden thành auto để có scroll ngang */
  min-height: 0; /* Thêm để đảm bảo flex child có thể shrink */
}

.materials-catalog-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  min-width: 100%;
}

.materials-catalog-table th {
  background: linear-gradient(135deg, var(--gray-100), var(--gray-50));
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.materials-catalog-table th:last-child {
  border-right: none;
}

.materials-catalog-table th[data-column="id"] {
  min-width: 150px;
}

.materials-catalog-table th[data-column="name"] {
  min-width: 200px;
}

.materials-catalog-table th[data-column="materialType"] {
  min-width: 100px;
}

.materials-catalog-table th[data-column="materialGroup"] {
  min-width: 120px;
}

.materials-catalog-table th[data-column="specification"] {
  min-width: 100px;
}

.materials-catalog-table th[data-column="length"],
.materials-catalog-table th[data-column="width"] {
  min-width: 80px;
}

.materials-catalog-table th[data-column="dimensions"] {
  min-width: 120px;
}

.materials-catalog-table th[data-column="unit"] {
  min-width: 60px;
}

.materials-catalog-table th[data-column="price"],
.materials-catalog-table th[data-column="currentStock"],
.materials-catalog-table th[data-column="openingStock"],
.materials-catalog-table th[data-column="inbound"],
.materials-catalog-table th[data-column="outbound"],
.materials-catalog-table th[data-column="closingStock"] {
  min-width: 100px;
  text-align: right;
}

.materials-catalog-table th[data-column="notes"] {
  min-width: 150px;
}

.materials-catalog-table th[data-column="updatedBy"] {
  min-width: 100px;
}

.materials-catalog-table th[data-column="updatedDate"] {
  min-width: 140px;
}

.materials-catalog-table th[data-column="actions"] {
  min-width: 60px;
  text-align: center;
}

.materials-catalog-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-100);
  vertical-align: middle;
  font-size: 0.75rem;
}

.materials-catalog-table td:last-child {
  border-right: none;
}

.materials-catalog-table tbody tr {
  transition: all 0.2s ease;
  cursor: pointer;
}

.materials-catalog-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.05);
}

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

/* Pagination Styles */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: between;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--gray-200);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pagination-info {
  flex: 1;
  font-size: 0.75rem;
  color: var(--gray-600);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-select {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  font-size: 0.75rem;
  background: white;
  min-width: 80px;
}

.pagination-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.page-numbers {
  display: flex;
  gap: 0.25rem;
}

/* Selected Materials Table - COMPLETELY FIXED */
.selected-materials-table-container {
  overflow: visible !important;
  position: relative;
}

.selected-materials-table {
  width: 100%;
  table-layout: fixed !important;
  border-collapse: separate;
  border-spacing: 0;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.selected-materials-table thead {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.1),
    rgba(147, 51, 234, 0.1)
  );
  position: sticky;
  top: 0;
  z-index: 1;
}

.selected-materials-table th {
  padding: 0.75rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  white-space: nowrap;
  background: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selected-materials-table th:last-child {
  border-right: none;
}

/* FIXED WIDTH COLUMNS - EXACT MATCH */
.selected-materials-table .col-stt {
  width: 50px !important;
  min-width: 50px !important;
  max-width: 50px !important;
}

.selected-materials-table .col-ma-vt {
  width: 200px !important;
  min-width: 200px !important;
  max-width: 200px !important;
}

.selected-materials-table .col-ten-vt {
  width: 220px !important;
  min-width: 220px !important;
  max-width: 220px !important;
}

.selected-materials-table .col-quy-cach {
  width: 120px !important;
  min-width: 120px !important;
  max-width: 120px !important;
}

.selected-materials-table .col-dvt {
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
}

.selected-materials-table .col-sl {
  width: 90px !important;
  min-width: 90px !important;
  max-width: 90px !important;
}

.selected-materials-table .col-don-gia {
  width: 110px !important;
  min-width: 110px !important;
  max-width: 110px !important;
}

.selected-materials-table .col-thanh-tien {
  width: 130px !important;
  min-width: 130px !important;
  max-width: 130px !important;
}

.selected-materials-table .col-xoa {
  width: 60px !important;
  min-width: 60px !important;
  max-width: 60px !important;
}

.selected-materials-table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--gray-100);
}

.selected-materials-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.03);
}

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

.selected-materials-table td {
  padding: 0.75rem 0.5rem;
  vertical-align: middle;
  font-size: 0.75rem;
  border-right: 1px solid var(--gray-100);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-materials-table td:last-child {
  border-right: none;
}

/* SPECIFIC CELL STYLING */
.selected-materials-table td:nth-child(1) {
  width: 50px !important;
  text-align: center;
  font-weight: 600;
  color: var(--gray-600);
}

.selected-materials-table td:nth-child(2) {
  width: 200px !important;
  text-align: left;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  overflow: visible !important;
  position: relative;
}

.selected-materials-table td:nth-child(3) {
  width: 220px !important;
  text-align: left;
  padding-left: 0.75rem;
}

.selected-materials-table td:nth-child(4) {
  width: 120px !important;
  text-align: center;
}

.selected-materials-table td:nth-child(5) {
  width: 70px !important;
  text-align: center;
  font-weight: 500;
  color: var(--gray-600);
}

.selected-materials-table td:nth-child(6) {
  width: 90px !important;
  text-align: center;
}

.selected-materials-table td:nth-child(7) {
  width: 110px !important;
  text-align: right;
  padding-right: 0.75rem;
}

.selected-materials-table td:nth-child(8) {
  width: 130px !important;
  text-align: right;
  padding-right: 0.75rem;
  font-weight: 600;
  color: var(--primary-color);
}

.selected-materials-table td:nth-child(9) {
  width: 60px !important;
  text-align: center;
}

/* Material code container - EXACT FIT */
.material-code-container {
  width: 100% !important;
  max-width: 100% !important;
  position: relative;
  overflow: visible !important;
  z-index: auto;
}

/* Searchable Dropdown Styles */
.searchable-dropdown {
  position: relative;
  width: 100%;
  max-width: 100%;
}

.dropdown-input-container {
  position: relative;
  width: 100%;
}

.dropdown-search-input {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0.375rem 2rem 0.375rem 0.5rem;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  transition: all 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
  cursor: pointer;
}

.dropdown-search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
  background: white;
  cursor: text;
}

.dropdown-search-input[data-selected-value=""]:not(:focus) {
  border-color: var(--error-color);
  background-color: #fef2f2;
  animation: pulse-error 2s infinite;
}

.dropdown-arrow {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.searchable-dropdown.open .dropdown-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.dropdown-results {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 999999;
  background: white;
  border: 2px solid var(--primary-color);
  border-top: none;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3),
    0 10px 10px -5px rgba(0, 0, 0, 0.1);
  max-height: 350px;
  overflow: hidden;
  width: 600px;
  min-width: 600px;
  transform: translateZ(0);
  will-change: transform;
}

/* Responsive width cho dropdown */
@media (max-width: 768px) {
  .dropdown-results {
    width: 95vw;
    min-width: 95vw;
    left: 50%;
    transform: translateX(-50%);
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .dropdown-results {
    width: 500px;
    min-width: 500px;
  }
}

.dropdown-table-container {
  max-height: 350px;
  overflow-y: auto;
  overflow-x: hidden;
}

.dropdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  table-layout: fixed;
}

.dropdown-table th {
  background: linear-gradient(135deg, var(--gray-50), var(--gray-100));
  color: var(--gray-700);
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.75rem 0.5rem;
  text-align: left;
  border-bottom: 2px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 99998;
  white-space: nowrap;
}

/* Định nghĩa width cho các cột trong dropdown */
.dropdown-table th:nth-child(1) {
  width: 25%;
} /* Mã VT */
.dropdown-table th:nth-child(2) {
  width: 35%;
} /* Tên vật tư */
.dropdown-table th:nth-child(3) {
  width: 20%;
} /* Quy cách */
.dropdown-table th:nth-child(4) {
  width: 20%;
} /* Giá */

.dropdown-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  word-wrap: break-word;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-table td:nth-child(1) {
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary-color);
}

.dropdown-table td:nth-child(2) {
  font-weight: 500;
}

.dropdown-table td:nth-child(3) {
  font-size: 0.7rem;
  color: var(--gray-600);
}

.dropdown-table td:nth-child(4) {
  text-align: right;
  font-weight: 600;
  color: var(--success-color);
}

.dropdown-row {
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-row:hover {
  background: rgba(59, 130, 246, 0.08);
}

.dropdown-row.selected {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary-color);
}

.dropdown-row.selected .material-code {
  font-weight: 700;
}

.dropdown-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  color: var(--gray-500);
  font-size: 0.875rem;
}

.dropdown-empty i {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--gray-300);
}

/* Table form elements */
.table-input,
.table-select {
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
  transition: all 0.2s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.table-input:focus,
.table-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
  background: white;
}

.table-input.number {
  text-align: right;
  font-weight: 500;
}

.material-total-cell {
  font-weight: 600;
  color: var(--primary-color);
  text-align: right;
}

.select-material-btn {
  background: var(--success-color);
  color: white;
  border: none;
  border-radius: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  transition: all 0.2s ease;
}

.select-material-btn:hover {
  background: #28a745;
  transform: scale(1.05);
}

.select-material-btn:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  transform: none;
}

.remove-material-btn {
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s ease;
  margin: 0 auto;
}

.remove-material-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
  box-shadow: var(--shadow-sm);
}

.stt-cell {
  text-align: center !important;
  font-weight: 600;
  color: var(--gray-600);
  width: 50px !important;
  min-width: 50px;
  max-width: 50px;
}

.unit-cell {
  font-size: 0.75rem;
  color: var(--gray-600);
  text-align: center;
  font-weight: 500;
}

.price-cell {
  text-align: right;
  font-weight: 500;
}

/* Material row states */
.material-row-selected {
  background: rgba(34, 197, 94, 0.08) !important;
  border-left: 4px solid var(--success-color);
}

/* Incomplete row styling */
.row-incomplete {
  background: rgba(239, 68, 68, 0.08) !important;
  border-left: 4px solid var(--error-color);
  position: relative;
}

.row-incomplete::before {
  content: "⚠️ Chưa chọn mã vật tư";
  position: absolute;
  top: -25px;
  left: 15px;
  background: var(--error-color);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  z-index: 15;
  opacity: 0;
  animation: warning-fade 3s infinite;
  box-shadow: var(--shadow-sm);
}

@keyframes warning-fade {
  0%,
  70%,
  100% {
    opacity: 0;
  }
  10%,
  60% {
    opacity: 1;
  }
}

@keyframes pulse-error {
  0%,
  100% {
    border-color: #ef4444;
    background-color: #fef2f2;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
  }
  50% {
    border-color: #dc2626;
    background-color: #fee2e2;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Toast */
.toast {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1100;
  transform: translateX(400px);
  transition: transform 0.3s ease;
}

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

.toast-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(52, 199, 89, 0.2);
  border-radius: var(--border-radius);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  font-weight: 500;
  color: var(--gray-800);
}

/* Preview styles */
.preview-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.preview-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.preview-table th,
.preview-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.preview-table th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
}

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

.fade-in-up {
  animation: fadeInUp 0.4s ease-out;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
    height: auto;
  }

  .glass-card {
    margin-bottom: 1rem;
  }

  .lg\\:col-span-2,
  .lg\\:col-span-3 {
    grid-column: span 1;
  }

  .order-info-compact .grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .order-info-compact .col-span-2 {
    grid-column: span 2;
  }

  .order-info-compact .col-span-3 {
    grid-column: span 2;
  }

  .materials-catalog-table {
    font-size: 0.7rem;
  }

  .materials-catalog-table th,
  .materials-catalog-table td {
    padding: 0.375rem 0.25rem;
  }

  .materials-table-container {
    flex: 1;
    min-height: 200px;
    max-height: calc(100vh - 400px); /* Điều chỉnh cho tablet */
  }

  .lg\\:col-span-2 .glass-card {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 768px) {
  .glass-card {
    padding: 0.75rem;
    margin: 0.25rem;
    border-radius: var(--border-radius);
  }

  .modal-content {
    margin: 0;
    border-radius: var(--border-radius);
    max-height: 100vh;
  }

  .toast {
    right: 1rem;
    left: 1rem;
    transform: translateY(-100px);
  }

  .toast.show {
    transform: translateY(0);
  }

  .order-info-compact .grid {
    grid-template-columns: 1fr;
  }

  .order-info-compact .col-span-1,
  .order-info-compact .col-span-2,
  .order-info-compact .col-span-3 {
    grid-column: span 1;
  }

  .materials-catalog-table th,
  .materials-catalog-table td {
    padding: 0.375rem 0.25rem;
    font-size: 0.7rem;
  }

  .selected-materials-table th,
  .selected-materials-table td {
    padding: 0.5rem 0.25rem;
    font-size: 0.7rem;
  }

  .table-input,
  .table-select {
    padding: 0.25rem;
    font-size: 0.7rem;
  }

  .dropdown-search-input {
    font-size: 0.7rem;
    padding: 0.25rem 1.5rem 0.25rem 0.375rem;
  }

  .dropdown-results {
    max-height: 250px;
  }

  .materials-table-container {
    flex: 1;
    min-height: 180px;
    max-height: calc(100vh - 450px); /* Điều chỉnh cho mobile */
  }

  .pagination-container {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .pagination-controls {
    justify-content: center;
  }
}

/* Print styles */
@media print {
  body {
    background: white;
  }

  .glass-card {
    background: white;
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .ios-button-primary,
  .ios-button-secondary,
  .ios-button-compact,
  .ios-button-primary-compact {
    display: none;
  }

  .modal-header,
  .modal-footer {
    display: none;
  }

  .pagination-container {
    display: none;
  }
}

/* Tab Buttons - COMPACT iOS 18 Style */
.tab-button-separate {
  background: rgba(255, 255, 255, 0.9);
  color: var(--gray-600);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 0.5rem 0.75rem;
  font-weight: 500;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  flex: 1;
  min-height: 36px;
  max-width: 140px;
  white-space: nowrap;
  letter-spacing: 0.025em;
}

.tab-button-separate:hover:not(.active) {
  background: rgba(255, 255, 255, 1);
  color: var(--gray-800);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.tab-button-separate.active {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.tab-button-separate.active:hover {
  background: linear-gradient(135deg, #0056b3, #4a47a3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.tab-button-separate i {
  font-size: 0.65rem;
  margin-right: 0.375rem;
}

/* Clear Filter Button - Icon Only iOS 18 Style */
.clear-filter-btn {
  background: rgba(239, 68, 68, 0.1) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  color: var(--error-color) !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  border-radius: 12px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem !important;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.1),
    0 1px 4px rgba(239, 68, 68, 0.05), inset 0 1px 0 rgba(255, 255, 255, 0.7) !important;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
  flex-shrink: 0;
}

.clear-filter-btn:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: var(--error-color) !important;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 8px 25px rgba(239, 68, 68, 0.2),
    0 4px 10px rgba(239, 68, 68, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

.clear-filter-btn i {
  font-size: 0.875rem;
  font-weight: 600;
}

.clear-filter-btn span {
  display: none !important;
}

/* Add New Buttons - iOS 18 Style */
.add-new-btn {
  background: linear-gradient(135deg, var(--success-color), #28a745);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.2),
    0 1px 4px rgba(52, 199, 89, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 120px;
  white-space: nowrap;
}

.add-new-btn:hover {
  background: linear-gradient(135deg, #28a745, #1e7e34);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(52, 199, 89, 0.3),
    0 4px 10px rgba(52, 199, 89, 0.15);
}

.add-new-btn i {
  font-size: 0.75rem;
  margin-right: 0.5rem;
}

.add-new-btn.dmkh {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.2),
    0 1px 4px rgba(0, 122, 255, 0.1);
}

.add-new-btn.dmkh:hover {
  background: linear-gradient(135deg, #0056b3, #4a47a3);
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.3),
    0 4px 10px rgba(0, 122, 255, 0.15);
}

/* Add New Icon in Modal Header */
.add-new-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.add-new-icon.material {
  background: rgba(34, 197, 94, 0.1);
}

.add-new-icon.material i {
  color: var(--success-color) !important;
}

/* Form Grid Improvements */
.space-y-4 > * + * {
  margin-top: 1rem;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
}

.status-pending {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning-color);
  border: 1px solid rgba(255, 149, 0, 0.2);
}

.status-approved {
  background: rgba(0, 122, 255, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(0, 122, 255, 0.2);
}

.status-completed {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

/* Column Modal Styles */
.column-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-color);
}

.column-checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Stock status colors */
.text-green-600 {
  color: #059669;
  font-weight: 600;
}

.text-red-600 {
  color: #dc2626;
  font-weight: 600;
}

/* Column toggle button */
.ios-button-compact[onclick*="showColumnModal"] {
  background: rgba(147, 51, 234, 0.1);
  color: var(--secondary-color);
  border-color: rgba(147, 51, 234, 0.2);
}

.ios-button-compact[onclick*="showColumnModal"]:hover {
  background: rgba(147, 51, 234, 0.2);
  color: var(--secondary-color);
}

/* Modal enhancements for column settings */
#columnModal .modal-content {
  max-width: 500px;
}

#columnModal .modal-body {
  max-height: 400px;
  overflow-y: auto;
}

/* Checkbox container styling */
.column-checkbox-container {
  transition: all 0.2s ease;
}

.column-checkbox-container:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* Loading state for refresh button */
.ios-button-compact .fa-spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Scrollbar styling */
.materials-table-scroll::-webkit-scrollbar {
  width: 8px;
}

.materials-table-scroll::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

.materials-table-scroll::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 4px;
}

.materials-table-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Firefox scrollbar */
.materials-table-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) var(--gray-100);
}

/* Left Panel - Materials List */
.lg\\:col-span-2 .glass-card {
  height: calc(100vh - 2rem); /* Sử dụng hết chiều cao viewport trừ padding */
  max-height: calc(100vh - 2rem);
}

/* Filter Buttons Container */
.filter-buttons-container {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.filter-button-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 1;
  justify-content: flex-start;
}

/* iOS 18 Style Filter Buttons - UPDATED */
.filter-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  min-width: 80px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.filter-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.4) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.2) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.filter-button:hover:not(.active) {
  background: rgba(255, 255, 255, 0.95);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-color: rgba(59, 130, 246, 0.3);
}

.filter-button:hover:not(.active)::before {
  opacity: 1;
}

.filter-button.active {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3),
    0 4px 10px rgba(88, 86, 214, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.filter-button.active::before {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.15) 100%
  );
  opacity: 1;
}

.filter-button.active:hover {
  background: linear-gradient(135deg, #0056b3 0%, #4a47a3 100%);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 35px rgba(59, 130, 246, 0.4),
    0 6px 15px rgba(88, 86, 214, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Filter Button Content */
.filter-label {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  font-size: 0.75rem;
  letter-spacing: 0.025em;
}

.filter-count {
  font-size: 0.7rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  min-width: 24px;
  text-align: center;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
}

.filter-button.active .filter-count {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

.filter-button:not(.active) .filter-count {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-color);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

@media (max-width: 768px) {
  .tab-button-separate {
    padding: 0.4rem 0.6rem;
    font-size: 0.65rem;
    border-radius: 10px;
    min-height: 32px;
    max-width: 120px;
  }

  .tab-button-separate i {
    font-size: 0.6rem;
    margin-right: 0.25rem;
  }

  .clear-filter-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    padding: 0.6rem !important;
    border-radius: 10px !important;
  }

  .clear-filter-btn i {
    font-size: 0.8rem;
  }

  .add-new-btn {
    padding: 0.6rem 0.8rem;
    font-size: 0.7rem;
    min-width: 100px;
  }

  .add-new-btn i {
    font-size: 0.7rem;
    margin-right: 0.4rem;
  }

  .filter-buttons-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .filter-button-group {
    justify-content: center;
  }

  .filter-button {
    min-width: 70px;
    padding: 0.5rem 0.75rem;
    border-radius: 14px;
  }

  .filter-label {
    font-size: 0.7rem;
  }

  .filter-count {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
  }

  /* Search and clear filter row on mobile */
  .flex.items-center.gap-3.mb-3 {
    flex-direction: column;
    gap: 0.75rem;
  }

  .flex.items-center.gap-3.mb-3 .relative.flex-1 {
    width: 100%;
  }

  .clear-filter-btn {
    align-self: center;
    min-width: 120px;
    border-radius: 14px !important;
  }
}

@media (max-width: 480px) {
  .tab-button-separate {
    padding: 0.35rem 0.5rem;
    font-size: 0.6rem;
    border-radius: 8px;
    min-height: 30px;
    max-width: 100px;
  }

  .tab-button-separate i {
    font-size: 0.55rem;
    margin-right: 0.2rem;
  }

  .clear-filter-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    padding: 0.5rem !important;
    border-radius: 8px !important;
  }

  .clear-filter-btn i {
    font-size: 0.75rem;
  }

  .add-new-btn {
    padding: 0.5rem 0.7rem;
    font-size: 0.65rem;
    min-width: 90px;
  }

  .add-new-btn i {
    font-size: 0.65rem;
    margin-right: 0.35rem;
  }

  /* Stack title and tabs on very small screens */
  .flex.items-center.justify-between.mb-3 {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
  }

  .flex.items-center.justify-between.mb-3 h2 {
    text-align: center;
  }

  .filter-button {
    min-width: 65px;
    padding: 0.4rem 0.6rem;
    border-radius: 12px;
  }

  .filter-label {
    font-size: 0.65rem;
  }

  .filter-count {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    border-radius: 8px;
  }
}

/* Animation for count updates */
.filter-count {
  transition: all 0.3s ease;
}

.filter-count.updated {
  animation: countPulse 0.6s ease;
}

@keyframes countPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

/* Special styling for zero counts */
.filter-count.zero {
  opacity: 0.7;
  background: rgba(156, 163, 175, 0.2) !important;
  color: var(--gray-500) !important;
  border-color: rgba(156, 163, 175, 0.3) !important;
}

.filter-button.active .filter-count.zero {
  background: rgba(255, 255, 255, 0.8) !important;
  color: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

/* Custom Confirmation Modal */
.confirmation-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.confirmation-icon.warning {
  background: rgba(245, 158, 11, 0.1);
}

.confirmation-icon.warning i {
  color: #f59e0b !important;
}

.confirmation-icon.danger {
  background: rgba(239, 68, 68, 0.1);
}

.confirmation-icon.danger i {
  color: #ef4444 !important;
}

.confirmation-icon.success {
  background: rgba(34, 197, 94, 0.1);
}

.confirmation-icon.success i {
  color: #22c55e !important;
}

/* Enhanced Toast Container */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
  pointer-events: none;
}

.toast-container .toast {
  position: relative;
  transform: translateX(0);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: auto;
  margin: 0;
}

.toast-container .toast:not(.show) {
  transform: translateX(450px);
  opacity: 0;
}

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

.toast-container .toast.removing {
  transform: translateX(450px);
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* Enhanced Toast Styles */
.enhanced-toast {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--border-radius-lg);
  padding: 1rem 1.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  font-weight: 500;
  color: var(--gray-800);
  min-width: 300px;
  position: relative;
  overflow: hidden;
}

.enhanced-toast::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary-color);
}

.enhanced-toast.success::before {
  background: var(--success-color);
}

.enhanced-toast.error::before {
  background: var(--error-color);
}

.enhanced-toast.warning::before {
  background: var(--warning-color);
}

.enhanced-toast.info::before {
  background: var(--primary-color);
}

.toast-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.toast-icon.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success-color);
}

.toast-icon.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error-color);
}

.toast-icon.warning {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning-color);
}

.toast-icon.info {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-color);
}

.toast-content-enhanced {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--gray-800);
}

.toast-message {
  font-size: 0.8rem;
  color: var(--gray-600);
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0.25rem;
  margin-left: 0.75rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toast-close:hover {
  color: var(--gray-600);
  background: rgba(0, 0, 0, 0.05);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
  transition: width linear;
}

.toast-progress.success {
  background: var(--success-color);
}

.toast-progress.error {
  background: var(--error-color);
}

.toast-progress.warning {
  background: var(--warning-color);
}

.toast-progress.info {
  background: var(--primary-color);
}

/* Modal enhancements for confirmation */
#confirmModal .modal-content {
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#confirmModal .modal-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
}

#confirmModal .modal-body {
  padding: 1rem 1.5rem;
}

#confirmModal .modal-footer {
  padding: 1rem 1.5rem 1.5rem 1.5rem;
  border-top: 1px solid var(--gray-200);
  gap: 0.75rem;
}

/* Responsive toast container */
@media (max-width: 768px) {
  .toast-container {
    right: 1rem;
    left: 1rem;
    max-width: none;
  }

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

/* Animation for modal */
@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pulse animation for urgent confirmations */
.confirmation-icon.urgent {
  animation: urgentPulse 2s infinite;
}

@keyframes urgentPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* iOS 18 Search Input */
.ios-search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: none;
  border-radius: 20px;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--gray-800);
}

.ios-search-input::placeholder {
  color: var(--gray-500);
  font-weight: 400;
}

.ios-search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 25px rgba(0, 122, 255, 0.15),
    0 4px 10px rgba(0, 122, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  border-color: rgba(0, 122, 255, 0.3);
  transform: translateY(-1px) scale(1.01);
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.875rem;
  transition: all 0.3s ease;
  pointer-events: none;
}

.ios-search-input:focus + .search-icon {
  color: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

/* Add New Buttons - Compact for Header */
.add-new-btn {
  background: linear-gradient(135deg, var(--success-color), #28a745);
  color: white;
  border: none;
  border-radius: var(--border-radius);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.2), 0 1px 4px rgba(52, 199, 89, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-width: 80px;
  white-space: nowrap;
}

.add-new-btn:hover {
  background: linear-gradient(135deg, #28a745, #1e7e34);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3),
    0 2px 6px rgba(52, 199, 89, 0.15);
}

.add-new-btn i {
  font-size: 0.65rem;
  margin-right: 0.375rem;
}

.add-new-btn.dmkh {
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2), 0 1px 4px rgba(0, 122, 255, 0.1);
}

.add-new-btn.dmkh:hover {
  background: linear-gradient(135deg, #0056b3, #4a47a3);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3),
    0 2px 6px rgba(0, 122, 255, 0.15);
}

@media (max-width: 768px) {
  .add-new-btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.65rem;
    min-width: 70px;
  }

  .add-new-btn i {
    font-size: 0.6rem;
    margin-right: 0.25rem;
  }

  .ios-search-input {
    padding: 0.6rem 0.875rem 0.6rem 2.25rem;
    font-size: 0.8rem;
    border-radius: 18px;
  }

  .search-icon {
    left: 0.75rem;
    font-size: 0.8rem;
  }

  /* Header buttons wrap on mobile */
  .flex.gap-2.flex-wrap {
    gap: 0.375rem;
  }
}

@media (max-width: 480px) {
  .add-new-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.6rem;
    min-width: 65px;
  }

  .add-new-btn i {
    font-size: 0.55rem;
    margin-right: 0.2rem;
  }

  .ios-search-input {
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    font-size: 0.75rem;
    border-radius: 16px;
  }

  .search-icon {
    left: 0.625rem;
    font-size: 0.75rem;
  }
}
