/* ─── admin.css ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #f4f5f7;
  --surface: #ffffff;
  --primary: #d4411e;
  --primary-h:#b83618;
  --text:    #1a1a1a;
  --muted:   #666;
  --border:  #e0e0e0;
  --danger:  #c0392b;
  --success: #27ae60;
  --radius:  8px;
  --shadow:  0 2px 8px rgba(0,0,0,.07);
  --font:    'Segoe UI', system-ui, sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

/* ─── Login page ─────────────────────────────────────────────────────────── */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.login-logo { font-size: 3rem; margin-bottom: 16px; }
.login-card h1 { font-size: 1.4rem; margin-bottom: 28px; }

/* ─── Admin header ───────────────────────────────────────────────────────── */
.admin-header {
  background: #1a1a1a;
  color: #fff;
  padding: 0 24px;
  height: 56px;
  display: flex; align-items: center;
  position: sticky; top: 0; z-index: 100;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 1200px; margin: auto; }
.brand { font-size: 1.1rem; font-weight: 700; }

/* ─── Admin layout ───────────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  gap: 24px;
  align-items: flex-start;
}

/* ─── Nav ────────────────────────────────────────────────────────────────── */
.admin-nav {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 180px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
}
.nav-btn {
  background: none;
  border: none;
  padding: 10px 14px;
  text-align: left;
  font-size: .95rem;
  font-family: inherit;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  transition: all .15s;
}
.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; }

/* ─── Main content ───────────────────────────────────────────────────────── */
.admin-main { flex: 1; min-width: 0; }
.panel { display: flex; flex-direction: column; gap: 20px; }
.panel.hidden { display: none; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
}
.panel-header h2 { font-size: 1.15rem; }

/* ─── Form card ──────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.form-card h3 { font-size: 1rem; margin-bottom: 18px; }

.form-row { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-row:last-child { margin-bottom: 0; }
.form-row label { font-size: .875rem; font-weight: 600; }
.form-row input[type=text],
.form-row input[type=number],
.form-row select,
.form-row textarea {
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .2s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212,65,30,.12);
}
.form-row textarea { resize: vertical; min-height: 60px; }
.form-row-inline { flex-direction: row; align-items: center; gap: 8px; }
.form-row-inline label { cursor: pointer; }
.form-row-inline-wrap { display: flex; gap: 16px; align-items: flex-end; }
.req { color: var(--primary); }

/* ─── Image preview ──────────────────────────────────────────────────────── */
.image-preview-wrap { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.image-preview { width: 80px; height: 80px; object-fit: cover; border-radius: 6px; border: 1.5px solid var(--border); }

/* ─── Form actions ───────────────────────────────────────────────────────── */
.form-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
  padding: 10px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary.sm { padding: 7px 14px; font-size: .875rem; }

.btn-ghost {
  padding: 10px 20px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .95rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: all .15s;
}
.btn-ghost:hover { border-color: var(--text); background: var(--bg); }
.btn-ghost.sm { padding: 6px 12px; font-size: .875rem; }

.btn-danger {
  padding: 6px 12px;
  background: transparent;
  border: 1.5px solid var(--danger);
  border-radius: 6px;
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--danger);
  transition: all .15s;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-edit {
  padding: 6px 12px;
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: .8rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
  transition: all .15s;
}
.btn-edit:hover { border-color: var(--primary); color: var(--primary); }

/* ─── Table ──────────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th {
  background: #f8f8f8;
  padding: 12px 14px;
  text-align: left;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafafa; }

.col-img { width: 72px; }
.thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.thumb-placeholder { width: 52px; height: 52px; border-radius: 6px; background: #f0ede8; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: .75rem; font-weight: 700; }
.badge-ok  { background: #e8f8ef; color: var(--success); }
.badge-off { background: #fef0ee; color: var(--danger); }

.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.loading-cell { padding: 24px; text-align: center; color: var(--muted); font-style: italic; }

/* ─── Orders ─────────────────────────────────────────────────────────────── */
.order-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.order-card-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px;
  flex-wrap: wrap; gap: 8px;
}
.order-id { font-weight: 700; font-size: 1rem; }
.order-date { font-size: .85rem; color: var(--muted); }
.order-info { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; font-size: .9rem; }
.order-info span strong { font-weight: 600; }
.order-items-list { list-style: none; font-size: .9rem; }
.order-items-list li { padding: 4px 0; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.order-items-list li:last-child { border-bottom: none; }
.order-total { text-align: right; font-weight: 700; margin-top: 10px; }
.order-notes { font-size: .85rem; color: var(--muted); margin-top: 8px; }

/* ─── Error ──────────────────────────────────────────────────────────────── */
.form-error { color: var(--danger); font-size: .875rem; margin-top: 6px; }

/* ─── Utility ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .admin-layout { flex-direction: column; }
  .admin-nav { flex-direction: row; width: 100%; position: static; flex-wrap: wrap; }
  .form-row-inline-wrap { flex-direction: column; }
}
