/* ============================================================
   GWM V2 — Platform + Components CSS
   Landing · Guild Cards · Create Wizard · Modals · Toasts
   ============================================================ */

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 800;
  background: rgba(0,0,0,.55); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: modalIn .18s cubic-bezier(.34,1.36,.64,1);
  display: flex; flex-direction: column; max-height: calc(100vh - 60px);
}
.modal.wide { max-width: 680px; }
.modal.narrow { max-width: 380px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: 12px; padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line-soft); flex: none;
}
.modal-icon {
  width: 36px; height: 36px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center;
  background: var(--accent-dim);
  border: 1px solid color-mix(in oklch, var(--accent) 28%, transparent);
}
.modal-icon svg { width: 17px; height: 17px; color: var(--accent); }
.modal-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.modal-sub { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.modal-close {
  margin-left: auto; width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center; color: var(--fg-3);
  transition: all .14s;
}
.modal-close:hover { background: var(--panel-2); color: var(--fg); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.modal-footer {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line-soft); flex: none;
}
.modal-footer .btn-left { margin-right: auto; }

/* ── TOAST ───────────────────────────────────────────────── */
#toast-root {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-radius: var(--r); font-size: 13px; font-weight: 500; color: var(--fg);
  background: var(--panel-2); border: 1px solid var(--line);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  animation: toastIn .22s cubic-bezier(.34,1.36,.64,1);
  pointer-events: all; min-width: 220px; max-width: 420px;
}
.toast svg { width: 16px; height: 16px; flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(0.96); } }
.toast.out { animation: toastOut .18s ease forwards; }
.toast.ok { border-color: color-mix(in oklch, var(--ready) 40%, var(--line)); }
.toast.ok svg { color: var(--ready); }
.toast.warn { border-color: color-mix(in oklch, var(--late) 40%, var(--line)); }
.toast.warn svg { color: var(--late); }
.toast.cancel { border-color: color-mix(in oklch, var(--absent) 40%, var(--line)); }
.toast.cancel svg { color: var(--absent); }
.toast.info svg { color: var(--accent); }

/* ── PLATFORM LANDING ────────────────────────────────────── */
.platform-landing {
  max-width: 900px; margin: 0 auto; padding: 40px 0 80px;
}
.landing-hero { margin-bottom: 36px; }
.landing-hero h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; color: var(--fg); }
.landing-hero p { font-size: 14px; color: var(--fg-3); margin-top: 6px; }

/* Guild cards grid */
.guild-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px;
  margin-bottom: 14px;
}
.guild-card {
  position: relative; background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 18px 18px 16px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .12s;
  display: flex; flex-direction: column; gap: 12px; text-decoration: none;
}
.guild-card:hover { border-color: var(--line); box-shadow: 0 4px 20px rgba(0,0,0,.25); transform: translateY(-1px); }
.guild-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 4px 20px rgba(0,0,0,.25); }

.guild-card-top { display: flex; align-items: center; gap: 12px; }
.guild-card-crest {
  width: 40px; height: 40px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
}
.guild-card-crest img { width: 100%; height: 100%; object-fit: cover; }
.guild-card-crest svg { width: 20px; height: 20px; color: var(--accent-ink); }
.guild-card-info { flex: 1; min-width: 0; }
.guild-card-name { font-size: 14px; font-weight: 600; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-card-slug { font-size: 11.5px; color: var(--fg-3); margin-top: 2px; font-family: 'Geist Mono', monospace; }

.guild-card-stats { display: flex; gap: 16px; }
.guild-card-stat { display: flex; flex-direction: column; gap: 2px; }
.guild-card-stat .val { font-size: 16px; font-weight: 600; font-family: 'Geist Mono', monospace; color: var(--fg); }
.guild-card-stat .key { font-size: 10.5px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 500; }

.guild-card-footer { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.role-chip { font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: 5px; }
.role-chip.master { background: color-mix(in oklch, var(--gold) 18%, var(--panel-2)); color: var(--gold); border: 1px solid color-mix(in oklch, var(--gold) 30%, transparent); }
.role-chip.admin { background: var(--accent-dim); color: color-mix(in oklch, var(--accent) 75%, var(--fg)); border: 1px solid color-mix(in oklch, var(--accent) 28%, transparent); }
.role-chip.member { background: var(--panel-2); color: var(--fg-3); border: 1px solid var(--line-soft); }
.guild-card-enter { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--fg-3); }
.guild-card-enter svg { width: 14px; height: 14px; }

/* Create / Join guild cards */
.guild-action-card {
  background: var(--panel); border: 1px dashed var(--line-soft); border-radius: var(--r-lg);
  padding: 20px; cursor: pointer; transition: all .15s;
  display: flex; align-items: center; gap: 14px; text-decoration: none;
}
.guild-action-card:hover { border-color: var(--accent); background: var(--accent-dim); }
.guild-action-icon {
  width: 38px; height: 38px; border-radius: var(--r-sm); flex: none;
  display: grid; place-items: center;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  color: var(--fg-3);
}
.guild-action-card:hover .guild-action-icon { background: var(--accent); border-color: transparent; color: var(--accent-ink); }
.guild-action-icon svg { width: 18px; height: 18px; }
.guild-action-text .title { font-size: 13px; font-weight: 600; color: var(--fg-2); }
.guild-action-text .desc { font-size: 12px; color: var(--fg-3); margin-top: 2px; }
.guild-action-card:hover .guild-action-text .title { color: var(--fg); }

/* Empty state */
.landing-empty { text-align: center; padding: 60px 20px; }
.landing-empty .empty-icon { width: 56px; height: 56px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-soft); display: grid; place-items: center; margin: 0 auto 16px; }
.landing-empty .empty-icon svg { width: 26px; height: 26px; color: var(--fg-3); }
.landing-empty h3 { font-size: 16px; font-weight: 600; color: var(--fg); margin-bottom: 8px; }
.landing-empty p { font-size: 13px; color: var(--fg-3); max-width: 320px; margin: 0 auto 20px; line-height: 1.6; }

/* ── CREATE GUILD WIZARD ─────────────────────────────────── */
.wizard-modal { max-width: 520px; }
.wizard-steps {
  display: flex; align-items: center; gap: 0; margin-bottom: 24px;
}
.wizard-step {
  display: flex; align-items: center; gap: 8px; flex: 1;
}
.wizard-step:last-child { flex: none; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 11px; font-weight: 600;
  border: 1.5px solid var(--line-soft); color: var(--fg-3); background: var(--bg-deep);
  transition: all .2s;
}
.step-dot.done { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.step-dot.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 20%, transparent); }
.step-dot svg { width: 13px; height: 13px; }
.step-line { flex: 1; height: 1.5px; background: var(--line-soft); transition: background .2s; }
.step-line.done { background: var(--accent); }
.step-label { font-size: 11px; color: var(--fg-3); margin-top: 4px; text-align: center; white-space: nowrap; }

/* Wizard step panels */
.wizard-panel { display: none; flex-direction: column; gap: 16px; }
.wizard-panel.active { display: flex; }

/* Theme picker */
.theme-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-swatch {
  aspect-ratio: 1; border-radius: var(--r-sm); cursor: pointer; position: relative;
  border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.theme-swatch:hover { transform: scale(1.08); }
.theme-swatch.selected { border-color: var(--fg); }
.theme-swatch .check {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0;
  background: rgba(0,0,0,.35); border-radius: 6px;
}
.theme-swatch.selected .check { opacity: 1; }
.theme-swatch .check svg { width: 16px; height: 16px; color: white; }
.theme-label { font-size: 10px; color: var(--fg-3); text-align: center; margin-top: 4px; }

/* Zones preset picker */
.zones-preset { display: flex; flex-direction: column; gap: 8px; }
.zone-preset-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm); cursor: pointer;
  background: var(--bg-deep); transition: all .14s;
}
.zone-preset-item:hover { border-color: var(--line); background: var(--panel); }
.zone-preset-item.selected { border-color: var(--accent); background: var(--accent-dim); }
.zone-preset-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.zone-preset-name { font-size: 13px; font-weight: 500; color: var(--fg); }
.zone-preset-desc { font-size: 11.5px; color: var(--fg-3); margin-left: auto; }

/* Success step */
.wizard-success { text-align: center; padding: 16px 0; }
.wizard-success .success-icon {
  width: 64px; height: 64px; border-radius: 50%; background: color-mix(in oklch, var(--ready) 18%, var(--panel));
  border: 1px solid color-mix(in oklch, var(--ready) 30%, transparent);
  display: grid; place-items: center; margin: 0 auto 16px;
}
.wizard-success .success-icon svg { width: 28px; height: 28px; color: var(--ready); }
.wizard-success h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.wizard-success p { font-size: 13px; color: var(--fg-3); max-width: 300px; margin: 0 auto 20px; line-height: 1.6; }
.invite-box {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-deep); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
}
.invite-box .invite-url { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--accent); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Logo upload */
.logo-upload {
  width: 80px; height: 80px; border-radius: var(--r); border: 1.5px dashed var(--line-soft);
  display: grid; place-items: center; cursor: pointer; background: var(--bg-deep);
  transition: border-color .14s, background .14s; flex: none;
}
.logo-upload:hover { border-color: var(--accent); background: var(--accent-dim); }
.logo-upload svg { width: 24px; height: 24px; color: var(--fg-3); }
.logo-upload img { width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--r) - 2px); }

/* ── GUILD SWITCHER PANEL ────────────────────────────────── */
.switcher-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 600;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--r-lg); padding: 8px; min-width: 260px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  animation: dropIn .14s ease;
}
.switcher-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: var(--r-sm); cursor: pointer; transition: background .12s;
}
.switcher-item:hover { background: var(--panel-2); }
.switcher-item.active { background: var(--accent-dim); }
.switcher-mini-crest {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(150deg, var(--accent), var(--accent-2));
}
.switcher-mini-crest svg { width: 14px; height: 14px; color: var(--accent-ink); }
.switcher-item-name { font-size: 13px; font-weight: 500; color: var(--fg-2); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher-item.active .switcher-item-name { color: var(--fg); }
.switcher-check { width: 16px; height: 16px; color: var(--accent); }
.switcher-sep { height: 1px; background: var(--line-soft); margin: 4px 0; }
.switcher-action {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border-radius: var(--r-sm); cursor: pointer; transition: background .12s;
  font-size: 13px; color: var(--fg-3);
}
.switcher-action svg { width: 15px; height: 15px; }
.switcher-action:hover { background: var(--panel-2); color: var(--fg); }

/* ── JOIN GUILD MODAL ────────────────────────────────────── */
.join-code-input {
  font-family: 'Geist Mono', monospace; font-size: 20px; font-weight: 600;
  text-align: center; letter-spacing: 0.12em; text-transform: uppercase;
}

/* ── PLATFORM TOPBAR STATE ───────────────────────────────── */
.topbar.platform-mode .nav { display: none; }
.topbar.guild-mode .nav { display: flex; }

/* ── GUILD SETTINGS BADGE ────────────────────────────────── */
.plan-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
}
.plan-badge.free { background: var(--panel-2); color: var(--fg-3); border: 1px solid var(--line-soft); }
.plan-badge.pro { background: color-mix(in oklch, var(--gold) 18%, var(--panel-2)); color: var(--gold); border: 1px solid color-mix(in oklch, var(--gold) 30%, transparent); }

/* ── LOADING STATE ───────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.loading-screen {
  flex: 1; display: grid; place-items: center;
}
.loading-spinner {
  width: 32px; height: 32px; border: 2.5px solid var(--line-soft);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .guild-grid { grid-template-columns: 1fr; }
  .platform-landing { padding: 24px 0 60px; }
  .theme-picker { grid-template-columns: repeat(3, 1fr); }
}
