/* Shared layout, home, themes tab, animations — works with all themes */

html[data-theme]:not([data-theme="classic"]) .page.active {
  animation: themePageIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme]:not([data-theme="classic"]) .stat-card,
html[data-theme]:not([data-theme="classic"]) .theme-card,
html[data-theme]:not([data-theme="classic"]) .home-card {
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

html[data-theme]:not([data-theme="classic"]) .stat-card:hover,
html[data-theme]:not([data-theme="classic"]) .theme-card:hover,
html[data-theme]:not([data-theme="classic"]) .home-card:hover {
  transform: translateY(-2px);
}

html[data-theme]:not([data-theme="classic"]) .brand-mark {
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}

html[data-theme]:not([data-theme="classic"]) .brand-mark:hover {
  transform: scale(1.05) rotate(-3deg);
}

html[data-theme]:not([data-theme="classic"]) .header-tab {
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

html[data-theme]:not([data-theme="classic"]) .btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

html[data-theme]:not([data-theme="classic"]) .btn:active:not(:disabled) {
  transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] .page.active,
  html[data-theme] .stat-card,
  html[data-theme] .theme-card,
  html[data-theme] .home-card,
  html[data-theme] .brand-mark,
  html[data-theme] .btn {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

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

@keyframes themeGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow, transparent); }
  50% { box-shadow: 0 0 24px 2px var(--accent-glow, transparent); }
}

html[data-theme]:not([data-theme="classic"]) .home-hero-mark {
  animation: themeGlow 4s ease-in-out infinite;
}

/* ——— Home dashboard ——— */
.home-layout {
  overflow-y: auto;
  padding: 20px 24px 32px;
  height: 100%;
}

.home-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px 28px;
  align-items: center;
  padding: 28px 32px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  margin-bottom: 20px;
}

.home-hero-mark {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2, #6366f1));
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.home-hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.home-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 640px;
  line-height: 1.5;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.home-card {
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.home-card-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--accent);
}

.home-card-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-top: 6px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

.home-section-title {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.home-feature {
  padding: 16px 18px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  line-height: 1.45;
}

.home-feature strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

/* ——— Themes tab ——— */
.themes-layout {
  overflow-y: auto;
  padding: 20px 24px 40px;
  height: 100%;
}

.themes-intro {
  max-width: 720px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 32px;
}

.theme-card {
  border: 2px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
}

.theme-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.theme-preview {
  height: 88px;
  display: flex;
  gap: 6px;
  padding: 12px;
  align-items: stretch;
}

.theme-preview span {
  flex: 1;
  border-radius: 6px;
}

.theme-card-body {
  padding: 12px 14px 14px;
}

.theme-card-body h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.theme-card-body p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.theme-card-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.deploy-section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.deploy-grid {
  display: grid;
  gap: 12px;
}

.deploy-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--surface);
}

.deploy-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.deploy-card pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--console-bg);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.deploy-card .btn-sm {
  font-size: 12px;
}

.brand-logo-svg {
  width: 22px;
  height: 22px;
}

/* ——— Shell UX (command palette, toasts, search) ——— */
.shell-metrics {
  display: none;
  gap: 14px;
  align-items: center;
}

.shell-cmd-btn {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  min-width: 0;
}

.home-shortcuts {
  margin-top: 20px;
  font-size: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface);
}

.home-shortcuts span {
  font-weight: 700;
  color: var(--accent);
}

.theme-card-full {
  border-color: var(--accent);
}

.theme-full-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--accent-glow, rgba(59, 130, 246, 0.2));
  color: var(--accent);
  vertical-align: middle;
}

.cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
}

.cmd-palette[hidden] {
  display: none !important;
}

.cmd-palette-box {
  width: min(520px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.cmd-palette-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.cmd-palette-head kbd {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.cmd-palette-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  font: inherit;
  font-size: 14px;
  background: transparent;
  color: var(--text);
  outline: none;
}

.cmd-palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px;
}

.cmd-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.cmd-item:hover {
  background: var(--surface-2);
}

.cmd-item kbd {
  font-size: 11px;
  color: var(--muted);
}

.toast-root {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ——— Color scheme toggle ——— */
.scheme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  min-width: 0;
  line-height: 1;
}

.scheme-toggle span {
  font-size: 14px;
  transition: opacity 0.2s ease;
}

.scheme-picker {
  margin-bottom: 24px;
}

.scheme-picker-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.scheme-picker-hint {
  margin: 4px 0 0;
  font-size: 13px;
}

.scheme-toggle-row {
  display: flex;
  gap: 8px;
}

.scheme-pick-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.scheme-pick-btn:hover {
  border-color: var(--accent);
}

.scheme-pick-btn.active {
  border-color: var(--accent);
  background: var(--accent-glow, rgba(59, 130, 246, 0.15));
  box-shadow: 0 0 0 1px var(--accent);
}

/* ——— Console command reference ——— */
.console-cmd-ref {
  margin-top: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.console-cmd-ref summary {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.console-cmd-ref summary:hover {
  color: var(--text);
}

.console-cmd-ref pre {
  margin: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
}

.login-scheme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 20;
}

/* ——— Alts tab ——— */
.alts-layout {
  overflow-y: auto;
  padding: 20px 24px 40px;
  height: 100%;
}

.alts-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.alts-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.alts-filter {
  margin: 0;
  min-width: 160px;
}

.alts-filter-grow {
  flex: 1;
  min-width: 200px;
}

.alts-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.alt-summary-card {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.alt-summary-name {
  font-weight: 700;
  font-size: 14px;
}

.alt-summary-host {
  font-size: 11px;
  margin-bottom: 10px;
}

.alt-summary-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 12px;
}

.alt-stat strong {
  font-weight: 700;
}

.alt-stat.ok strong {
  color: var(--green);
}

.alt-stat.warn strong {
  color: var(--yellow);
}

.alt-stat.bad strong {
  color: var(--red);
}

.alts-import-panel {
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 20px;
}

.alts-import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.alts-import-servers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.alts-server-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.alts-table-wrap {
  max-height: none;
}

.alt-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}

.alt-status-available {
  background: var(--green-bg, rgba(34, 197, 94, 0.12));
  color: var(--green);
}

.alt-status-banned,
.alt-status-dead {
  background: var(--red-bg, rgba(239, 68, 68, 0.12));
  color: var(--red);
}

.alt-status-muted {
  background: rgba(234, 179, 8, 0.12);
  color: var(--yellow);
}

.alt-status-leased {
  background: rgba(59, 130, 246, 0.12);
  color: var(--accent);
}

.alt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.read-only-mode #tab-alts,
.read-only-mode .header-tab[data-tab="alts"],
.read-only-mode #tab-storage,
.read-only-mode .header-tab[data-tab="storage"] {
  display: none !important;
}

/* ——— Storage / Drive ——— */
.storage-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1100px;
}

.storage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.storage-usage-pill {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
}

.storage-backup-info {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: var(--surface);
}

.storage-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.storage-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.drive-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.drive-crumb {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 4px;
  font: inherit;
}

.drive-crumb.current {
  color: var(--text);
  cursor: default;
  font-weight: 600;
}

.drive-sep {
  color: var(--muted);
}

.storage-dropzone {
  min-height: 280px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}

.storage-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow, rgba(59, 130, 246, 0.08));
}

.drive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.drive-empty {
  grid-column: 1 / -1;
  padding: 48px 16px;
  text-align: center;
}

.drive-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.drive-item-backups {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow, rgba(59, 130, 246, 0.15));
}

.drive-item-main {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 14px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.drive-item-main:hover {
  background: rgba(255, 255, 255, 0.03);
}

.drive-icon {
  font-size: 28px;
  line-height: 1;
}

.drive-name {
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
}

.drive-meta {
  font-size: 11px;
}

.drive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 10px;
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding-top: 10px;
}
