/* ========================================
   VARIABLES & RESET
======================================== */
:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --secondary: #6b7280;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;

  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-hover: #1e293b;

  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border: #e2e8f0;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);

  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #1e293b;
  --sidebar-bg: #020617;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --primary-light: #1e3a5f;
  --success-light: #064e3b;
  --danger-light: #450a0a;
  --warning-light: #451a03;
  --purple-light: #2e1065;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: "Vazirmatn", "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  transition: var(--transition);
  overflow-x: hidden;
}

/* ========================================
   LOGIN PAGE
======================================== */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 16px;
}

.login-container {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow-xl);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 26px;
  color: white;
  box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
}

.login-logo h1 {
  color: white;
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-logo p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

.app-body .form-group label {
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i:first-child {
  position: absolute;
  right: 14px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 14px;
  pointer-events: none;
}

.input-wrapper input {
  width: 100%;
  padding: 12px 44px 12px 44px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: white;
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  transition: var(--transition);
  direction: ltr;
  text-align: left;
  -webkit-appearance: none;
}

.input-wrapper input:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.toggle-pass {
  position: absolute;
  left: 14px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
  font-size: 14px;
}

.login-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

/* ========================================
   BUTTONS
======================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.full-width {
  width: 100%;
  padding: 14px;
  font-size: 15px;
  border-radius: 12px;
  margin-top: 8px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
  background: var(--border);
  transform: translateY(-1px);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--danger);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.btn-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-icon.danger:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ========================================
   APP LAYOUT
======================================== */
.app-body {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-primary);
  position: relative;
}

/* ========================================
   SIDEBAR
======================================== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 200;
  transition: var(--transition);
  box-shadow: -2px 0 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar.collapsed .logo span,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-divider span,
.sidebar.collapsed .user-details,
.sidebar.collapsed .sidebar-cat-item span {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}

/* موبایل - سایدبار مخفی */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
    width: var(--sidebar-width) !important;
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.5);
  }
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  white-space: nowrap;
}

.logo i {
  font-size: 20px;
  color: #3b82f6;
  min-width: 20px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  font-size: 16px;
  transition: var(--transition);
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar {
  width: 3px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.nav-item i {
  font-size: 16px;
  min-width: 20px;
  text-align: center;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: white;
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2),
    rgba(59, 130, 246, 0.1)
  );
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.nav-divider {
  padding: 14px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.25);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-cat-item:hover {
  background: var(--sidebar-hover);
  color: white;
}
.sidebar-cat-item.active {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.1);
}

.sidebar-cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  min-width: 8px;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  gap: 8px;
  min-height: 68px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
}

.user-name {
  color: white;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-status {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.user-status.online {
  color: #10b981;
}

.user-status.online i {
  font-size: 7px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.btn-logout {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  border: none;
  color: #ef4444;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 15px;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ========================================
   MAIN CONTENT
======================================== */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  min-height: 100dvh;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-content.expanded {
  margin-right: var(--sidebar-collapsed);
}

@media (max-width: 768px) {
  .main-content {
    margin-right: 0 !important;
    width: 100%;
  }
}

/* ========================================
   TOPBAR
======================================== */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  min-width: 36px;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

.page-title {
  min-width: 0;
  overflow: hidden;
}

.page-title h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-title span {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* جستجو */
.global-search {
  position: relative;
  display: flex;
  align-items: center;
}

.global-search > i {
  position: absolute;
  right: 11px;
  color: var(--text-muted);
  font-size: 13px;
  pointer-events: none;
  z-index: 1;
}

.global-search input {
  width: 220px;
  padding: 9px 36px 9px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: "Vazirmatn", sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  transition: var(--transition);
  -webkit-appearance: none;
}

.global-search input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  width: 260px;
}

@media (max-width: 480px) {
  .global-search input {
    width: 140px;
  }
  .global-search input:focus {
    width: 160px;
  }
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  z-index: 300;
  max-height: 360px;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .search-dropdown {
    width: calc(100vw - 32px);
    right: auto;
    left: -60px;
  }
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
  border-bottom: none;
}
.search-result-item:hover {
  background: var(--bg-tertiary);
}

.theme-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.online-users {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--success-light);
  color: var(--success);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: default;
}

@media (max-width: 480px) {
  .online-users span {
    display: none;
  }
  .online-users {
    padding: 8px 10px;
  }
}

/* ========================================
   CONTENT WRAPPER
======================================== */
.content-wrapper {
  flex: 1;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

@media (min-width: 768px) {
  .content-wrapper {
    padding: 24px;
  }
}

/* ========================================
   OVERLAY موبایل
======================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
  display: block;
}

/* ========================================
   STATS
======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

.stat-card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}

.stat-card.blue::before {
  background: var(--primary);
}
.stat-card.green::before {
  background: var(--success);
}
.stat-card.red::before {
  background: var(--danger);
}
.stat-card.purple::before {
  background: var(--purple);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.stat-card.blue .stat-icon {
  background: var(--primary-light);
  color: var(--primary);
}
.stat-card.green .stat-icon {
  background: var(--success-light);
  color: var(--success);
}
.stat-card.red .stat-icon {
  background: var(--danger-light);
  color: var(--danger);
}
.stat-card.purple .stat-icon {
  background: var(--purple-light);
  color: var(--purple);
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-number {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
}

/* ========================================
   SECTION HEADERS
======================================== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.section-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header h3 i {
  color: var(--primary);
}

/* ========================================
   CATEGORIES GRID
======================================== */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 480px) {
  .categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .categories-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 1024px) {
  .categories-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.category-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--cat-color, var(--primary));
}

.cat-icon-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.cat-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.cat-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.cat-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.cat-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
}

.cat-stat.available {
  background: var(--success-light);
  color: var(--success);
}
.cat-stat.unavailable {
  background: var(--danger-light);
  color: var(--danger);
}
.cat-stat.total {
  background: var(--primary-light);
  color: var(--primary);
}

/* ========================================
   ACTIVITY LIST
======================================== */
.activity-list {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.activity-item:last-child {
  border-bottom: none;
}
.activity-item:hover {
  background: var(--bg-tertiary);
}

.activity-icon {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.activity-content {
  flex: 1;
  min-width: 0;
}

.activity-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.activity-product {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.activity-badge {
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.activity-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.activity-meta i {
  margin-left: 3px;
}

.log-changes {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.log-change-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  flex-wrap: wrap;
}

.log-change-field {
  color: var(--text-secondary);
  font-weight: 600;
  min-width: 100px;
}

.log-change-old {
  color: var(--danger);
  text-decoration: line-through;
  opacity: 0.8;
}

.log-change-new {
  color: var(--success);
  font-weight: 600;
}

.log-change-diff {
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11px;
}

.log-change-diff.positive {
  background: var(--success-light);
  color: var(--success);
}
.log-change-diff.negative {
  background: var(--danger-light);
  color: var(--danger);
}

/* ========================================
   CATEGORY HERO
======================================== */
.category-hero {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.category-hero-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.category-hero-icon {
  width: 52px;
  height: 52px;
  min-width: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.category-hero-info h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-hero-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.category-hero-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 600px) {
  .category-hero {
    flex-direction: column;
  }
  .category-hero-actions {
    width: 100%;
  }
  .category-hero-actions .btn-secondary,
  .category-hero-actions .btn-danger {
    flex: 1;
    font-size: 13px;
    padding: 9px 12px;
  }
}

/* ========================================
   TABLE CONTROLS
======================================== */
.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.table-controls-right,
.table-controls-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .table-controls {
    padding: 10px 12px;
  }
  .table-controls-right,
  .table-controls-left {
    width: 100%;
  }
  .table-controls-right .btn-primary,
  .table-controls-right .btn-secondary {
    flex: 1;
    font-size: 13px;
  }
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.sort-control select {
  padding: 7px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "Vazirmatn", sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  -webkit-appearance: none;
  max-width: 150px;
}

.sort-dir-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sort-dir-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-btn {
  padding: 7px 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

.view-btn.active {
  background: var(--primary);
  color: white;
}

/* ========================================
   TABLE - ریسپانسیو کامل
======================================== */
.table-container {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  /* اسکرول افقی روی موبایل */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.products-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px; /* حداقل عرض برای اسکرول */
}

.products-table thead {
  background: var(--bg-tertiary);
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.products-table th {
  padding: 12px 14px;
  text-align: right;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
  user-select: none;
}

.products-table th.sortable {
  cursor: pointer;
  transition: var(--transition);
}
.products-table th.sortable:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.th-content {
  display: flex;
  align-items: center;
  gap: 6px;
}

.products-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
  white-space: nowrap;
}

.products-table tbody tr {
  transition: var(--transition);
}
.products-table tbody tr:last-child td {
  border-bottom: none;
}
.products-table tbody tr:hover {
  background: var(--bg-tertiary);
}

.product-id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  font-family: monospace;
  padding: 0 6px;
}

.availability-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: "Vazirmatn", sans-serif;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.availability-badge.available {
  background: var(--success-light);
  color: var(--success);
}
.availability-badge.unavailable {
  background: var(--danger-light);
  color: var(--danger);
}
.availability-badge:hover {
  transform: scale(1.05);
}

.quantity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 26px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  padding: 0 8px;
}

.quantity-badge.zero {
  background: var(--danger-light);
  color: var(--danger);
}
.quantity-badge.low {
  background: var(--warning-light);
  color: var(--warning);
}
.quantity-badge.good {
  background: var(--success-light);
  color: var(--success);
}

.table-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.table-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 50px 20px;
  gap: 12px;
}

.table-empty i {
  font-size: 44px;
  color: var(--text-muted);
  opacity: 0.4;
}
.table-empty p {
  font-size: 15px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ========================================
   CARD VIEW - ریسپانسیو
======================================== */
.cards-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 480px) {
  .cards-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .cards-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .cards-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1280px) {
  .cards-container {
    grid-template-columns: repeat(4, 1fr);
  }
}

.product-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-card-id {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  font-family: monospace;
}

.product-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.product-card-fields {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.product-card-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  gap: 8px;
}

.product-card-field .field-label {
  color: var(--text-muted);
  flex-shrink: 0;
}
.product-card-field .field-value {
  color: var(--text-primary);
  font-weight: 500;
  text-align: left;
  word-break: break-word;
}

.product-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ========================================
   MODALS - ریسپانسیو کامل
======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  padding: 0;
  animation: fadeIn 0.2s ease;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--bg-secondary);
  width: 100%;
  max-width: 100%;
  max-height: 92vh;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  border-radius: 20px 20px 0 0;
  animation: slideUpMobile 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

@media (min-width: 640px) {
  .modal {
    max-width: 500px;
    border-radius: var(--radius-lg);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .modal.modal-large {
    max-width: 680px;
  }
  .modal.modal-small {
    max-width: 360px;
  }
}

@keyframes slideUpMobile {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* دستگیره موبایل */
.modal::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .modal::before {
    display: none;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-header h3 i {
  color: var(--primary);
}
.modal-header.danger h3 i {
  color: var(--danger);
}

.modal-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .modal-footer {
    flex-direction: column-reverse;
  }
  .modal-footer .btn-primary,
  .modal-footer .btn-secondary,
  .modal-footer .btn-danger {
    width: 100%;
    justify-content: center;
  }
}

/* ========================================
   FORM ELEMENTS
======================================== */
.modal .form-group {
  margin-bottom: 16px;
}

.modal .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required {
  color: var(--danger);
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="email"],
.modal input[type="url"],
.modal textarea,
.modal select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  transition: var(--transition);
  -webkit-appearance: none;
}

.modal input:focus,
.modal textarea:focus,
.modal select:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal textarea {
  resize: vertical;
  min-height: 80px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

@media (min-width: 480px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.col-span-2 {
  grid-column: 1 / -1;
}

.form-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.flex-1 {
  flex: 1;
  min-width: 120px;
}

/* ========================================
   ICON & COLOR PICKERS
======================================== */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.icon-option {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.icon-option:hover,
.icon-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.color-option {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.color-option:hover,
.color-option.selected {
  border-color: var(--text-primary);
  transform: scale(1.2);
}

/* ========================================
   FIELDS SECTION
======================================== */
.fields-section {
  margin-bottom: 20px;
}

.fields-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.add-field-section {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 16px;
}

.add-field-section h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ========================================
   AVAILABILITY TOGGLE
======================================== */
.toggle-field {
  margin-top: 4px;
}

.availability-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid;
  font-family: "Vazirmatn", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  width: 100%;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.availability-toggle.available {
  background: var(--success-light);
  color: var(--success);
  border-color: var(--success);
}

.availability-toggle.unavailable {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

/* ========================================
   DRAG AND DROP FIELDS
======================================== */
.all-fields-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.field-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  touch-action: none;
}

.field-item.custom {
  cursor: grab;
}
.field-item.custom:active {
  cursor: grabbing;
}
.field-item.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.field-item.locked {
  opacity: 0.55;
}

.drag-handle {
  color: var(--text-muted);
  cursor: grab;
  padding: 4px;
  font-size: 14px;
  min-width: 20px;
  display: flex;
  align-items: center;
}

.field-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.field-type-badge {
  padding: 3px 8px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.fields-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  color: var(--text-muted);
  font-size: 11px;
}

.fields-divider::before,
.fields-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.drag-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 10px;
}

/* ========================================
   PERCENT & PRICE FIELDS
======================================== */
.percent-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.percent-input-wrapper input {
  padding-left: 36px !important;
}

.percent-symbol {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 14px;
  pointer-events: none;
}

.percent-bar-wrapper {
  position: relative;
  height: 22px;
  background: var(--bg-tertiary);
  border-radius: 11px;
  overflow: hidden;
  min-width: 70px;
  border: 1px solid var(--border);
}

.percent-bar {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  border-radius: 11px;
  transition: width 0.3s ease;
}

.percent-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: white;
  mix-blend-mode: difference;
}

.price-value {
  font-weight: 700;
  color: var(--primary);
  direction: ltr;
  display: inline-block;
}

.price-value::after {
  content: " ت";
  font-size: 11px;
  color: var(--text-muted);
}

.price-preview {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ========================================
   TOAST
======================================== */
.toast-container {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: calc(100vw - 32px);
}

@media (min-width: 480px) {
  .toast-container {
    max-width: 380px;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  animation: toastIn 0.3s ease;
  border-right: 4px solid;
}

@keyframes toastIn {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}
.toast.success {
  border-right-color: var(--success);
}
.toast.error {
  border-right-color: var(--danger);
}
.toast.info {
  border-right-color: var(--primary);
}
.toast.warning {
  border-right-color: var(--warning);
}

.toast-icon {
  font-size: 17px;
  flex-shrink: 0;
}
.toast.success .toast-icon {
  color: var(--success);
}
.toast.error .toast-icon {
  color: var(--danger);
}
.toast.info .toast-icon {
  color: var(--primary);
}
.toast.warning .toast-icon {
  color: var(--warning);
}

.toast-message {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 4px;
  transition: var(--transition);
  flex-shrink: 0;
}

/* ========================================
   AUTH MESSAGE
======================================== */
.auth-message {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-message.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.auth-message.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ========================================
   SCROLLBAR
======================================== */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   UTILITY
======================================== */
.hidden {
  display: none !important;
}
