/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #1f2933;
  background: #f4f6fb;
  font-size: 14px;
  line-height: 1.5;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; background: #eef2ff; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
h1, h2, h3 { margin: 0 0 12px; color: #0f172a; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

/* ---------- Layout ---------- */
.admin-body { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: #0f172a; color: #cbd5f5; display: flex; flex-direction: column; padding: 18px 0; }
.sidebar-brand { padding: 0 18px 14px; font-size: 16px; color: #fff; border-bottom: 1px solid #1e293b; }
.sidebar-brand strong { display: block; margin-bottom: 8px; }
.sidebar-lang-switcher { display: flex; gap: 4px; }
.sidebar-lang-switcher .lang-btn {
  flex: 1;
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar-lang-switcher .lang-btn:hover { background: #1e293b; color: #cbd5f5; }
.sidebar-lang-switcher .lang-btn.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.sidebar-nav { flex: 1; overflow: auto; padding: 12px 8px; }
.nav-item { display: block; padding: 8px 12px; border-radius: 6px; color: #cbd5f5; font-size: 13.5px; }
.nav-item:hover { background: #1e293b; text-decoration: none; }
.nav-item.active { background: #1e40af; color: #fff; }
.nav-section { padding: 12px 12px 4px; font-size: 11px; text-transform: uppercase; color: #64748b; letter-spacing: 0.06em; }
.sidebar-footer { padding: 12px 18px; border-top: 1px solid #1e293b; display: flex; flex-direction: column; gap: 10px; }
.sidebar-footer-actions { display: flex; gap: 6px; }
.sidebar-footer-actions .btn { flex: 1; text-align: center; font-size: 11px; padding: 5px 8px; text-decoration: none; }
.sidebar-footer-actions .btn:hover { background: #1e293b; }
.user-chip-name { color: #fff; font-size: 13px; }
.user-chip-role { color: #94a3b8; font-size: 11px; text-transform: uppercase; }

.content { padding: 24px 28px 80px; overflow: hidden; }
.content-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.content-body { display: flex; flex-direction: column; gap: 16px; }
.content-footer { margin-top: 30px; color: #64748b; font-size: 12px; }

/* ---------- Cards & toolbar ---------- */
.card { background: #fff; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.toolbar-form { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; }
.toolbar-form input, .toolbar-form select { padding: 6px 10px; border: 1px solid #cbd5e1; border-radius: 6px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; background: #fff; border: 1px solid #cbd5e1; color: #1f2933; border-radius: 6px; cursor: pointer; font-size: 13px; }
.btn:hover { background: #f1f5f9; text-decoration: none; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { background: transparent; border-color: transparent; color: #cbd5f5; }
.btn-ghost:hover { background: #1e293b; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.row-actions { display: flex; gap: 6px; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e2e8f0; font-size: 13px; vertical-align: top; }
.table th { color: #475569; font-weight: 600; background: #f8fafc; }
.muted { color: #94a3b8; }
.err { color: #b91c1c; }

/* ---------- Forms ---------- */
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field span { color: #475569; font-weight: 500; }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 13.5px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #c7d2fe; border-color: #6366f1; }
.field-check { display: flex; align-items: center; gap: 6px; font-size: 13px; padding-top: 24px; }
.field-check input { transform: scale(1.1); }
.fieldset { border: 1px solid #e2e8f0; border-radius: 8px; padding: 14px 16px; }
.fieldset > legend { padding: 0 6px; color: #475569; font-weight: 600; }
.field-hint { display: block; color: #64748b; font-size: 11.5px; font-weight: 400; line-height: 1.4; margin-top: 3px; }
.admin-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13.5px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  max-width: 360px;
}
.admin-toast.show { opacity: 1; transform: translateY(0); }
.admin-toast-error { background: #dc2626; }
.admin-toast-info { background: #2563eb; }
.admin-toast-ok { background: #059669; }
.info-banner {
  background: #fef9c3;
  border-left: 3px solid #ca8a04;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #713f12;
  border-radius: 0 6px 6px 0;
  margin: 0 0 12px;
}
.info-banner code { background: #fde68a; }
.seo-flags { margin-top: 12px; padding: 10px 12px; background: #f8fafc; border-radius: 6px; }
.seo-flags .field-check { padding-top: 0; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.form-message { font-size: 12px; color: #64748b; }
.form-message.ok { color: #059669; }
.form-message.err { color: #dc2626; }
.media-picker { display: flex; gap: 6px; align-items: center; }
.media-picker input { flex: 1; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 6px; }

/* ---------- Language tabs ---------- */
.lang-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid #e2e8f0; }
.lang-tab { background: transparent; border: none; padding: 8px 14px; cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; color: #64748b; }
.lang-tab.active { color: #1d4ed8; border-bottom-color: #2563eb; }
.lang-pane { display: none; flex-direction: column; gap: 10px; }
.lang-pane.active { display: flex; }

/* ---------- Flash ---------- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; background: #e2e8f0; color: #475569; }
.badge-ok, .badge-published, .badge-success, .badge-closed_won, .badge-active { background: #dcfce7; color: #166534; }
.badge-draft, .badge-in_progress, .badge-running { background: #fef3c7; color: #92400e; }
.badge-archived, .badge-spam, .badge-closed_lost, .badge-failed { background: #fee2e2; color: #991b1b; }
.badge-new { background: #dbeafe; color: #1e40af; }
.badge-admin { background: #fde68a; color: #92400e; }
.badge-editor { background: #dbeafe; color: #1e40af; }
.badge-viewer { background: #e2e8f0; color: #475569; }

/* ---------- Stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05); }
.stat-card.highlight { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }
.stat-card.highlight .stat-label, .stat-card.highlight .stat-link { color: #c7d2fe; }
.stat-card.highlight .stat-value { color: #fff; }
.stat-label { color: #64748b; font-size: 12px; text-transform: uppercase; }
.stat-value { font-size: 28px; font-weight: 700; color: #0f172a; margin: 4px 0; }
.stat-link { font-size: 12px; color: #2563eb; }

/* ---------- Media library ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.media-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px; cursor: pointer; text-align: left; }
.media-card img { width: 100%; height: 120px; object-fit: contain; border-radius: 4px; background: #fff; }
.media-icon { display: flex; align-items: center; justify-content: center; height: 120px; background: #fff; border-radius: 4px; color: #475569; font-size: 14px; }
.media-name { font-size: 11px; color: #475569; margin-top: 4px; word-break: break-all; }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #1e3a8a, #0f172a); }
.login-card { background: #fff; padding: 32px 36px; width: 360px; border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3); }
.login-title { text-align: center; margin-bottom: 4px; }
.login-subtitle { text-align: center; color: #64748b; margin-bottom: 18px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Dialog ---------- */
.dialog { border: none; border-radius: 12px; padding: 0; max-width: 520px; width: 90%; }
.dialog::backdrop { background: rgba(15, 23, 42, 0.4); }
.dialog form { padding: 24px; }

/* ---------- Detail page ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.detail-list { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.detail-list dt { color: #64748b; }
.detail-list dd { margin: 0; }
.message-box { background: #f8fafc; padding: 12px; border-radius: 6px; white-space: pre-wrap; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { border-left: 2px solid #cbd5e1; padding: 8px 0 8px 14px; margin-left: 6px; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pagination button { padding: 4px 10px; border: 1px solid #cbd5e1; border-radius: 4px; background: #fff; cursor: pointer; }
.pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }

.color-chip { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle; border: 1px solid rgba(0,0,0,0.1); }

/* ---------- Gallery / specs row ---------- */
.gallery-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.gallery-row { background: #f8fafc; padding: 10px; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.gallery-row img { width: 100%; height: 120px; object-fit: contain; background: #fff; border-radius: 6px; }
.related-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; margin: 2px; background: #eef2ff; border-radius: 16px; }
.related-chip button { border: none; background: transparent; cursor: pointer; color: #4338ca; font-weight: 700; }
