/* VL2 Navigation - admin console styles */

.admin-body {
  background: linear-gradient(160deg, #eef2f7 0%, #dfe7ef 100%);
  min-height: 100vh;
}

html[data-theme='dark'] .admin-body {
  background: linear-gradient(160deg, #131824 0%, #1a2230 100%);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']):not([data-theme='dark']) .admin-body {
    background: linear-gradient(160deg, #131824 0%, #1a2230 100%);
  }
}

.admin-body .bg-layer,
.admin-body .bg-overlay {
  display: none;
}

/* ---------- login ---------- */

.login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-view[hidden] {
  display: none;
}

.login-card {
  width: min(380px, 100%);
  padding: 34px 32px 30px;
  text-align: center;
  background: var(--glass-bg-strong);
}

.login-logo {
  border-radius: 12px;
  margin-bottom: 12px;
}

.login-title {
  margin: 0 0 22px;
  font-size: 20px;
  font-weight: 650;
}

.field {
  display: block;
  text-align: left;
  margin-bottom: 14px;
}

.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--item-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border var(--transition), box-shadow var(--transition);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-error {
  color: #c0392b;
  font-size: 13px;
  margin: 4px 0 12px;
}

html[data-theme='dark'] .form-error {
  color: #ff8a80;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--transition), transform var(--transition), background var(--transition);
}

.btn:active {
  transform: scale(0.97);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.ghost {
  background: var(--item-bg);
  color: var(--text);
  border: 1px solid var(--glass-border);
}

.btn.ghost:hover {
  background: var(--item-bg-hover);
}

.btn.danger {
  background: transparent;
  color: #c0392b;
  border: 1px solid rgba(192, 57, 43, 0.4);
}

.btn.danger:hover {
  background: rgba(192, 57, 43, 0.1);
}

html[data-theme='dark'] .btn.danger {
  color: #ff8a80;
}

.btn.small {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn.block {
  width: 100%;
}

.icon-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: var(--item-bg);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  transition: background var(--transition);
}

.icon-mini:hover {
  background: var(--item-bg-hover);
}

.icon-mini.danger {
  color: #c0392b;
}

html[data-theme='dark'] .icon-mini.danger {
  color: #ff8a80;
}

/* ---------- layout ---------- */

.admin-view {
  display: flex;
  min-height: 100vh;
}

.admin-view[hidden] {
  display: none;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  margin: 14px 0 14px 14px;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 14px;
  height: calc(100vh - 28px);
  background: var(--glass-bg-strong);
  border-radius: var(--radius);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 16px;
  font-size: 16px;
}

.sidebar-brand img {
  border-radius: 8px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.menu button:hover {
  background: var(--item-bg-hover);
  color: var(--text);
}

.menu button.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-foot {
  border-top: 1px solid var(--glass-border);
  padding-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.admin-user {
  font-size: 13px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  flex: 1;
  padding: 24px 28px;
  max-width: 980px;
}

.content h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
}

.content .page-sub {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: var(--text-secondary);
}

/* ---------- region tabs ---------- */

.region-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--item-bg);
  margin-bottom: 18px;
}

.region-tabs button {
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.region-tabs button.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--item-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
}

/* ---------- panels & lists ---------- */

.panel {
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--glass-border);
}

.row:last-child {
  border-bottom: none;
}

.row-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.row-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.row-icon .site-fallback {
  font-size: 13px;
  border-radius: 8px;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.hot-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
}

.empty-hint {
  padding: 26px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13.5px;
}

/* ---------- stats ---------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-num {
  font-size: 30px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.lang-row {
  display: grid;
  grid-template-columns: 110px 1fr 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.lang-row.single {
  grid-template-columns: 110px 1fr;
}

.lang-tag {
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 600;
}

.icon-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 6px;
}

.icon-preview {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--item-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.icon-preview .site-fallback {
  font-size: 20px;
}

.icon-editor .hint {
  font-size: 12px;
  color: var(--text-tertiary);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 16, 28, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  overflow-y: auto;
}

.modal {
  width: min(680px, 100%);
  background: var(--glass-bg-strong);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
  padding: 22px 24px;
  animation: modalIn 0.16s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-head h3 {
  margin: 0;
  font-size: 17px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--glass-bg-strong);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 999px;
  padding: 10px 22px;
  font-size: 14px;
  z-index: 400;
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ---------- backup list ---------- */

.backup-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--glass-border);
}

.backup-row:last-child {
  border-bottom: none;
}

.backup-name {
  flex: 1;
  font-size: 13.5px;
  font-family: ui-monospace, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backup-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.warn-text {
  font-size: 13px;
  color: #b26a00;
  background: rgba(255, 193, 7, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
}

html[data-theme='dark'] .warn-text {
  color: #ffca7a;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .admin-view {
    flex-direction: column;
  }
  .sidebar {
    width: auto;
    height: auto;
    position: static;
    margin: 10px;
    flex-direction: row;
    align-items: center;
  }
  .sidebar-brand {
    padding: 0 8px 0 0;
  }
  .menu {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .menu button {
    padding: 7px 10px;
    font-size: 13px;
  }
  .sidebar-foot {
    border-top: none;
    padding-top: 0;
  }
  .content {
    padding: 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .lang-row {
    grid-template-columns: 80px 1fr;
  }
  .lang-row .lang-desc {
    display: none;
  }
}
