/* ==========================================================================
   TheFutureDevs Ecom - Dashboard Stylesheet
   Dark-First Design System | v2.0.0
   Covers: Admin/Mainportal, Vendor, Affiliator, Customer dashboards
   ========================================================================== */

/* ==========================================================================
   1. Dashboard Design Tokens (Glassmorphism & Layout)
   ========================================================================== */

:root {
  --sidebar-width: 260px;
  --navbar-height: 72px;
  --glass-blur: 16px;
  --glass-bg: rgba(20, 20, 42, 0.6);
  --glass-border: rgba(42, 42, 74, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --surface-hover: rgba(255, 255, 255, 0.04);
  --text-secondary: #94a3b8;
  --border-light: rgba(42, 42, 74, 0.4);
  --radius-round: 50%;
  --z-overlay: 250;
}

[data-theme='light'] {
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(226, 232, 240, 0.5);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  --surface-hover: rgba(0, 0, 0, 0.04);
  --text-secondary: #64748b;
  --border-light: rgba(0, 0, 0, 0.06);
}

/* ==========================================================================
   2. Dashboard Layout
   ========================================================================== */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.dashboard-body {
  display: flex;
  flex: 1;
  padding-top: var(--navbar-height);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  transition: margin-left var(--transition);
  min-width: 0;
}

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

.page-wrapper {
  max-width: 1400px;
  margin: 0 auto;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.page-description {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

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

.page-actions .btn {
  white-space: nowrap;
}

/* ==========================================================================
   3. Glass Sidebar
   ========================================================================== */

.sidebar {
  position: fixed;
  left: 0;
  top: var(--navbar-height);
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--glass-border);
  z-index: var(--z-sticky);
  transition: width var(--transition), transform var(--transition);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}

.sidebar-brand img,
.sidebar-brand i {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.sidebar-brand span {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-close {
  display: none;
  position: absolute;
  right: 12px;
  top: 12px;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
}

.sidebar-close:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.sidebar-section {
  padding: 8px 20px 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border-radius: 0;
  position: relative;
}

.sidebar-link:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-link .badge {
  margin-left: auto;
  font-size: 0.65rem;
  padding: 2px 8px;
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary);
  border-radius: var(--radius-full);
  font-weight: 700;
}

.sidebar-link.text-danger {
  color: var(--danger);
}

.sidebar-link.text-danger:hover {
  background: rgba(var(--danger-rgb), 0.1);
}

.sidebar-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 8px 20px;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  flex-shrink: 0;
}

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

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  background: var(--glass-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  flex-shrink: 0;
  border: 1px solid var(--glass-border);
}

.sidebar-user-info {
  flex: 1;
  overflow: hidden;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sidebar Collapsed */

.sidebar-collapsed .sidebar {
  width: 64px;
}

.sidebar-collapsed .sidebar .sidebar-link span,
.sidebar-collapsed .sidebar .sidebar-section,
.sidebar-collapsed .sidebar .sidebar-divider,
.sidebar-collapsed .sidebar .sidebar-footer,
.sidebar-collapsed .sidebar .sidebar-brand span,
.sidebar-collapsed .sidebar .sidebar-link .badge {
  display: none;
}

.sidebar-collapsed .sidebar .sidebar-link {
  justify-content: center;
  padding: 12px;
}

.sidebar-collapsed .sidebar .sidebar-header {
  padding: 12px;
  display: flex;
  justify-content: center;
}

.sidebar-collapsed .sidebar .sidebar-brand i,
.sidebar-collapsed .sidebar .sidebar-link i {
  margin: 0;
}

.sidebar-collapsed .main-content {
  margin-left: 64px;
}

/* ==========================================================================
   4. Topbar
   ========================================================================== */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--navbar-height);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  z-index: var(--z-fixed);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  transition: background var(--transition);
}

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

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.topbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-brand i {
  color: var(--primary);
}

.topbar-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar-search {
  position: relative;
  max-width: 400px;
  width: 100%;
}

.topbar-search input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text);
  font-size: 0.875rem;
  transition: all var(--transition);
  outline: none;
  font-family: var(--font);
}

.topbar-search input::placeholder {
  color: var(--text-muted);
}

.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.topbar-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.875rem;
  pointer-events: none;
}

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

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

.topbar-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.topbar-btn .notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  background: var(--danger);
  border: 2px solid var(--bg);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.topbar-user:hover {
  background: var(--surface-hover);
  border-color: var(--glass-border);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.topbar-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

/* ==========================================================================
   5. Dashboard Stats Cards
   ========================================================================== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  transition: all var(--transition);
}

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

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  flex-shrink: 0;
}

.stat-card-icon.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.stat-card-icon.success {
  background: linear-gradient(135deg, var(--success), #34d399);
}

.stat-card-icon.warning {
  background: linear-gradient(135deg, var(--warning), #fbbf24);
}

.stat-card-icon.danger {
  background: linear-gradient(135deg, var(--danger), #f87171);
}

.stat-card-icon.info {
  background: linear-gradient(135deg, var(--info), #60a5fa);
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.stat-card-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-card-change.up {
  color: var(--success);
  background: rgba(var(--success-rgb), 0.1);
}

.stat-card-change.down {
  color: var(--danger);
  background: rgba(var(--danger-rgb), 0.1);
}

/* ==========================================================================
   6. Data Tables
   ========================================================================== */

.table-container {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  margin-bottom: 24px;
}

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

.table-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

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

.table-search {
  position: relative;
}

.table-search input {
  padding: 6px 12px 6px 32px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  width: 200px;
  outline: none;
  font-family: var(--font);
  transition: border-color var(--transition);
}

.table-search input::placeholder {
  color: var(--text-muted);
}

.table-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.table-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.8rem;
  pointer-events: none;
}

.table-responsive {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--bg-secondary);
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

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

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

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

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

.table .user-cell .avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-round);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

.table .user-cell .avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-round);
  object-fit: cover;
}

.table .user-cell .name {
  font-weight: 500;
  font-size: 0.875rem;
}

.table .user-cell .email {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.table-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.table-status.active {
  background: rgba(var(--success-rgb), 0.1);
  color: var(--success);
}

.table-status.pending {
  background: rgba(var(--warning-rgb), 0.1);
  color: var(--warning);
}

.table-status.suspended,
.table-status.inactive {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
}

.table-status.completed {
  background: rgba(var(--success-rgb), 0.1);
  color: var(--success);
}

.table-status.processing {
  background: rgba(var(--info-rgb), 0.1);
  color: var(--info);
}

.table-status.draft {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.table-actions-cell {
  display: flex;
  gap: 6px;
}

.table-actions-cell .btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.table-actions-cell .btn-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

.table .amount {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px;
}

.pagination .page-item {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

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

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

.pagination .page-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   7. Dashboard Cards (Generic)
   ========================================================================== */

.dashboard-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  transition: all var(--transition);
  margin-bottom: 24px;
}

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

.dashboard-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.dashboard-card-body {
  padding: 24px;
}

.dashboard-card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.dashboard-card-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.dashboard-card-empty i {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.dashboard-card-empty p {
  font-size: 0.9rem;
  margin: 0;
}

/* ==========================================================================
   8. Dashboard Charts & Analytics
   ========================================================================== */

.chart-container {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--glass-shadow);
  margin-bottom: 24px;
}

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

.chart-header h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.chart-body {
  position: relative;
  min-height: 300px;
}

.chart-placeholder {
  width: 100%;
  height: 280px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  padding: 20px;
}

.chart-bar {
  width: 32px;
  background: linear-gradient(to top, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--transition-slow);
  min-height: 4px;
}

.chart-bar:nth-child(2n) {
  background: linear-gradient(to top, var(--secondary), var(--secondary-light));
}

.chart-bar:nth-child(3n) {
  background: linear-gradient(to top, var(--success), #34d399);
}

/* ==========================================================================
   9. Dashboard Widgets
   ========================================================================== */

.widget {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.widget-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.widget-header h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.widget-header .widget-link {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.widget-header .widget-link:hover {
  text-decoration: underline;
}

.widget-body {
  padding: 20px;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-round);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
}

.activity-icon.primary {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

.activity-icon.success {
  background: rgba(var(--success-rgb), 0.1);
  color: var(--success);
}

.activity-icon.danger {
  background: rgba(var(--danger-rgb), 0.1);
  color: var(--danger);
}

.activity-icon.warning {
  background: rgba(var(--warning-rgb), 0.1);
  color: var(--warning);
}

.activity-icon.info {
  background: rgba(var(--info-rgb), 0.1);
  color: var(--info);
}

.activity-content {
  flex: 1;
}

.activity-text {
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.4;
}

.activity-text strong {
  font-weight: 600;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   10. Admin Form Styles
   ========================================================================== */

.form-card {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--glass-shadow);
  margin-bottom: 24px;
}

.form-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

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

.form-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.form-card .form-group:last-child {
  margin-bottom: 0;
}

/* Image Upload within forms */

.image-upload {
  border: 2px dashed var(--glass-border); border-radius: var(--radius);
  padding: 32px; text-align: center; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.image-upload:hover { border-color: var(--primary); background: rgba(var(--primary-rgb), 0.03); }
.image-upload .upload-icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 12px; }
.image-upload p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.image-upload .upload-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 8px; }

.image-preview { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.image-preview-item { width: 100px; height: 100px; border-radius: var(--radius); overflow: hidden; position: relative; border: 1px solid var(--glass-border); }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: var(--radius-round);
  font-size: 0.75rem; cursor: pointer; opacity: 0; transition: opacity var(--transition);
}
.image-preview-item:hover .remove-btn { opacity: 1; }

/* ==========================================================================
   11. Vendor Dashboard Specific
   ========================================================================== */

.vendor-level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--secondary-rgb), 0.1));
  color: var(--primary);
}

.vendor-level i {
  font-size: 0.8rem;
}

.product-card-dash {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  margin-bottom: 12px;
}

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

.product-card-dash-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.product-card-dash-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-dash-image .placeholder-icon {
  font-size: 1.5rem;
  color: var(--text-muted);
}

.product-card-dash-body {
  flex: 1;
  min-width: 0;
}

.product-card-dash-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-card-dash-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.product-card-dash-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-shrink: 0;
}

.earnings-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.earnings-item { text-align: center; padding: 20px; background: var(--card-bg); backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.earnings-item .amount { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.earnings-item .label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ==========================================================================
   12. Affiliator Dashboard Specific
   ========================================================================== */

.referral-link-box { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--bg-secondary); border: 1px solid var(--glass-border); border-radius: var(--radius); font-size: 0.85rem; font-family: var(--font-mono); }
.referral-link-box .link-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--primary); }
.referral-link-box .copy-btn { flex-shrink: 0; padding: 4px 12px; border-radius: var(--radius-sm); background: rgba(var(--primary-rgb),0.1); color: var(--primary); border: none; font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all var(--transition); font-family: var(--font); }
.referral-link-box .copy-btn:hover { background: var(--primary); color: #fff; }

.commission-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.commission-item:last-child { border-bottom: none; }
.commission-amount { font-weight: 700; color: var(--success); font-size: 1rem; }
.commission-rate { font-size: 0.8rem; color: var(--text-muted); }
.commission-info { flex: 1; }
.commission-source { font-size: 0.875rem; font-weight: 500; }
.commission-date { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.affiliate-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { text-align: center; padding: 20px 16px; background: var(--card-bg); backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-md); }
.metric-card .metric-value { font-size: 1.5rem; font-weight: 800; color: var(--text); }
.metric-card .metric-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.metric-card .metric-change { font-size: 0.7rem; font-weight: 600; margin-top: 4px; }
.metric-card .metric-change.up { color: var(--success); }
.metric-card .metric-change.down { color: var(--danger); }

/* ==========================================================================
   13. Customer Dashboard Specific
   ========================================================================== */

.bottom-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; height: 64px; background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); border-top: 1px solid var(--glass-border); z-index: var(--z-fixed); padding: 0 8px; }
.bottom-nav-inner { display: flex; align-items: center; justify-content: space-around; height: 100%; max-width: 600px; margin: 0 auto; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--text-muted); font-size: 0.65rem; padding: 4px 12px; border-radius: var(--radius); transition: all var(--transition); position: relative; }
.bottom-nav-item i { font-size: 1.2rem; }
.bottom-nav-item:hover { color: var(--text); }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item .badge { position: absolute; top: 0; right: 4px; font-size: 0.6rem; padding: 1px 5px; background: var(--danger); color: #fff; border-radius: var(--radius-full); font-weight: 700; min-width: 16px; text-align: center; line-height: 1.4; }

.order-card-customer { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--card-bg); backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-md); margin-bottom: 12px; transition: all var(--transition); }
.order-card-customer:hover { box-shadow: var(--shadow-md); }
.order-card-customer .order-icon { width: 44px; height: 44px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; background: rgba(var(--primary-rgb),0.1); color: var(--primary); }
.order-card-customer .order-info { flex: 1; }
.order-card-customer .order-info h4 { font-size: 0.95rem; font-weight: 600; margin: 0 0 4px; }
.order-card-customer .order-info p { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.order-card-customer .order-amount { font-weight: 700; font-size: 1rem; text-align: right; }

/* ==========================================================================
   14. Level / Badge Display
   ========================================================================== */

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.level-badge i {
  font-size: 0.9rem;
}

.level-badge.bronze {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: white;
}

.level-badge.silver {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #333;
}

.level-badge.gold {
  background: linear-gradient(135deg, #ffd700, #ffa500);
  color: #333;
}

.level-badge.platinum {
  background: linear-gradient(135deg, #e5e4e2, #b0b0b0);
  color: #333;
}

/* ==========================================================================
   15. Deployment Status
   ========================================================================== */

.deployment-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.deployment-status .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
}

.deployment-status .dot.deployed {
  background: var(--success);
}

.deployment-status .dot.pending {
  background: var(--warning);
}

.deployment-status .dot.failed {
  background: var(--danger);
}

/* ==========================================================================
   16. Grid layouts for dashboard product/order/withdrawal lists
   ========================================================================== */

.orders-list,
.products-list,
.withdrawals-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Withdrawal specific items */

.withdrawal-item { display: flex; align-items: center; gap: 16px; padding: 16px; background: var(--card-bg); backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-md); transition: all var(--transition); }
.withdrawal-item:hover { box-shadow: var(--shadow-md); }
.withdrawal-item .withdrawal-amount { font-weight: 700; font-size: 1rem; font-family: var(--font-mono); min-width: 100px; }
.withdrawal-item .withdrawal-info { flex: 1; }
.withdrawal-item .withdrawal-info .method { font-size: 0.8rem; color: var(--text-muted); }
.withdrawal-item .withdrawal-date { font-size: 0.8rem; color: var(--text-muted); }

/* ==========================================================================
   17. Responsive Media Queries
   ========================================================================== */

/* Desktop responsive */

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
  .topbar-search { max-width: 280px; }
}

@media (max-width: 992px) {
  .sidebar-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: var(--z-overlay);
    opacity: 0; pointer-events: none; transition: opacity var(--transition);
  }
  .sidebar-overlay.active { opacity: 1; pointer-events: auto; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main-content { margin-left: 0; }
  .bottom-nav { display: block; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; justify-content: center; }
  .topbar-center { display: none; }
  .topbar-user-name { display: none; }
  .table-search input { width: 160px; }
  .sidebar-collapsed .sidebar { transform: translateX(-100%); }
  .sidebar-collapsed .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-collapsed .main-content { margin-left: 0; }
}

@media (max-width: 768px) {
  .bottom-nav { display: block; }
  .sidebar { display: none; }
  .sidebar.mobile-open { display: flex; }
  .main-content { margin-left: 0; padding: 20px 16px 80px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card-value { font-size: 1.3rem; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .form-card { padding: 20px; }
  .table-header { flex-direction: column; align-items: stretch; padding: 16px; }
  .table-actions { flex-direction: column; align-items: stretch; }
  .table-search input { width: 100%; }
  .table th, .table td { padding: 10px 12px; }
  .page-title { font-size: 1.25rem; }
  .topbar-search { display: none; }
  .dashboard-card-body, .dashboard-card-header { padding: 16px; }
  .chart-container { padding: 16px; }
  .chart-body { min-height: 200px; }
  .product-card-dash { flex-direction: column; }
  .product-card-dash-image { width: 100%; height: 120px; }
  .pagination { flex-wrap: wrap; }
  .table-container { border-radius: var(--radius); }
}

@media (max-width: 576px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card-icon { width: 38px; height: 38px; font-size: 1rem; }
  .stat-card-value { font-size: 1.2rem; }
  .main-content { padding: 16px 12px 80px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .table th, .table td { padding: 8px 10px; font-size: 0.8rem; }
  .dashboard-card { border-radius: var(--radius); }
  .widget-body { padding: 16px; }
  .form-card { padding: 16px; }
  .referral-link-box { flex-direction: column; align-items: stretch; gap: 8px; }
  .order-card-customer { flex-direction: column; align-items: flex-start; }
  .order-card-customer .order-amount { text-align: left; width: 100%; }
  .withdrawal-item { flex-direction: column; align-items: flex-start; }
  .earnings-summary, .affiliate-metrics { grid-template-columns: 1fr 1fr; }
  .level-badge { font-size: 0.7rem; padding: 4px 12px; }
}

/* ==========================================================================
   18. Animations & Transitions
   ========================================================================== */

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

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

/* Staggered card animations */

.stat-card {
  animation: fadeInUp 0.4s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.05s; }
.stat-card:nth-child(3) { animation-delay: 0.1s; }
.stat-card:nth-child(4) { animation-delay: 0.15s; }
.stat-card:nth-child(5) { animation-delay: 0.2s; }
.stat-card:nth-child(6) { animation-delay: 0.25s; }

.dashboard-card {
  animation: fadeInUp 0.4s ease both;
}

.dashboard-card:nth-child(1) { animation-delay: 0s; }
.dashboard-card:nth-child(2) { animation-delay: 0.05s; }
.dashboard-card:nth-child(3) { animation-delay: 0.1s; }
.dashboard-card:nth-child(4) { animation-delay: 0.15s; }

.chart-container {
  animation: fadeInUp 0.5s ease both;
}

.chart-container:nth-child(1) { animation-delay: 0s; }
.chart-container:nth-child(2) { animation-delay: 0.1s; }

.activity-item {
  animation: fadeIn 0.3s ease both;
}

.activity-item:nth-child(1) { animation-delay: 0s; }
.activity-item:nth-child(2) { animation-delay: 0.05s; }
.activity-item:nth-child(3) { animation-delay: 0.1s; }
.activity-item:nth-child(4) { animation-delay: 0.15s; }
.activity-item:nth-child(5) { animation-delay: 0.2s; }

.table tbody tr {
  animation: fadeIn 0.3s ease both;
}

.table tbody tr:nth-child(1) { animation-delay: 0s; }
.table tbody tr:nth-child(2) { animation-delay: 0.03s; }
.table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.table tbody tr:nth-child(4) { animation-delay: 0.09s; }
.table tbody tr:nth-child(5) { animation-delay: 0.12s; }

.sidebar-link.active::before {
  animation: slideInRight 0.3s ease;
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   19. Print Styles
   ========================================================================== */

@media print {
  .sidebar,
  .topbar,
  .bottom-nav,
  .sidebar-overlay,
  .page-actions,
  .table-actions,
  .table-actions-cell,
  .sidebar-toggle {
    display: none !important;
  }

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

  .dashboard-card,
  .table-container,
  .stat-card,
  .chart-container,
  .widget {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  .table th {
    background: #f5f5f5 !important;
    color: #000 !important;
  }

  .table td {
    color: #000 !important;
  }

  .page-header {
    break-after: avoid;
  }
}

/* ==========================================================================
   20. Utility Classes for Dashboard
   ========================================================================== */

.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.dashboard-grid .full-width { grid-column: 1 / -1; }
.dashboard-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; }
.dashboard-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

@media (max-width: 992px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid-3 { grid-template-columns: 1fr; }
  .dashboard-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 576px) {
  .dashboard-grid-4 { grid-template-columns: 1fr; }
}

/* Loading skeleton */

.skeleton {
  background: linear-gradient(90deg, var(--surface-hover) 25%, rgba(255,255,255,0.08) 50%, var(--surface-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-text { height: 14px; margin-bottom: 8px; width: 100%; }
.skeleton-text.short { width: 60%; }
.skeleton-title { height: 20px; margin-bottom: 12px; width: 40%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: var(--radius-round); }
.skeleton-thumbnail { width: 80px; height: 80px; border-radius: var(--radius); }

/* Dashboard alert / notice banners */

.dashboard-alert {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-radius: var(--radius-md);
  margin-bottom: 20px; font-size: 0.875rem;
}
.dashboard-alert.info { background: rgba(var(--info-rgb),0.1); border: 1px solid rgba(var(--info-rgb),0.2); color: var(--info); }
.dashboard-alert.success { background: rgba(var(--success-rgb),0.1); border: 1px solid rgba(var(--success-rgb),0.2); color: var(--success); }
.dashboard-alert.warning { background: rgba(var(--warning-rgb),0.1); border: 1px solid rgba(var(--warning-rgb),0.2); color: var(--warning); }
.dashboard-alert.danger { background: rgba(var(--danger-rgb),0.1); border: 1px solid rgba(var(--danger-rgb),0.2); color: var(--danger); }
.dashboard-alert i { font-size: 1.2rem; flex-shrink: 0; }
.dashboard-alert p { margin: 0; flex: 1; }
.dashboard-alert .alert-close { background: none; border: none; color: inherit; opacity: 0.6; cursor: pointer; font-size: 1rem; padding: 4px; transition: opacity var(--transition); }
.dashboard-alert .alert-close:hover { opacity: 1; }

/* Sidebar aliases (override style.css for dashboard use) */
.dashboard-layout .sidebar { top: var(--navbar-height); height: calc(100vh - var(--navbar-height)); }
.dashboard-layout .sidebar-overlay.active { display: block; }

/* ==========================================================================
   End of Dashboard Stylesheet
   ========================================================================== */
