/* =============================================
   admin.css — לוח הניהול
   ============================================= */

.admin-view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

/* -- כותרת עמוד הניהול -- */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.admin-header h2 {
  font-size: 1.6rem;
}

.admin-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* -- כרטיסי סטטיסטיקה -- */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-val {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--brown-dark);
  font-family: 'Playfair Display', serif;
}

/* =============================================
   ADMIN TABS — הזמנות / מוצרים
   ============================================= */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.admin-tab {
  padding: 10px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: 'Heebo', sans-serif;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px; /* מסתיר את הגבול התחתון של .admin-tabs */
  transition: all 0.2s;
  font-weight: 500;
}

.admin-tab.active {
  color: var(--brown-dark);
  border-bottom-color: var(--caramel);
  font-weight: 700;
}

/* תוכן הטאבים */
.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* =============================================
   ORDERS TABLE — טבלת הזמנות
   ============================================= */
.orders-table-wrap {
  overflow-x: auto; /* גלילה אופקית במסכים קטנים */
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.orders-table th {
  text-align: right;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.orders-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.orders-table tr:hover td {
  background: var(--caramel-light);
}

/* -- תגי סטטוס -- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* צבעי סטטוס */
.status-new      { background: #FEF3C7; color: #92400E; }
.status-approved { background: #DBEAFE; color: #1E40AF; }
.status-ready    { background: #D1FAE5; color: #065F46; }
.status-done     { background: #F3F4F6; color: #6B7280; }

/* -- כפתורי פעולה בטבלה -- */
.action-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* אינדיקטור SMS נשלח */
.sms-sent-badge {
  font-size: 0.72rem;
  color: var(--sage);
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 4px;
}

/* הערת הזמנה מתחת לכפתורים */
.admin-order-detail {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* רשימת פריטים בעמודת הפריטים */
.order-items-list {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* =============================================
   PRODUCTS ADMIN — ניהול מוצרים
   ============================================= */
.admin-products-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.products-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.product-admin-card {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.product-admin-emoji {
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--caramel-light);
  border-radius: 8px;
  flex-shrink: 0;
}

.product-admin-info {
  flex: 1;
}

.product-admin-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.product-admin-price {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* -- Toggle Switch (מתג הפעלה/כיבוי) -- */
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: 0.3s;
}

/* העיגול הלבן שזזה */
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  bottom: 3px;
  right: 3px;
  transition: 0.3s;
}

/* כשמופעל — צבע ירוק */
.toggle-switch input:checked + .toggle-slider {
  background: var(--sage);
}

/* כשמופעל — העיגול עובר לצד שמאל */
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(-18px);
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 600px) {
  .admin-stats {
    grid-template-columns: 1fr 1fr;
  }

  .admin-view {
    padding: 1rem;
  }

  .orders-table th,
  .orders-table td {
    padding: 8px;
    font-size: 0.78rem;
  }
}
