/* استایل‌های پنل مدیریت */
:root {
  --admin-bg: #f8f9fa;
  --admin-sidebar: #2c3e50;
  --admin-sidebar-hover: #34495e;
  --admin-text: #2c3e50;
  --admin-text-light: #7f8c8d;
  --admin-border: #e9ecef;
  --admin-success: #27ae60;
  --admin-warning: #f39c12;
  --admin-danger: #e74c3c;
  --admin-info: #3498db;
  --admin-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.admin-body {
  font-family: 'Inter', sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text);
  margin: 0;
  padding: 0;
  direction: rtl;
}

/* صفحه لاگین مدیر */
.admin-login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.admin-login-form {
  background: white;
  padding: 2.5rem;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 400px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo h1 {
  font-family: 'Playfair Display', serif;
  color: #b89446;
  margin: 0;
  font-size: 2.5rem;
}

.login-logo p {
  color: var(--admin-text-light);
  margin: 0.5rem 0 0;
}

.password-hint {
  color: var(--admin-text-light);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: block;
}

/* پنل مدیریت اصلی */
.admin-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  background: white;
  border-bottom: 1px solid var(--admin-border);
  box-shadow: var(--admin-shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.admin-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--admin-text);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.3s;
}

.sidebar-toggle:hover {
  background-color: var(--admin-border);
}

.admin-logo h1 {
  font-size: 1.5rem;
  margin: 0;
  color: var(--admin-text);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-name {
  font-weight: 500;
}

.logout-btn {
  background: var(--admin-danger);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.3s;
}

.logout-btn:hover {
  background: #c0392b;
}

/* بخش اصلی */
.admin-main {
  display: flex;
  flex: 1;
}

/* نوار کناری */
.admin-sidebar {
  width: 250px;
  background: var(--admin-sidebar);
  color: white;
  transition: all 0.3s;
}

.admin-sidebar.collapsed {
  width: 70px;
}

.admin-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-nav li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-nav-link {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  color: white;
  text-decoration: none;
  transition: background-color 0.3s;
  position: relative;
}

.admin-nav-link:hover {
  background: var(--admin-sidebar-hover);
}

.admin-nav-link.active {
  background: var(--admin-sidebar-hover);
  border-right: 3px solid #b89446;
}

.admin-nav-link i {
  margin-left: 0.75rem;
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.admin-sidebar.collapsed .admin-nav-link span {
  display: none;
}

.order-badge,
.reservation-badge {
  background: var(--admin-danger);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  margin-left: auto;
}

/* محتوای پنل */
.admin-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
}

.admin-section {
  display: none;
}

.admin-section.active {
  display: block;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  margin: 0;
  color: var(--admin-text);
  font-size: 1.75rem;
}

.date-display {
  color: var(--admin-text-light);
  font-size: 0.9rem;
}

.add-btn {
  background: var(--admin-success);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.3s;
}

.add-btn:hover {
  background: #219653;
}

/* کارت‌های آمار */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--admin-shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.stat-icon.revenue { background: var(--admin-success); }
.stat-icon.orders { background: var(--admin-info); }
.stat-icon.customers { background: var(--admin-warning); }
.stat-icon.menu { background: var(--admin-danger); }

.stat-info h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--admin-text-light);
  font-weight: 500;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  color: var(--admin-text);
}

.stat-number span {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--admin-text-light);
}

.stat-change {
  font-size: 0.8rem;
  margin: 0.25rem 0 0;
}

.stat-change.positive {
  color: var(--admin-success);
}

.stat-change.negative {
  color: var(--admin-danger);
}

/* ویجت‌های داشبورد */
.dashboard-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.widget {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--admin-shadow);
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.widget-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.view-all {
  color: var(--admin-info);
  text-decoration: none;
  font-size: 0.9rem;
}

/* جداول */
.orders-table table,
.products-table table,
.discounts-table table,
.reservations-table table {
  width: 100%;
  border-collapse: collapse;
}

.orders-table th,
.products-table th,
.discounts-table th,
.reservations-table th {
  background: var(--admin-bg);
  padding: 1rem;
  text-align: right;
  font-weight: 600;
  color: var(--admin-text);
  border-bottom: 1px solid var(--admin-border);
}

.orders-table td,
.products-table td,
.discounts-table td,
.reservations-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--admin-border);
}

.orders-table tr:hover,
.products-table tr:hover,
.discounts-table tr:hover,
.reservations-table tr:hover {
  background: #f8f9fa;
}

/* وضعیت‌ها */
.status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.status.preparing {
  background: #fff3cd;
  color: #856404;
}

.status.ready {
  background: #d1ecf1;
  color: #0c5460;
}

.status.delivered {
  background: #d4edda;
  color: #155724;
}

.status.active {
  background: #d4edda;
  color: #155724;
}

.status.inactive {
  background: #f8d7da;
  color: #721c24;
}

.status.pending {
  background: #fff3cd;
  color: #856404;
}

.status.confirmed {
  background: #d1ecf1;
  color: #0c5460;
}

/* دکمه‌های عملیات */
.action-buttons {
  display: flex;
  gap: 0.5rem;
}

.action-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.view-btn { color: var(--admin-info); }
.edit-btn { color: var(--admin-warning); }
.delete-btn { color: var(--admin-danger); }
.print-btn { color: var(--admin-text-light); }

.view-btn:hover { background: #e3f2fd; }
.edit-btn:hover { background: #fff3e0; }
.delete-btn:hover { background: #ffebee; }
.print-btn:hover { background: #f5f5f5; }

/* عملیات سریع */
.action-buttons.quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.action-card {
  background: white;
  border: 2px dashed var(--admin-border);
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.action-card:hover {
  border-color: var(--admin-info);
  transform: translateY(-2px);
}

.action-card i {
  font-size: 2rem;
  color: var(--admin-info);
}

.action-card span {
  font-weight: 500;
  color: var(--admin-text);
}

/* نوار فیلترها */
.filters-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 250px;
}

.search-box input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 0.9rem;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--admin-text-light);
}

.filters-bar select {
  padding: 0.75rem 1rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  background: white;
  color: var(--admin-text);
  min-width: 150px;
}

/* آمار سفارشات */
.orders-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.order-stat {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
  flex: 1;
  box-shadow: var(--admin-shadow);
}

.stat-count {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--admin-info);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--admin-text-light);
}

/* تب‌ها */
.settings-tabs {
  background: white;
  border-radius: 12px;
  box-shadow: var(--admin-shadow);
  overflow: hidden;
}

.tab-buttons {
  display: flex;
  background: var(--admin-bg);
  border-bottom: 1px solid var(--admin-border);
}

.tab-btn {
  background: none;
  border: none;
  padding: 1rem 1.5rem;
  cursor: pointer;
  transition: background-color 0.3s;
  color: var(--admin-text-light);
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--admin-info);
  border-bottom-color: var(--admin-info);
  background: white;
}

.tab-content {
  padding: 1.5rem;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* فرم‌ها */
.settings-form {
  max-width: 500px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--admin-text);
}

.required {
  color: var(--admin-danger);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--admin-info);
}

.form-group small {
  color: var(--admin-text-light);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  display: block;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input {
  width: auto;
}

.theme-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 6px;
  transition: background-color 0.3s;
}

.theme-option:hover {
  background: var(--admin-bg);
}

.working-hours-inputs {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.time-input-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.days-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.5rem;
}

.day-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* مدیریت شعبات */
.branches-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.branch-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--admin-shadow);
  position: relative;
}

.branch-card h4 {
  margin: 0 0 0.5rem;
  color: var(--admin-text);
}

.branch-card p {
  margin: 0.25rem 0;
  color: var(--admin-text-light);
  font-size: 0.9rem;
}

.branch-actions {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* گزارشات */
.reports-widgets {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.report-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--admin-shadow);
}

.report-card.large {
  grid-column: 1 / -1;
}

.report-card h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.chart-placeholder {
  height: 200px;
  background: var(--admin-bg);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--admin-text-light);
}

.chart-placeholder i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.top-products {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.top-product-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--admin-border);
}

.product-name {
  font-weight: 500;
}

.product-sales {
  color: var(--admin-text-light);
  font-size: 0.9rem;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--admin-border);
}

.stat-label {
  color: var(--admin-text-light);
}

.stat-value {
  font-weight: 600;
}

/* مودال */
.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.large {
  max-width: 700px;
}

.modal-content .close-modal {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--admin-text-light);
}

.modal-content h2 {
  padding: 1.5rem 1.5rem 0;
  margin: 0 0 1.5rem;
}

.modal-content form {
  padding: 0 1.5rem 1.5rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

.cancel-btn {
  background: var(--admin-text-light);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.cancel-btn:hover {
  background: #636e72;
}

/* رسپانسیو */
@media (max-width: 768px) {
  .admin-sidebar {
    position: fixed;
    right: -100%;
    top: 0;
    bottom: 0;
    z-index: 99;
    width: 280px;
  }
  
  .admin-sidebar.active {
    right: 0;
  }
  
  .admin-content {
    padding: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-widgets {
    grid-template-columns: 1fr;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .filters-bar {
    flex-direction: column;
  }
  
  .search-box {
    min-width: auto;
  }
  
  .orders-stats {
    flex-direction: column;
  }
  
  .reports-widgets {
    grid-template-columns: 1fr;
  }
  
  .tab-buttons {
    flex-wrap: wrap;
  }
  
  .tab-btn {
    flex: 1;
    min-width: 120px;
  }
}