/* Admin CMS – German Flavors Hanoi */
:root {
  --bg: #f4f4f4;
  --panel: #fff;
  --ink: #111;
  --muted: #666;
  --line: #e0e0e0;
  --accent: #111;
  --ok: #1a7a45;
  --err: #b42318;
  --warn: #9a6700;
  --radius: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.06);
  --side: 240px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Source Sans 3", sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* ---- Login ---- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top, rgba(0,0,0,.04), transparent 55%),
    linear-gradient(180deg, #fafafa, #ededed);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 36px 32px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.login-brand h1 {
  font-size: 1.25rem;
  line-height: 1.2;
}
.login-brand p {
  color: var(--muted);
  font-size: .9rem;
}
.login-card h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
}
.login-card .sub {
  color: var(--muted);
  margin-bottom: 22px;
  font-size: .95rem;
}
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  transition: border-color .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: #111;
}
.field textarea { min-height: 90px; resize: vertical; }
.password-field {
  position: relative;
}
.password-field input {
  width: 100%;
  padding-right: 42px;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 8px;
  line-height: 1;
  border-radius: 4px;
}
.password-toggle:hover {
  color: var(--ink);
  background: #f3f3f3;
}
.password-toggle i {
  font-size: .95rem;
  pointer-events: none;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 11px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, opacity .2s;
}
.btn:hover { background: #333; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: #f5f5f5; }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #912018; }
.btn-ok { background: var(--ok); }
.btn-sm { padding: 7px 12px; font-size: .9rem; }
.alert {
  border-radius: 6px;
  padding: 10px 12px;
  font-size: .9rem;
  margin-bottom: 14px;
  display: none;
}
.alert.show { display: block; }
.alert-err { background: #fef3f2; color: var(--err); border: 1px solid #fecdca; }
.alert-ok { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.alert-warn { background: #fffaeb; color: var(--warn); border: 1px solid #fedf89; }

/* ---- Shell ---- */
.admin-shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: #111;
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 10px;
}
.side-brand img { width: 36px; height: 36px; }
.side-brand strong { display: block; font-size: .95rem; }
.side-brand span { color: rgba(255,255,255,.55); font-size: .78rem; }
.nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.75);
  padding: 11px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.side-foot a, .side-foot button {
  color: rgba(255,255,255,.7);
  background: transparent;
  border: 0;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
}
.side-foot a:hover, .side-foot button:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.main {
  padding: 20px 24px 28px;
  width: 100%;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.topbar-intro {
  flex: 1 1 220px;
  min-width: 0;
}
.topbar h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  word-break: break-word;
}
.topbar .hint {
  word-break: break-all;
}
.topbar .actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  flex: 1 1 280px;
}
.topbar-btn-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex: 0 0 auto;
}
.topbar-btn-row[hidden] {
  display: none !important;
}
.btn-topbar {
  min-height: 42px;
  min-width: 118px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: .92rem;
  letter-spacing: .01em;
  white-space: nowrap;
}
.btn-topbar i {
  font-size: .9rem;
  opacity: .9;
}
.btn-topbar.btn-ghost {
  background: #fff;
  border: 1px solid #d4d4d4;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.btn-topbar.btn-ghost:hover {
  background: #fafafa;
  border-color: #bbb;
}
.btn-topbar.btn-ghost:hover i {
  transform: rotate(-180deg);
}
.btn-topbar.btn-ghost i {
  transition: transform .35s ease;
}
.btn-topbar-save {
  min-width: 132px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}
.btn-topbar-save:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.panel h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.panel-sub {
  font-size: .95rem;
  font-weight: 700;
  margin: 16px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.panel-compact .field {
  margin-bottom: 10px;
}
.panel-compact .field-last {
  margin-bottom: 0;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.hero-bar-admin {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.hero-stat-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fafafa;
}
.hero-stat-block .field {
  margin-bottom: 0;
}
.lang-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.lang-tab {
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
}
.lang-tab.active {
  background: #111;
  color: #fff;
  border-color: #111;
}
.section-pane { display: none; }
.section-pane.active { display: block; }
.lang-pane { display: none; }
.lang-pane.active { display: block; }
.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
  background: #fafafa;
}
.item-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.item-card-head strong { font-size: 1rem; }

.admin-users-list {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.accounts-deploy-hint {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid #fedf89;
  background: #fffaeb;
}
.accounts-deploy-hint p {
  margin: 0 0 8px;
}
.accounts-deploy-hint p:last-child {
  margin-bottom: 0;
}
.accounts-deploy-cmd {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #111;
  color: #f5f5f5;
  font-size: .78rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.panel-accounts {
  padding: 14px 16px;
  margin-bottom: 0;
}
.panel-accounts h3 {
  margin-bottom: 6px;
  padding-bottom: 6px;
}
.panel-accounts .accounts-hint {
  margin: 0 0 10px;
  line-height: 1.35;
}
.accounts-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.accounts-panel-head h3 {
  margin-bottom: 6px;
  padding-bottom: 0;
}
.admin-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}
.admin-user-row:last-child { border-bottom: 0; }
.admin-user-row.is-self { background: #fafafa; }
.admin-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.admin-user-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.25;
}
.admin-user-info strong {
  font-size: .9rem;
  word-break: break-all;
}
.admin-user-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.4;
  flex-shrink: 0;
}
.admin-user-meta {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.2;
}
.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
}
.admin-user-actions .btn-sm {
  padding: 5px 10px;
  font-size: .82rem;
  min-height: 30px;
}

/* ---- Site preview (1:1 with public index.html) ---- */
.site-preview.row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0 -12px;
}
.site-preview .admin-preview-wrap {
  padding: 0 12px 16px;
  width: 100%;
  box-sizing: border-box;
}
@media (min-width: 576px) {
  .site-preview .admin-preview-wrap { width: 50%; }
}
@media (min-width: 992px) {
  .site-preview .admin-preview-wrap { width: 33.333%; }
}
.site-preview-testimonials {
  background: var(--cream);
  margin: 16px -22px -22px;
  padding: 22px 10px 8px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.site-preview .mhrt,
.site-preview .madd {
  pointer-events: none;
}
.admin-preview-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 10px;
}
.admin-preview-actions .btn { min-width: 88px; }

/* Site info preview — same blocks as public index.html */
.site-preview-info {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
.site-preview-info .site-preview-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}
.site-preview-info .site-preview-topbar {
  background: var(--primary-dark);
  padding: 8px 0;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(184, 149, 106, 0.2);
}
.site-preview-info .site-preview-topbar .top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.site-preview-info .site-preview-topbar span {
  color: #fff;
}
.site-preview-info .site-preview-topbar span i {
  color: #fff;
  margin-right: 5px;
}
.site-preview-info .site-preview-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}
.site-preview-info .site-preview-about {
  padding: 16px;
  background: var(--cream);
  border-bottom: 1px solid var(--line);
}
.site-preview-info .site-preview-about label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.site-preview-info .site-preview-about img {
  width: 100%;
  max-width: 420px;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  display: block;
}
.site-preview-info footer {
  padding: 36px 0 0;
}
.site-preview-info .fbot {
  margin-top: 24px;
}
.site-preview-seo {
  padding: 16px;
  background: #fafafa;
  border-top: 1px solid var(--line);
}
.site-preview-seo label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.seo-snippet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  max-width: 600px;
}
.seo-snippet-title {
  color: #1a0dab;
  font-size: 1.05rem;
  line-height: 1.3;
  margin-bottom: 4px;
}
.seo-snippet-url {
  color: #006621;
  font-size: 0.82rem;
  margin-bottom: 4px;
}
.seo-snippet-desc {
  color: #545454;
  font-size: 0.88rem;
  line-height: 1.45;
}
.preview-empty {
  width: 100%;
  text-align: center;
  color: var(--muted);
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  margin: 0 12px;
}
.preview-img {
  width: 100%;
  max-width: 180px;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #eee;
  margin-top: 8px;
}
.image-field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
}
.image-field-row input {
  flex: 1 1 200px;
  min-width: 0;
}
.image-field-row .btn {
  flex: 0 0 auto;
  white-space: nowrap;
  align-self: center;
}

.hint {
  color: var(--muted);
  font-size: .85rem;
  margin-top: 6px;
}
.status-bar {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: #111;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 50;
  max-width: 320px;
}
.status-bar.show { display: block; }
.loading-screen {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.85);
  display: grid;
  place-items: center;
  z-index: 100;
  font-weight: 600;
}
.loading-screen.hidden { display: none; }
.lang-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  vertical-align: middle;
}
.global-lang {
  margin: 0;
}
.lang-switch-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}
.lang-switch-label {
  font-size: .75rem;
  color: var(--muted);
  font-weight: 600;
}
.lang-one-hint {
  color: var(--muted);
  font-size: .9rem;
}
.mobile-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 80;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 12px;
  background: #fff;
  box-shadow: var(--shadow);
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 65;
  opacity: 0;
  transition: opacity .25s;
}
.sidebar-backdrop.show {
  display: block;
  opacity: 1;
}
body.sidebar-open { overflow: hidden; }
.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.modal-box {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(90vh, 860px);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  padding: 20px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.modal-head h3 {
  font-size: 1.2rem;
}
.modal-x {
  border: 0;
  background: transparent;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}
.modal-x:hover { background: #f3f3f3; color: #111; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.modal-body .field input.invalid,
.modal-body .field textarea.invalid {
  border-color: var(--err);
  background: #fff8f7;
}
#accountsTopbarBtns:not([hidden]) {
  display: flex;
}

@media (max-width: 900px) {
  #accountsTopbarBtns:not([hidden]) {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  #accountsTopbarBtns:not([hidden]) .btn-topbar {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform .25s;
    z-index: 70;
    width: min(var(--side), 88vw);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-toggle { display: inline-flex; }
  .main {
    padding: 60px 16px 20px;
  }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-bar-admin { grid-template-columns: 1fr; }
  .hero-stat-block { grid-template-columns: 1fr; }
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 12px;
  }
  .topbar-intro {
    flex: 0 0 auto;
    text-align: center;
    padding: 0 4px 4px;
  }
  .topbar h2 {
    font-size: 1.65rem;
  }
  .topbar .hint {
    margin-top: 4px;
    font-size: .95rem;
  }
  .topbar .actions {
    width: 100%;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .lang-switch-block {
    width: 100%;
    align-items: stretch;
    gap: 4px;
  }
  .topbar-btn-row {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 8px;
  }
  .btn-topbar {
    width: 100%;
    min-width: 0;
    justify-content: center;
  }
  .global-lang {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0;
    margin-bottom: 0;
  }
  .global-lang .lang-tab {
    flex: 0 0 auto;
  }
  .item-card-head {
    flex-direction: column;
    align-items: stretch;
  }
  .item-card-head .btn {
    width: 100%;
  }
  .admin-user-row {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 8px;
  }
  .admin-user-actions {
    width: 100%;
  }
  .admin-user-actions .btn {
    flex: 1;
    justify-content: center;
  }
  .site-preview-testimonials {
    margin-left: -16px;
    margin-right: -16px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .status-bar {
    left: 16px;
    right: 16px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .main { padding: 56px 12px 20px; }
  .panel { padding: 16px; }
  .topbar h2 { font-size: 1.75rem; }
  .topbar .hint { font-size: 1rem; }
  .modal-box {
    padding: 16px;
    max-height: 92vh;
  }
  .modal-foot {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .modal-foot .btn { width: 100%; }
  .image-field-row .btn {
    width: 100%;
    justify-content: center;
  }
  .admin-preview-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-preview-actions .btn {
    width: 100%;
    min-width: 0;
  }
  .preview-img {
    max-width: 100%;
    height: auto;
    min-height: 120px;
  }
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
  .login-brand h1 { font-size: 1.1rem; }
  .lang-tab {
    padding: 8px 12px;
    font-size: .82rem;
  }
  .nav-btn {
    min-height: 44px;
  }
  .side-foot a,
  .side-foot button {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .mobile-toggle {
    top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
  }
  .status-bar {
    bottom: max(16px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
  }
}
