/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:      #FF9900;
  --brand-dark: #e47911;
  --bg:         #fffaf1;
  --surface:    #ffffff;
  --border:     #e8e2d8;
  --text:       #1a1a1a;
  --text-muted: #666;
  --success:    #2e7d32;
  --warning:    #b45309;
  --error:      #c62828;
  --radius:     10px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
}

html { font-size: 16px; }

body {
  font-family: 'Heebo', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ───────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 2px solid var(--brand);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.navbar-logo img { height: 36px; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
}

.navbar-links a {
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}

.navbar-links a:hover { background: var(--bg); color: var(--text); text-decoration: none; }

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--error); color: var(--error); }

/* ── Page wrapper ─────────────────────────────────────────────────────────── */
.page { max-width: 860px; margin: 0 auto; padding: 32px 16px; }

/* ── Auth card (index.html) ───────────────────────────────────────────────── */
.auth-hero {
  text-align: center;
  padding: 60px 16px 32px;
}

.auth-hero h1 {
  font-size: 2rem;
  color: var(--brand-dark);
  margin-bottom: 10px;
}

.auth-hero p { color: var(--text-muted); font-size: 1rem; }

.auth-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 420px;
  margin: 0 auto;
  overflow: hidden;
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 14px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
}

.auth-tab.active {
  color: var(--brand-dark);
  border-bottom-color: var(--brand);
}

.auth-panel { padding: 28px 24px; display: none; }
.auth-panel.active { display: block; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  direction: ltr;
  text-align: left;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}

.form-group select { direction: rtl; text-align: right; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--brand);
  color: #111;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
  padding: 9px 18px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-secondary:hover { border-color: var(--brand); color: var(--brand-dark); }

.btn-danger {
  padding: 9px 18px;
  background: none;
  color: var(--error);
  border: 1px solid var(--error);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

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

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 14px;
  display: none;
}

.alert.visible { display: block; }
.alert-error { background: #fce8e8; color: var(--error); border: 1px solid #f5c6c6; }
.alert-success { background: #e8f5e9; color: var(--success); border: 1px solid #c8e6c9; }

/* ── Dashboard ────────────────────────────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.dashboard-header h1 { font-size: 1.4rem; }

.add-product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.add-product-card h2 { font-size: 1rem; margin-bottom: 14px; }

.add-product-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.add-product-row input {
  flex: 1;
  min-width: 200px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  direction: ltr;
  text-align: left;
  background: var(--bg);
}

.add-product-row input:focus {
  outline: none;
  border-color: var(--brand);
  background: #fff;
}

.btn-add {
  padding: 10px 20px;
  background: var(--brand);
  color: #111;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-add:hover { background: var(--brand-dark); color: #fff; }
.btn-add:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Product list ─────────────────────────────────────────────────────────── */
.products-list { display: flex; flex-direction: column; gap: 12px; }

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s;
}

.product-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.12); }

.product-card.status-FREE { border-right: 4px solid #4caf50; }
.product-card.status-PAID { border-right: 4px solid #ff9800; }
.product-card.status-NO_SHIP { border-right: 4px solid #f44336; }
.product-card.status-UNKNOWN { border-right: 4px solid #9e9e9e; }
.product-card.status-ERROR { border-right: 4px solid #9c27b0; }

.product-info { flex: 1; min-width: 0; }

.product-name {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-name a { color: var(--text); }
.product-name a:hover { color: var(--brand-dark); text-decoration: none; }

.product-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ── Status badge ─────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-FREE    { background: #e8f5e9; color: var(--success); }
.badge-PAID    { background: #fff3e0; color: var(--warning); }
.badge-NO_SHIP { background: #fce8e8; color: var(--error); }
.badge-UNKNOWN { background: #f5f5f5; color: #757575; }
.badge-ERROR   { background: #f3e5f5; color: #6a1b9a; }

/* ── Remove button ────────────────────────────────────────────────────────── */
.btn-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
}

.btn-remove:hover { border-color: var(--error); color: var(--error); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 1rem; }

/* ── Settings ─────────────────────────────────────────────────────────────── */
.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 480px;
}

.settings-card h2 { font-size: 1.1rem; margin-bottom: 20px; }

.danger-zone {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}

.danger-zone h3 { font-size: 0.9rem; color: var(--error); margin-bottom: 8px; }
.danger-zone p  { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }

/* ── Loading spinner ──────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0,0,0,0.15);
  border-top-color: var(--brand-dark);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton loader ──────────────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
  height: 70px;
}

@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar { padding: 0 12px; }
  .navbar-logo span { display: none; }
  .page { padding: 20px 12px; }
  .auth-hero h1 { font-size: 1.5rem; }
  .product-card { flex-wrap: wrap; }
  .add-product-row { flex-direction: column; }
}
