/* Settings drawer, empty state, modals. */

/* ---------- Drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: #000a;
  opacity: 0;
  transition: opacity .2s ease;
}
.drawer.open .drawer-backdrop { opacity: 1; }

.drawer-panel {
  position: absolute;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(420px, 90vw);
  padding: 16px 18px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 12px 0 40px #0008;
  outline: none;
  transform: translateX(-100%);
  /* Fully hidden when closed: otherwise its shadow darkens the left screen edge */
  visibility: hidden;
  transition: transform .24s var(--ease), visibility 0s .24s;
}
.drawer.open .drawer-panel { transform: none; visibility: visible; transition: transform .24s var(--ease); }

.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.drawer-head h2 { margin: 0; font-size: 18px; letter-spacing: .02em; }

.section {
  display: grid;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.section h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
details.section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .2s var(--ease);
}
details.section[open] > summary::after { transform: rotate(45deg); }

.host-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: color-mix(in srgb, var(--bg) 50%, transparent);
}
.host-qr {
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  overflow: hidden;
  border-radius: 10px;
  background: #fff;
  color: #333;
  font-size: 11px;
  text-align: center;
}
.host-qr img { width: 100%; height: 100%; }
.host-info { display: grid; gap: 6px; min-width: 0; }
.host-info .label { color: var(--muted); font-size: 12px; }
.host-id { font: 800 30px/1.1 var(--mono); letter-spacing: .06em; }
.host-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.host-actions .btn { min-height: 32px; padding: 0 10px; }

.field { display: grid; gap: 6px; }
.field > span { color: var(--muted); font-size: 12px; }

.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.color-row label { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; }

.bg-row { display: flex; gap: 12px; align-items: center; }
.bg-thumb {
  flex-shrink: 0;
  width: 80px;
  height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, #111, #222) center / cover no-repeat;
}
.bg-info { display: grid; gap: 6px; min-width: 0; }
.bg-info > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.note { margin: 0; color: var(--muted); font-size: 12px; }
.version { margin-top: auto; padding-top: 12px; color: var(--muted); font: 11px var(--mono); opacity: .7; }

/* ---------- Empty state ---------- */
.empty {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 28px 28px 20px;
  border: 1px solid color-mix(in srgb, var(--border) calc(var(--card-opacity) * 100%), transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) var(--card-alpha), transparent);
  box-shadow: 0 16px 40px color-mix(in srgb, #0006 calc(var(--card-opacity) * 100%), transparent);
  text-align: center;
  animation: fade-up .4s var(--ease);
}
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
.empty h2 { margin: 4px 0 0; font-size: 22px; }
.empty > p { margin: 0; }
.empty-import {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px dashed var(--accent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.empty-import:hover { transform: scale(1.05); box-shadow: 0 0 0 8px var(--glow); }
.empty-import svg { width: 32px; height: 32px; }
.empty-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; margin-top: 8px; text-align: left; }
.empty-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-panel);
  background: color-mix(in srgb, var(--bg) 45%, transparent);
}
.empty-panel h3 { margin: 0; color: var(--muted); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; }
.empty-panel.share { justify-items: center; text-align: center; }
.empty-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.color-btn { position: relative; overflow: hidden; }
.color-btn input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.qr-box {
  display: grid;
  place-items: center;
  width: 160px;
  height: 160px;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
  color: #333;
  font-size: 12px;
}
.qr-box img { width: 100%; height: 100%; }
.empty .host-id { font-size: clamp(30px, 4vw, 42px); }
.link-btn { border: 0; background: none; color: var(--muted); font: 12px var(--font); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

@media (max-width: 560px) {
  .empty-grid { grid-template-columns: 1fr; }
}

/* ---------- Modals ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 16px;
  background: #000b;
  opacity: 0;
  transition: opacity .18s ease;
}
.modal.open { opacity: 1; }
.modal-box {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-pop);
  transform: translateY(8px) scale(.98);
  transition: transform .18s var(--ease);
}
.modal.open .modal-box { transform: none; }
.modal-box h2 { margin: 0 0 8px; font-size: 18px; }
.modal-box p { margin: 0 0 16px; }
.modal.confirm .modal-box { width: min(400px, 100%); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { position: absolute; top: 14px; right: 14px; }

.shortcut-list { display: grid; margin-top: 12px; }
.shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  font-size: 13px;
}
.shortcut:last-child { border-bottom: 0; }
.shortcut .keys { display: flex; gap: 4px; flex-shrink: 0; }

.prompt-form { display: grid; gap: 10px; }
.prompt-form h2, .prompt-form p { margin: 0; }
.field-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
