:root {
  --sidebar-width: 260px;
  --header-height: 64px;
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #1e293b;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-sidebar: #e2e8f0;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --radius: 12px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

body.admin-body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-sidebar);
  cursor: pointer;
  padding: 4px;
}

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

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-light);
  text-decoration: none;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
}

.sidebar-nav .nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-nav .nav-item.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.sidebar-nav .nav-item svg {
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-nav .nav-item.active svg {
  opacity: 1;
}

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

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

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 16px;
}

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

.user-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.user-role {
  color: var(--text-light);
  font-size: 12px;
}

.logout-btn {
  color: var(--text-light);
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

/* Main Content */
.admin-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  margin-right: 16px;
  border-radius: 8px;
}

.menu-toggle:hover {
  background: var(--bg);
}

.breadcrumb-wrapper {
  flex: 1;
}

.breadcrumb {
  margin: 0;
  padding: 0;
  background: none;
}

.breadcrumb-item a {
  color: var(--text-muted);
  text-decoration: none;
}

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

.breadcrumb-item.active {
  color: var(--text);
}

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

/* Cards & Containers */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

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

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.card-body {
  padding: 24px;
}

/* Tables */
.table {
  color: var(--text);
  margin-bottom: 0;
}

.table thead th {
  background: var(--bg);
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
}

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

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

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

/* Forms */
.form-section {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.form-section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.form-section-hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: -8px 0 16px 0;
}

.form-label {
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
  font-size: 14px;
}

.form-control,
.form-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  transition: all 0.2s;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-light);
}

.form-actions {
  display: flex;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: var(--radius);
  padding: 10px 20px;
  font-size: 14px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

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

.btn-secondary {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text);
}

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

.btn-success:hover {
  background: #059669;
  color: #fff;
}

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

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
}

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

.btn-info {
  background: #0ea5e9;
  border: none;
  color: #fff;
}

.btn-info:hover {
  background: #0284c7;
  color: #fff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

/* Alerts */
.alert {
  border-radius: var(--radius);
  border: none;
  padding: 16px 20px;
  font-weight: 500;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
}

.alert-info {
  background: #e0f2fe;
  color: #075985;
}

/* Badges */
.badge {
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.badge-success, .badge.bg-success {
  background: #d1fae5 !important;
  color: #065f46 !important;
}

.badge-danger, .badge.bg-danger {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

.badge-warning, .badge.bg-warning {
  background: #fef3c7 !important;
  color: #92400e !important;
}

.badge-info, .badge.bg-info {
  background: #e0f2fe !important;
  color: #075985 !important;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.stat-card .stat-icon.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-card .stat-icon.success { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.stat-card .stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-card .stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

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

/* Metrics */
.metrics-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.metric-card .label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.metric-card .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
}

/* Login */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-wrapper .card {
  max-width: 400px;
  width: 100%;
}

/* Overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

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

/* Grid View */
.grid-view {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.grid-view .summary {
  padding: 16px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 14px;
}

.grid-view .table-responsive {
  margin: 0;
}

.grid-view .pagination {
  padding: 16px 20px;
  margin: 0;
  border-top: 1px solid var(--border);
  justify-content: center;
}

.page-link {
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  margin: 0 2px;
  border-radius: 8px;
}

.page-link:hover {
  background: var(--bg);
  color: var(--primary);
}

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

/* Responsive */
@media (max-width: 991.98px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  
  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  .admin-content {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .content-main {
    padding: 16px;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .page-actions {
    width: 100%;
  }
  
  .page-actions .btn {
    flex: 1;
    justify-content: center;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Legacy support */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.grid-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.grid-heading .title {
  font-size: 24px;
  font-weight: 700;
}

.grid-heading .actions {
  display: flex;
  gap: 12px;
}
