:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-900);
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--gray-200);
}

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

.sidebar-header span {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--gray-900);
}

.sidebar-nav {
  list-style: none;
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
}

.sidebar-nav .nav-item {
  margin: 4px 12px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
  background: var(--gray-100);
  color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
  background: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.sidebar-nav .nav-link i {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--gray-200);
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: #dc2626;
  color: white;
  transform: translateY(-2px);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.content-header {
  background: white;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

#pageContent {
  padding: 1.5rem;
}

/* Cards */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--gray-200);
  padding: 1rem 1.25rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

/* Stats Cards */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  border: 1px solid var(--gray-200);
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

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

.stat-card .icon.success {
  background: #d1fae5;
  color: var(--success-color);
}

.stat-card .icon.warning {
  background: #fef3c7;
  color: var(--warning-color);
}

.stat-card .icon.danger {
  background: #fee2e2;
  color: var(--danger-color);
}

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--gray-900);
}

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

/* Forms */
.form-control,
.form-select {
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

/* Buttons */
.btn-primary {
  background: var(--primary-color);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

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

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

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

.btn-outline-primary {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: 8px;
}

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

/* Tables */
.table {
  margin-bottom: 0;
}

.table thead th {
  background: var(--gray-50);
  border-bottom: 2px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-700);
  padding: 12px;
  white-space: nowrap;
}

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

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

.table-responsive {
  border-radius: 8px;
  border: 1px solid var(--gray-200);
}

/* Badge */
.badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 600;
}

/* Mobile Toggle */
.sidebar-toggle {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* File Upload */
.file-upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--gray-50);
}

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

.file-upload-zone i {
  font-size: 3rem;
  color: var(--gray-500);
  margin-bottom: 1rem;
}

/* Product Row */
.product-row {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

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

/* Search Box */
.search-box {
  position: relative;
}

.search-box input {
  padding-left: 40px;
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
}

/* Checkbox List */
.checkbox-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 0.5rem;
}

.checkbox-list .form-check {
  padding: 8px 12px;
  margin: 0;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.checkbox-list .form-check:hover {
  background: var(--gray-50);
}

.checkbox-list .form-check-input {
  margin-right: 10px;
}

/* Loading Spinner */
.spinner-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.spinner-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Editable Cell */
.editable-cell {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s ease;
}

.editable-cell:hover {
  background: var(--gray-100);
}

.editable-cell input {
  width: 100%;
  padding: 4px 8px;
  border: 2px solid var(--primary-color);
  border-radius: 4px;
}

.editable-cell.editing {
  padding: 0;
}

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

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

  .content-header {
    padding-left: 4rem;
  }
}

@media (max-width: 575.98px) {
  .stat-card {
    padding: 1rem;
  }

  .stat-card .value {
    font-size: 1.5rem;
  }

  .product-row {
    padding: 0.75rem;
  }

  .table thead th,
  .table tbody td {
    padding: 8px;
    font-size: 0.875rem;
  }
}

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

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

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

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

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

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