/* PIM BiroticShop — stiluri de bază (vanilla CSS, fără framework) */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #dfe3e8;
  --text: #1f2933;
  --muted: #6b7280;
  --primary: #1565c0;
  --primary-dark: #0d47a1;
  --success-bg: #e6f4ea;
  --success-fg: #1e7e34;
  --error-bg: #fdecea;
  --error-fg: #c62828;
  --info-bg: #e8f0fe;
  --info-fg: #1565c0;
  --warn: #f39c12;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

/* ---- Bară superioară ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  box-shadow: var(--shadow);
}
.topbar .brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary-dark);
}
.topbar .brand:hover { text-decoration: none; }
.mainnav { display: flex; gap: 16px; flex: 1; }
.mainnav a { color: var(--text); font-weight: 500; }
.userbox { display: flex; align-items: center; gap: 12px; }
.userbox .user { color: var(--muted); font-size: 0.9rem; }

/* ---- Container ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

h1 { font-size: 1.5rem; margin: 0 0 12px; }
.muted { color: var(--muted); }

/* ---- Mesaje flash ---- */
.flashes { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.flash-success { background: var(--success-bg); color: var(--success-fg); }
.flash-error   { background: var(--error-bg);   color: var(--error-fg); }
.flash-info    { background: var(--info-bg);    color: var(--info-fg); }

/* ---- Butoane ---- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 0.85rem; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-block { width: 100%; }

/* ---- Formulare ---- */
form label {
  display: block;
  margin: 14px 0 4px;
  font-weight: 500;
  font-size: 0.9rem;
}
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="number"],
form textarea,
form select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  background: #fff;
}
form input:focus,
form textarea:focus,
form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

/* ---- Card autentificare ---- */
.auth-card {
  max-width: 380px;
  margin: 8vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.auth-card h1 { text-align: center; }
.auth-card > .muted { text-align: center; margin-top: 0; }
.auth-card form button { margin-top: 20px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 0.9rem; }

/* ---- Cap de pagină cu acțiuni ---- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-title { font-size: 1.05rem; margin: 0 0 16px; }

/* ---- Formular pe orizontală ---- */
.inline-form {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.inline-form .field { flex: 1; min-width: 180px; }
.inline-form .field label { margin-top: 0; }
.inline-form .field-btn { flex: 0; }

/* ---- Tabel de date ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table tbody tr:hover { background: #f7f9fb; }
.data-table td.actions { white-space: nowrap; text-align: right; }
.data-table td.actions form { margin-left: 4px; }
.tree-branch { color: var(--muted); margin-right: 4px; }

/* ---- Buton pericol ---- */
.btn-danger { color: var(--error-fg); border-color: #f0c0bd; }
.btn-danger:hover { background: var(--error-bg); }

/* ---- Grile formular ---- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 20px;
}
.grid-2 .field { margin: 0; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.field { margin-bottom: 4px; }
.req { color: var(--error-fg); }
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-weight: 500;
}
.check input { width: auto; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 40px;
}

.price-table input { min-width: 90px; }
.price-table input[type="datetime-local"] { min-width: 180px; }
.sale-preview { font-weight: 500; white-space: nowrap; }
.sale-live { color: var(--primary-dark); }

/* ---- Badge ---- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  background: #eceff1;
  color: var(--muted);
}
.badge-warn { background: #fff3e0; color: #b26a00; }
.badge-promo { background: #fce4ec; color: #c2185b; font-weight: 700; margin-left: 6px; }
.badge-ok { background: var(--success-bg); color: var(--success-fg); }
.badge-err { background: var(--error-bg); color: var(--error-fg); }
.msg-cell { max-width: 360px; font-size: 0.88rem; }

/* ---- Grilă detalii ---- */
.detail-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
}
.detail-grid dt { color: var(--muted); font-size: 0.9rem; }
.detail-grid dd { margin: 0; }

.image-list { display: flex; flex-direction: column; gap: 4px; word-break: break-all; }

/* ---- Căutare live ---- */
.search-wrap { position: relative; max-width: 520px; margin-bottom: 16px; }
.search-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 30;
  max-height: 360px;
  overflow-y: auto;
}
.search-item {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f0f6ff; text-decoration: none; }
.search-name { font-weight: 500; }
.search-meta { font-size: 0.82rem; color: var(--muted); }
.search-empty { padding: 12px 14px; color: var(--muted); }

/* ---- Filtre ---- */
.filters { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; padding: 16px 20px; }
.filters .field { margin: 0; min-width: 160px; }
.filters .field label { margin-top: 0; }
.filters .field-btn { min-width: auto; }

/* ---- Celule tabel produse ---- */
.cell-sub { font-size: 0.8rem; color: var(--muted); }
.price-main { font-weight: 500; }
.table-scroll { overflow-x: auto; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.dot-warn { background: var(--warn); }

/* ---- Bară sticky sincronizare ---- */
.sync-bar {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
}
.sync-btn {
  box-shadow: 0 4px 14px rgba(21, 101, 192, 0.4);
  font-size: 1rem;
  padding: 12px 22px;
}
.badge-count {
  background: #fff;
  color: var(--primary-dark);
  margin-left: 8px;
  font-weight: 700;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
/* Atributul `hidden` trebuie să învingă `display: flex` de mai sus */
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  padding: 28px;
  max-width: 460px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}
.modal h2 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---- Raport import ---- */
.report-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat {
  flex: 1;
  min-width: 120px;
  padding: 16px;
  border-radius: var(--radius);
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.stat-num { display: block; font-size: 1.8rem; font-weight: 700; color: var(--text); }
.stat-ok { background: var(--success-bg); }
.stat-ok .stat-num { color: var(--success-fg); }
.stat-warn { background: #fff3e0; }
.stat-warn .stat-num { color: #b26a00; }
.stat-err { background: var(--error-bg); }
.stat-err .stat-num { color: var(--error-fg); }
.report-messages { font-size: 0.9rem; color: var(--text); line-height: 1.7; }
.report-messages li { margin-bottom: 2px; }

/* ---- Paginare ---- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 60px;
}
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager-info { font-size: 0.88rem; color: var(--muted); padding: 0 8px; }

/* ---- Bară de progres ---- */
.progress {
  width: 100%;
  height: 22px;
  background: #eceff1;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  transition: width 0.4s ease;
}
