/* Admin Panel Modern Persian Theme */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --sidebar-w: 260px;
}

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

body {
  font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  direction: rtl;
  text-align: right;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.admin-sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: #f1f5f9;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: -2px 0 10px rgba(0,0,0,0.05);
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid #1e293b;
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.2rem;
}

.sidebar-brand-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.sidebar-brand-badge {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: #94a3b8;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background: #1e293b;
  color: #f8fafc;
}

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

.nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #1e293b;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: #64748b;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-x: hidden;
}

.admin-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title-box h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-title-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-user-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.admin-content {
  padding: 2rem;
  flex: 1;
}

/* Cards & Widgets */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.kpi-info h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.kpi-info .kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-main);
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-icon.indigo { background: #e0e7ff; color: #4338ca; }
.kpi-icon.emerald { background: #d1fae5; color: #047857; }
.kpi-icon.amber { background: #fef3c7; color: #b45309; }
.kpi-icon.rose { background: #ffe4e6; color: #be123c; }
.kpi-icon.cyan { background: #cffafe; color: #0e7490; }

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  margin-bottom: 1.75rem;
  overflow: hidden;
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-header h2, .card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.card-body {
  padding: 1.5rem;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.9rem;
}

.admin-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

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

.admin-table tbody tr:hover {
  background-color: #f1f5f9;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: #d97706; }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* Buttons & Inputs */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
}

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

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

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

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

.btn-outline { background: transparent; border-color: var(--border); color: var(--text-main); }
.btn-outline:hover { background: #f1f5f9; }

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 6px;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.4rem;
  color: #334155;
}

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background-color: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.form-check-input {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  max-width: 450px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
}

.page-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.15s;
}

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

.page-item:hover:not(.active):not(.disabled) {
  background: #f1f5f9;
}

.page-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auth Pages */
.auth-page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 1.5rem;
}

.auth-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  padding: 2.25rem;
}

.auth-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--primary);
  color: #fff;
  border-radius: 14px;
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.auth-brand h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.auth-brand p {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-wrapper {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.75rem;
  }
  .admin-header {
    padding: 1rem;
  }
  .admin-content {
    padding: 1rem;
  }
}
