/* ============================================================
   Tap2Order – Admin Panel Stylesheet
   ============================================================ */

/* ----------------------------------------------------------
   1. CSS Custom Properties
   ---------------------------------------------------------- */
:root {
  --primary: #e74c3c;
  --primary-light: #fdedec;
  --primary-dark: #c0392b;
  --secondary: #2c3e50;
  --secondary-light: #34495e;
  --success: #27ae60;
  --success-light: #eafaf1;
  --warning: #f39c12;
  --warning-light: #fef9e7;
  --danger: #e74c3c;
  --danger-light: #fdedec;
  --info: #3498db;
  --info-light: #ebf5fb;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.875rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 60px;
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --border-radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --transition: all 0.25s ease;
  --transition-fast: all 0.15s ease;
}

/* ----------------------------------------------------------
   2. Reset & Base
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--gray-800);
  background-color: var(--gray-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

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

img {
  max-width: 100%;
  height: auto;
}

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

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  transition: var(--transition);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-area {
  flex: 1;
  padding: 24px;
}

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

.sidebar::-webkit-scrollbar {
  width: 4px;
}

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

.sidebar-brand {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
  height: 32px;
  margin-right: 10px;
}

.sidebar-brand span {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--white);
  white-space: nowrap;
}

.sidebar-brand .brand-dot {
  color: var(--primary);
}

.sidebar-menu {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.sidebar-menu li {
  margin: 2px 12px;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: rgba(255, 255, 255, 0.65);
  border-radius: var(--border-radius);
  font-size: var(--font-size-base);
  font-weight: 500;
  transition: var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.sidebar-menu li a i {
  width: 20px;
  margin-right: 12px;
  font-size: 1.1rem;
  text-align: center;
  opacity: 0.7;
  transition: var(--transition-fast);
}

.sidebar-menu li a:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-menu li a:hover i {
  opacity: 1;
}

.sidebar-menu li a.active,
.sidebar-menu li a.active {
  color: var(--white);
  background: var(--primary);
  font-weight: 600;
}

.sidebar-menu li a.active i {
  opacity: 1;
}

.sidebar-menu .menu-label {
  padding: 12px 16px 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--font-size-sm);
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
}

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

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

.topbar-left .sidebar-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--gray-600);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-fast);
}

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

.page-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gray-800);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-right .btn-icon {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--border-radius);
  color: var(--gray-600);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
}

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

.notification-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--white);
}

.notification-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: var(--white);
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--white);
}

.user-dropdown {
  position: relative;
  margin-left: 8px;
}

.user-dropdown .dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-fast);
}

.user-dropdown .dropdown-toggle:hover {
  background: var(--gray-100);
}

.user-dropdown .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}

.user-dropdown .user-info {
  text-align: left;
}

.user-dropdown .user-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--gray-800);
  line-height: 1.2;
}

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

/* ----------------------------------------------------------
   6. Dropdown Menu
   ---------------------------------------------------------- */
.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: var(--transition-fast);
}

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

.dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: var(--font-size-sm);
  color: var(--gray-700);
  border-radius: var(--border-radius-sm);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: var(--transition-fast);
}

.dropdown-menu .dropdown-item:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.dropdown-menu .dropdown-item i {
  width: 16px;
  text-align: center;
  opacity: 0.6;
}

.dropdown-menu .dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

/* ----------------------------------------------------------
   7. Dashboard Cards
   ---------------------------------------------------------- */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.dash-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

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

.dash-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.dash-card.card-primary::before { background: var(--primary); }
.dash-card.card-success::before { background: var(--success); }
.dash-card.card-warning::before { background: var(--warning); }
.dash-card.card-info::before { background: var(--info); }
.dash-card.card-danger::before { background: var(--danger); }

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

.dash-card.card-primary .card-icon {
  background: var(--primary-light);
  color: var(--primary);
}

.dash-card.card-success .card-icon {
  background: var(--success-light);
  color: var(--success);
}

.dash-card.card-warning .card-icon {
  background: var(--warning-light);
  color: var(--warning);
}

.dash-card.card-info .card-icon {
  background: var(--info-light);
  color: var(--info);
}

.dash-card.card-danger .card-icon {
  background: var(--danger-light);
  color: var(--danger);
}

.dash-card .card-value {
  font-size: var(--font-size-3xl);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
  margin-bottom: 4px;
}

.dash-card .card-label {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
  font-weight: 500;
}

.dash-card .card-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 12px;
}

.dash-card .card-trend.up {
  color: var(--success);
  background: var(--success-light);
}

.dash-card .card-trend.down {
  color: var(--danger);
  background: var(--danger-light);
}

/* ----------------------------------------------------------
   8. Stat Card Variants (alternative)
   ---------------------------------------------------------- */
.stat-card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card.stat-primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.stat-success .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.stat-warning .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.stat-info .stat-icon { background: var(--info-light); color: var(--info); }
.stat-card.stat-danger .stat-icon { background: var(--danger-light); color: var(--danger); }

.stat-card .stat-content .stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.stat-card .stat-content .stat-label {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
}

/* ----------------------------------------------------------
   9. Cards
   ---------------------------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  margin-bottom: 24px;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header .card-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gray-800);
  margin: 0;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* ----------------------------------------------------------
   10. Tables
   ---------------------------------------------------------- */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

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

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

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

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

.data-table.table-striped tbody tr:nth-of-type(even) {
  background: var(--gray-50);
}

.data-table.table-striped tbody tr:nth-of-type(even):hover {
  background: var(--gray-100);
}

.data-table .table-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  vertical-align: middle;
}

.data-table .table-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.data-table .table-actions .btn {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* ----------------------------------------------------------
   11. Badges
   ---------------------------------------------------------- */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge-active,
.badge-status.active {
  background: var(--success-light);
  color: var(--success);
}

.badge-status.active::before {
  background: var(--success);
}

.badge-inactive,
.badge-status.inactive {
  background: var(--gray-200);
  color: var(--gray-600);
}

.badge-status.inactive::before {
  background: var(--gray-500);
}

.badge-trial,
.badge-status.trial {
  background: var(--info-light);
  color: var(--info);
}

.badge-status.trial::before {
  background: var(--info);
}

.badge-suspended,
.badge-status.suspended {
  background: var(--warning-light);
  color: var(--warning);
}

.badge-status.suspended::before {
  background: var(--warning);
}

.badge-expired,
.badge-status.expired {
  background: var(--danger-light);
  color: var(--danger);
}

.badge-status.expired::before {
  background: var(--danger);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-danger { background: var(--danger-light); color: var(--danger); }

/* ----------------------------------------------------------
   12. Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  font-family: var(--font-family);
  border: 1px solid transparent;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.5;
}

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

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

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

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

.btn-success:hover {
  background: #219a52;
  color: var(--white);
}

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

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

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

.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-300);
}

.btn-outline:hover {
  background: var(--gray-100);
  color: var(--gray-800);
  border-color: var(--gray-400);
}

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

.btn-outline-primary:hover {
  background: var(--primary);
  color: var(--white);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-lg {
  padding: 10px 24px;
  font-size: var(--font-size-lg);
}

.btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
}

/* ----------------------------------------------------------
   13. Forms
   ---------------------------------------------------------- */
.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  display: block;
}

.form-control {
  width: 100%;
  padding: 9px 14px;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--gray-800);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  transition: var(--transition-fast);
  line-height: 1.5;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

.form-control:disabled,
.form-control[readonly] {
  background: var(--gray-100);
  opacity: 0.7;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-valid {
  border-color: var(--success);
}

.form-text {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.invalid-feedback {
  font-size: 0.75rem;
  color: var(--danger);
  margin-top: 4px;
  display: block;
}

.form-select {
  width: 100%;
  padding: 9px 36px 9px 14px;
  font-size: var(--font-size-sm);
  font-family: var(--font-family);
  color: var(--gray-800);
  background: var(--white) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") right 12px center / 12px no-repeat;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  appearance: none;
  transition: var(--transition-fast);
}

.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.12);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.form-check-input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.form-check-label {
  font-size: var(--font-size-sm);
  color: var(--gray-700);
  cursor: pointer;
}

.form-group {
  margin-bottom: 16px;
}

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-radius: 0;
}

.input-group .form-control:first-child {
  border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .form-control:last-child {
  border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group-text {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  font-size: var(--font-size-sm);
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  white-space: nowrap;
}

/* ----------------------------------------------------------
   14. Modals
   ---------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(2px);
}

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

.modal-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 1060;
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-dialog.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.modal-content {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

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

.modal-header .modal-title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--gray-800);
}

.modal-header .btn-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  color: var(--gray-500);
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.modal-header .btn-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ----------------------------------------------------------
   15. Alerts & Toast Notifications
   ---------------------------------------------------------- */
.alert {
  padding: 14px 18px;
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert i {
  margin-top: 2px;
  flex-shrink: 0;
}

.alert-success {
  background: var(--success-light);
  color: #1a7a42;
  border-color: #b7e4c7;
}

.alert-danger {
  background: var(--danger-light);
  color: #922b21;
  border-color: #f5b7b1;
}

.alert-warning {
  background: var(--warning-light);
  color: #7d6608;
  border-color: #f9e79f;
}

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

.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 420px;
  padding: 14px 18px;
  background: var(--white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--gray-400);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  pointer-events: auto;
  animation: toastSlideIn 0.3s ease, toastFadeOut 0.3s ease 3.7s forwards;
  font-size: var(--font-size-sm);
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info { border-left-color: var(--info); }

.toast .toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error .toast-icon { color: var(--danger); }
.toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-info .toast-icon { color: var(--info); }

.toast .toast-message {
  flex: 1;
  color: var(--gray-700);
  font-weight: 500;
}

.toast .toast-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  font-size: 1rem;
  transition: var(--transition-fast);
}

.toast .toast-close:hover {
  color: var(--gray-700);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* ----------------------------------------------------------
   16. Breadcrumbs
   ---------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  margin: 0 0 20px;
  list-style: none;
  font-size: var(--font-size-sm);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-500);
}

.breadcrumb li a {
  color: var(--gray-500);
  font-weight: 500;
  transition: var(--transition-fast);
}

.breadcrumb li a:hover {
  color: var(--primary);
}

.breadcrumb li.active {
  color: var(--gray-800);
  font-weight: 600;
}

.breadcrumb li + li::before {
  content: '/';
  color: var(--gray-400);
  font-weight: 400;
}

/* ----------------------------------------------------------
   17. Pagination
   ---------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
}

.pagination .page-item .page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--gray-600);
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
}

.pagination .page-item .page-link:hover {
  background: var(--gray-50);
  color: var(--primary);
  border-color: var(--primary);
}

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

.pagination .page-item.disabled .page-link {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ----------------------------------------------------------
   18. Chart Containers
   ---------------------------------------------------------- */
.chart-container {
  position: relative;
  width: 100%;
  padding: 16px;
}

.chart-container canvas {
  max-width: 100%;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-sm);
  color: var(--gray-600);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ----------------------------------------------------------
   19. Sidebar Collapsed State
   ---------------------------------------------------------- */
.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar .sidebar-brand span,
.sidebar-collapsed .sidebar .menu-label,
.sidebar-collapsed .sidebar .sidebar-menu li a span {
  display: none;
}

.sidebar-collapsed .sidebar .sidebar-menu li a {
  justify-content: center;
  padding: 10px;
}

.sidebar-collapsed .sidebar .sidebar-menu li a i {
  margin-right: 0;
  font-size: 1.2rem;
}

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

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

.sidebar-collapsed .topbar {
  left: var(--sidebar-collapsed-width);
}

/* ----------------------------------------------------------
   20. Loading Spinner Overlay
   ---------------------------------------------------------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  backdrop-filter: blur(2px);
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

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

.loading-dots {
  display: flex;
  gap: 4px;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ----------------------------------------------------------
   21. Animations
   ---------------------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

/* ----------------------------------------------------------
   22. Image Preview
   ---------------------------------------------------------- */
.image-preview-wrapper {
  position: relative;
  display: inline-block;
}

.image-preview {
  max-width: 200px;
  max-height: 200px;
  border-radius: var(--border-radius);
  border: 2px dashed var(--gray-300);
  object-fit: cover;
  display: none;
}

.image-preview.show {
  display: block;
}

.file-upload-area {
  border: 2px dashed var(--gray-300);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--gray-50);
}

.file-upload-area:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-upload-area i {
  font-size: 2rem;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.file-upload-area p {
  font-size: var(--font-size-sm);
  color: var(--gray-500);
}

/* ----------------------------------------------------------
   23. Page Header
   ---------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header .page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ----------------------------------------------------------
   24. Empty State
   ---------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
}

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

.empty-state h5 {
  font-size: var(--font-size-lg);
  color: var(--gray-700);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: var(--font-size-sm);
  max-width: 360px;
  margin: 0 auto 20px;
}

/* ----------------------------------------------------------
   25. Utility Classes
   ---------------------------------------------------------- */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--danger) !important; }
.text-info { color: var(--info) !important; }
.text-muted { color: var(--gray-500) !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.fw-bold { font-weight: 700 !important; }
.fw-medium { font-weight: 500 !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none !important; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------
   26. Responsive Breakpoints
   ---------------------------------------------------------- */
@media (max-width: 1199px) {
  .dash-cards {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
    z-index: 1060;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .topbar {
    left: 0;
  }

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

  .topbar-left .sidebar-toggle {
    display: flex;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    display: none;
  }

  .sidebar-overlay.show {
    display: block;
  }
}

@media (max-width: 767px) {
  .content-area {
    padding: 16px;
  }

  .dash-cards {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .dash-card {
    padding: 14px;
  }

  .dash-card .card-value {
    font-size: var(--font-size-2xl);
  }

  .topbar-right .user-info {
    display: none;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-dialog {
    width: 95%;
  }

  .toast {
    min-width: unset;
    max-width: calc(100vw - 48px);
  }

  .toast-container {
    right: 12px;
    left: 12px;
  }

  .data-table {
    font-size: 0.75rem;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 10px 12px;
  }
}

@media (max-width: 575px) {
  .dash-cards {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ----------------------------------------------------------
   27. Print Styles
   ---------------------------------------------------------- */
@media print {
  .sidebar,
  .topbar,
  .toast-container,
  .loading-overlay,
  .btn,
  .sidebar-toggle,
  .no-print {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding-top: 0 !important;
  }

  .content-area {
    padding: 0 !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }

  body {
    background: var(--white) !important;
    color: #000 !important;
    font-size: 12pt;
  }

  a {
    text-decoration: underline;
    color: #000;
  }

  .data-table {
    font-size: 10pt;
  }

  .data-table thead th {
    background: #f0f0f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .badge-status {
    border: 1px solid #999;
  }
}
