/* Color System Tokens */
:root {
  --admin-bg: hsl(220, 14%, 96%);
  --admin-sidebar-bg: hsl(222, 47%, 11%);
  --admin-sidebar-text: hsl(214, 20%, 69%);
  --admin-sidebar-hover: hsl(217, 33%, 17%);
  --admin-sidebar-active: hsl(214, 100%, 59%);
  --admin-sidebar-active-text: hsl(0, 0%, 100%);
  --admin-card-bg: hsl(0, 0%, 100%);
  --admin-card-border: hsl(220, 13%, 91%);
  --admin-text-main: hsl(222, 47%, 11%);
  --admin-text-secondary: hsl(215, 16%, 47%);
  --admin-border-color: hsl(220, 13%, 91%);
  --admin-primary: hsl(221, 83%, 53%);
  --admin-primary-hover: hsl(224, 76%, 48%);
  
  --admin-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --admin-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --admin-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Global Reset overrides for Admin Site */
.admin-site {
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* Layout Framework */
.admin-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styling */
.admin-sidebar {
  width: 260px;
  background-color: var(--admin-sidebar-bg);
  color: var(--admin-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1020;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.5px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--admin-sidebar-active);
  box-shadow: 0 0 12px var(--admin-sidebar-active);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.nav-list .nav-link:hover {
  background-color: var(--admin-sidebar-hover);
  color: #fff;
}

.nav-list .nav-link.active {
  background-color: var(--admin-sidebar-active);
  color: var(--admin-sidebar-active-text);
}

.nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.85;
}

.nav-list .nav-link.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(0, 0, 0, 0.15);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--admin-sidebar-active);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.user-role {
  font-size: 0.75rem;
  opacity: 0.6;
}

.btn-logout {
  background: none;
  border: none;
  padding: 8px;
  color: var(--admin-sidebar-text);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-logout:hover {
  background-color: var(--admin-sidebar-hover);
  color: #ef4444;
}

.logout-icon {
  width: 18px;
  height: 18px;
}

/* Viewport and Topbar */
.admin-viewport {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

.admin-topbar {
  height: 70px;
  background-color: #fff;
  border-bottom: 1px solid var(--admin-border-color);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

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

.sidebar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 20px;
  height: 14px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.toggle-line {
  width: 100%;
  height: 2px;
  background-color: var(--admin-text-main);
  transition: all 0.2s;
}

.topbar-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  color: var(--admin-text-main);
}

.badge-role {
  background-color: hsl(220, 14%, 93%);
  color: var(--admin-text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

/* Content Area */
.admin-content {
  flex: 1;
  padding: 32px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Dashboard Metrics Widget Cards */
.admin-site .card {
  background-color: var(--admin-card-bg);
  border: 1px solid var(--admin-card-border);
  border-radius: 12px;
  box-shadow: var(--admin-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

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

.admin-site .card-header {
  background-color: #fff;
  border-bottom: 1px solid var(--admin-border-color);
  padding: 16px 24px;
  font-weight: 700;
  color: var(--admin-text-main);
}

.admin-site .card-body {
  padding: 24px;
}

.admin-site .display-6 {
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--admin-text-main);
}

/* Table Enhancements */
.admin-site .table-responsive {
  border-radius: 12px;
  border: 1px solid var(--admin-card-border);
  box-shadow: var(--admin-shadow-sm);
  background-color: #fff;
  overflow: hidden;
}

.admin-site .table {
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-site .table th {
  background-color: hsl(220, 14%, 97%);
  color: var(--admin-text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--admin-border-color);
}

.admin-site .table td {
  padding: 16px 20px;
  vertical-align: middle;
  border-bottom: 1px solid var(--admin-border-color);
  color: var(--admin-text-main);
}

.admin-site .table tbody tr:last-child td {
  border-bottom: none;
}

.admin-site .table-hover tbody tr:hover td {
  background-color: hsl(220, 14%, 98%);
}

/* Form controls & floating labels */
.admin-site .form-control, .admin-site .form-select {
  border-radius: 8px;
  border: 1px solid var(--admin-border-color);
  padding: 10px 14px;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.admin-site .form-control:focus, .admin-site .form-select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.admin-site .form-label {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--admin-text-main);
  margin-bottom: 6px;
}

/* Custom styled buttons */
.admin-site .btn {
  font-weight: 600;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.admin-site .btn-primary {
  background-color: var(--admin-primary);
  border-color: var(--admin-primary);
  color: #fff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.admin-site .btn-primary:hover {
  background-color: var(--admin-primary-hover);
  border-color: var(--admin-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.25);
}

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

.admin-site .btn-outline-primary:hover {
  background-color: var(--admin-primary);
  color: #fff;
  transform: translateY(-1px);
}

/* Alert styling overrides */
.admin-site .alert {
  border-radius: 10px;
  border: none;
  padding: 16px 20px;
  font-weight: 500;
  box-shadow: var(--admin-shadow-sm);
}

.admin-site .alert-success {
  background-color: hsl(142, 70%, 94%);
  color: hsl(142, 76%, 22%);
}

.admin-site .alert-danger {
  background-color: hsl(0, 84%, 96%);
  color: hsl(0, 74%, 28%);
}

/* Utility preserved */
.preserve-whitespace {
  white-space: pre-wrap;
}

.preserve-lines {
  white-space: pre-line;
}

table code {
  white-space: nowrap;
}

.sticky-form-actions {
  position: sticky;
  bottom: 1rem;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--admin-border-color);
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: var(--admin-shadow-lg);
}

.product-admin-thumbnail {
  width: 4rem;
  height: 4rem;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--admin-border-color);
}

/* Responsive Mobile Layout Adjustments */
@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(-260px);
  }
  
  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  .admin-viewport {
    margin-left: 0;
  }
  
  .sidebar-toggle {
    display: flex;
  }
  
  .admin-topbar {
    padding: 0 20px;
  }
  
  .admin-content {
    padding: 20px;
  }
}

/* Login Card Enhancements */
.login-card {
  border: none !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

.login-card-header {
  background-color: var(--admin-sidebar-bg) !important;
  color: #fff !important;
}

.login-brand {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.5px;
}

.login-card .input-group-text {
  border: 1px solid var(--admin-border-color) !important;
  border-radius: 8px 0 0 8px !important;
  color: var(--admin-text-secondary);
}

.login-card .form-control {
  border: 1px solid var(--admin-border-color) !important;
  border-radius: 0 8px 8px 0 !important;
}
