:root {
  --primary: #E17055;
  --primary-dark: #d35400;
  --primary-rgb: 225, 112, 85;
  --primary-light: #fdf0ed;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #334155;
  --bg-body: #f1f5f9;
  --text-muted: #64748b;
  --text-body: #1e293b;
  --card-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --card-shadow-hover: 0 4px 6px -1px rgba(0,0,0,0.06), 0 10px 15px -3px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.2s ease;
  --sidebar-width: 250px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-body);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#wrapper { min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────── */

.sidebar {
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  border-right: 1px solid rgba(255,255,255,0.04);
}

.sidebar.closed { margin-left: calc(var(--sidebar-width) * -1); }

.sidebar-header {
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 20px 16px;
}

.sidebar-logo {
  max-width: 120px;
  max-height: 80px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.sidebar .nav-link {
  color: rgba(255,255,255,0.55);
  padding: 10px 20px;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  border-left: 3px solid transparent;
  margin: 2px 8px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .nav-link:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,0.85);
  border-left-color: transparent;
}

.sidebar .nav-link.active {
  background: var(--sidebar-active);
  color: #fff;
  border-left-color: var(--primary);
}

.sidebar .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: rgba(255,255,255,0.4);
}

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

/* ─── Page Content ───────────────────────────── */

#page-content-wrapper {
  width: 100%;
  margin-left: var(--sidebar-width);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#page-content-wrapper.expanded { margin-left: 0; }

/* ─── Navbar ─────────────────────────────────── */

.navbar {
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0 !important;
  padding: 12px 24px !important;
  position: sticky;
  top: 0;
  z-index: 999;
  backdrop-filter: blur(12px);
}

#menu-toggle {
  border: none;
  background: var(--bg-body);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

#menu-toggle:hover {
  background: #e2e8f0;
  color: var(--text-body);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
}

.navbar-user .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.navbar-user .badge {
  font-weight: 500;
  padding: 3px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ─── Cards ──────────────────────────────────── */

.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 1rem;
  transition: var(--transition);
  background: #fff;
}

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

.card-header {
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  font-size: 14px;
  padding: 14px 20px;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }

.card-header + .card-body {
  padding-top: 16px;
}

/* Metric cards on dashboard */
.card.bg-primary, .card.bg-success, .card.bg-info, .card.bg-warning {
  position: relative;
  overflow: hidden;
  border: none;
}

.card.bg-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.card.bg-success {
  background: linear-gradient(135deg, #00b894 0%, #00cec9 100%) !important;
}

.card.bg-info {
  background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%) !important;
}

.card.bg-warning {
  background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%) !important;
}

.card.bg-primary h5, .card.bg-success h5, .card.bg-info h5, .card.bg-warning h5 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.85;
  margin-bottom: 4px;
}

.card.bg-primary h3, .card.bg-success h3, .card.bg-info h3, .card.bg-warning h3 {
  font-weight: 800;
  font-size: 26px;
  margin-bottom: 0;
}

.card.bg-primary small, .card.bg-success small, .card.bg-info small, .card.bg-warning small {
  opacity: 0.75;
  font-size: 11px;
}

/* ─── Buttons ────────────────────────────────── */

.btn {
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }

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

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

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

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-success {
  background: #00b894;
  border-color: #00b894;
}

.btn-success:hover {
  background: #00a381;
  border-color: #00a381;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 184, 148, 0.35);
}

.btn-outline-success:hover {
  background: #00b894;
  border-color: #00b894;
}

.btn-outline-secondary:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

.btn-outline-danger:hover {
  background: #ef4444;
  border-color: #ef4444;
}

.btn-outline-warning:hover {
  background: #f59e0b;
  border-color: #f59e0b;
}

/* ─── Forms ──────────────────────────────────── */

.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1.5px solid #e2e8f0;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-body);
  transition: var(--transition);
  background: #fff;
}

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

.form-control-sm { padding: 6px 10px; font-size: 12.5px; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.input-group-text {
  background: var(--bg-body);
  border: 1.5px solid #e2e8f0;
  color: var(--text-muted);
}

/* ─── Tables ─────────────────────────────────── */

.table {
  font-size: 13px;
}

.table th {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-top: none;
  padding: 12px 12px 8px;
  background: #f8fafc;
}

.table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover {
  background: #f8fafc;
}

.table-responsive {
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ─── Badges ─────────────────────────────────── */

.badge {
  font-weight: 500;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.badge.bg-success { background: #00b894 !important; }
.badge.bg-danger { background: #ef4444 !important; }
.badge.bg-warning { background: #f59e0b !important; color: #fff; }
.badge.bg-info { background: #3b82f6 !important; }
.badge.bg-secondary { background: #94a3b8 !important; }
.badge.bg-primary { background: var(--primary) !important; }

/* ─── Modals ─────────────────────────────────── */

.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.modal-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid #f1f5f9;
  padding: 16px 20px;
}

.modal-body { padding: 20px; }
.modal-footer { border-top: 1px solid #f1f5f9; padding: 12px 20px; }

/* ─── Alerts ─────────────────────────────────── */

.alert {
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ─── List Group ─────────────────────────────── */

.list-group-item {
  border: none;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 16px;
  font-size: 13px;
}

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

.list-group-item:hover {
  background: #f8fafc;
}

/* ─── Pagination / DataTables ────────────────── */

.dataTables_wrapper { overflow-x: auto; padding-top: 4px; }

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 8px;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  border: 1.5px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 12.5px;
}

.dataTables_wrapper .dataTables_info {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

.dataTables_wrapper .dataTables_paginate {
  padding: 8px 0;
}

.dataTables_wrapper .paginate_button {
  padding: 4px 10px !important;
  margin: 0 2px;
  border-radius: var(--radius-sm) !important;
  font-size: 12px !important;
}

.dataTables_wrapper .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}

/* ─── Notification (fixed toast) ─────────────── */

.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  min-width: 300px;
}

/* ─── Sidebar scrollbar ──────────────────────── */

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

/* ─── Animations ─────────────────────────────── */

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

.card {
  animation: fadeIn 0.3s ease;
}

/* ─── Page title ─────────────────────────────── */

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-body);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
}

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

/* ─── Dashboard specific ─────────────────────── */

#salesChart {
  max-height: 250px;
}

/* ─── Responsive ─────────────────────────────── */

@media (max-width: 992px) {
  .sidebar { margin-left: calc(var(--sidebar-width) * -1); }
  .sidebar.open { margin-left: 0; }
  #page-content-wrapper { margin-left: 0; }
}

@media (max-width: 768px) {
  .dataTables_wrapper .row { margin: 0; }
  .card-body { padding: 14px; }
  .btn { padding: 6px 14px; font-size: 12px; }
  .navbar { padding: 10px 16px !important; }
  .navbar-user { font-size: 12px; padding: 4px 8px; }
}

@media (max-width: 576px) {
  .page-title { font-size: 16px; }
  .card-header { font-size: 13px; padding: 12px 16px; }
}
