/* ============================================================
   FORGE — forge_app_modals.css
   Auth modal, dialogs, context menus, overlays, toasts
   ============================================================ */

/* ══════════════════════════════════════
   OVERLAY BASE
══════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
  backdrop-filter: blur(5px);
  padding: 24px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* ══════════════════════════════════════
   AUTH MODAL
══════════════════════════════════════ */
.modal-auth {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34,1.3,0.64,1);
  box-shadow: var(--shadow-lg);
}

.modal-overlay.open .modal-auth {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.modal-close-btn:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.modal-brand-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  color: var(--gold);
}

.modal-heading {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 6px;
}

.modal-subheading {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
}

.modal-form-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.modal-form-footer a {
  color: var(--gold);
  font-weight: 500;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}
.modal-form-footer a:hover { opacity: 0.8; text-decoration: underline; }

.modal-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.modal-divider span {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.modal-divider::before,
.modal-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Password visibility toggle ── */
.input-password-wrap {
  position: relative;
}
.input-password-wrap .form-input {
  padding-right: 42px;
}
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  padding: 0;
  line-height: 1;
  transition: color var(--transition-fast);
}
.password-toggle:hover { color: var(--text-secondary); }

/* ── Checkboxes ── */
.form-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.form-checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.form-checkbox-row label {
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
}
.form-checkbox-row a { color: var(--gold); }

/* ══════════════════════════════════════
   GENERIC DIALOG (confirm, alert, etc.)
══════════════════════════════════════ */
.modal-dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 440px;
  position: relative;
  transform: translateY(16px) scale(0.97);
  transition: transform 0.25s ease;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-dialog-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin: 0 auto 20px;
}
.modal-dialog-icon.danger  { background: var(--red-dim); }
.modal-dialog-icon.warning { background: rgba(var(--gold-rgb),0.12); }
.modal-dialog-icon.success { background: var(--green-dim); }

.modal-dialog-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 10px;
}

.modal-dialog-body {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.65;
  margin-bottom: 28px;
}

.modal-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ══════════════════════════════════════
   CREATE SERVER MODAL
══════════════════════════════════════ */
.modal-create-server {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px;
  width: 100%;
  max-width: 480px;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34,1.3,0.64,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .modal-create-server {
  transform: translateY(0) scale(1);
}

.server-icon-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}

.server-icon-preview {
  width: 80px; height: 80px;
  border-radius: 22px;
  background: var(--bg-card);
  border: 2px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.server-icon-preview:hover {
  border-color: var(--gold-border);
  background: var(--bg-hover);
}
.server-icon-preview span {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}
.server-icon-preview .upload-icon { font-size: 24px; color: var(--text-muted); }

.server-template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.server-template {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 10px;
}
.server-template:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}
.server-template.selected {
  border-color: var(--gold);
  background: var(--gold-glow);
}
.server-template-icon { font-size: 20px; }
.server-template-name { font-size: 13px; font-weight: 600; }
.server-template-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ══════════════════════════════════════
   CONTEXT MENU
══════════════════════════════════════ */
.context-menu {
  position: fixed;
  z-index: 2000;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 180px;
  box-shadow: var(--shadow-lg);
  animation: fadeInScale 0.15s ease;
}

.context-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
}
.context-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.context-item.danger:hover {
  background: var(--red-dim);
  color: var(--red);
}

.context-item-icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.context-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.context-label {
  padding: 6px 10px 2px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* ══════════════════════════════════════
   TOAST NOTIFICATIONS
══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideInRight 0.3s ease forwards;
}

.toast.removing {
  animation: fadeIn 0.2s ease reverse forwards;
}

.toast-icon  { font-size: 18px; flex-shrink: 0; }
.toast-body  { flex: 1; }
.toast-title { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.toast-msg   { font-size: 12px; color: var(--text-secondary); }

.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--blue); }
.toast-warning { border-left: 3px solid var(--gold); }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 2px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}
.toast-close:hover { color: var(--text-primary); }

/* ══════════════════════════════════════
   USER POPOVER (hover on member name)
══════════════════════════════════════ */
.user-popover {
  position: fixed;
  z-index: 1500;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 280px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: fadeInScale 0.15s ease;
}

.user-popover-banner {
  height: 64px;
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-deep));
}

.user-popover-body {
  padding: 0 16px 16px;
  margin-top: -24px;
}

.user-popover-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  border: 4px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 12px;
}

.user-popover-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.user-popover-tag  { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.user-popover-divider { height: 1px; background: var(--border); margin-bottom: 12px; }

.user-popover-field-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.user-popover-field-value {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.user-popover-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ══════════════════════════════════════
   CREATE SERVER MODAL
══════════════════════════════════════ */

.cs-template-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}

.cs-template {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.cs-template:hover    { background: var(--bg-hover); border-color: var(--border-strong); }
.cs-template.selected { border-color: var(--yellow); background: rgba(var(--accent-rgb),0.06); }

.cs-template-icon { font-size: 24px; margin-bottom: 8px; }
.cs-template-name { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.cs-template-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Icon picker */
.cs-icon-picker {
  display: flex;
  justify-content: center;
}

.cs-icon-preview {
  width: 80px; height: 80px;
  border-radius: var(--radius-frame);
  background: var(--bg-card);
  border: 2px dashed var(--border-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  overflow: hidden;
  position: relative;
}
.cs-icon-preview:hover { border-color: var(--yellow); background: var(--bg-hover); }

.cs-icon-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: inherit;
  position: absolute;
  inset: 0;
}

.cs-icon-preview-text { font-size: 22px; }

/* ══════════════════════════════════════
   DISCOVER SERVERS MODAL
══════════════════════════════════════ */

.discover-modal-inner {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
  position: relative;
  transform: translateY(20px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.34,1.3,0.64,1);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.open .discover-modal-inner { transform: translateY(0) scale(1); }

.discover-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.discover-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.discover-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.discover-search-row {
  display: flex;
  gap: 8px;
}
.discover-search-row .discover-search-bar { flex: 1; min-width: 0; }
.discover-type-filter { width: 180px; flex-shrink: 0; cursor: pointer; }

.discover-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  transition: border-color var(--transition-base);
}
.discover-search-bar:focus-within { border-color: var(--border-strong); }
.discover-search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.discover-search-bar input {
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  padding: 10px 0;
  width: 100%;
  font-family: var(--font-body);
}
.discover-search-bar input::placeholder { color: var(--text-muted); }

/* Server card grid */
.discover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 16px 24px;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.discover-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Individual server card */
.discover-server-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: border-color var(--transition-fast);
  display: flex;
  flex-direction: column;
}
.discover-server-card:hover { border-color: var(--yellow); }

.discover-card-banner {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.discover-card-body {
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.discover-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.discover-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
  min-height: 28px;
}

.discover-card-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* ── Accept invite ── */
.invite-accept { max-width: 420px; text-align: center; }
.invite-accept-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background: var(--bg-card);
  border: 2px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--yellow);
}
.invite-accept-icon img { width: 100%; height: 100%; object-fit: cover; }
.invite-accept-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.invite-accept-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.invite-accept .btn-full:first-of-type { margin-top: 8px; }

.discover-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.discover-card-members {
  font-size: 11px;
  color: var(--text-muted);
}

.discover-card-join {
  background: var(--yellow);
  color: #1a1b1e;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  transition: filter var(--transition-fast);
}
.discover-card-join:hover { filter: brightness(1.1); }

/* Invite section */
.discover-invite-section { padding: 0 24px 24px; }

.discover-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-top: 16px;
}
.discover-divider-line { flex: 1; height: 1px; background: var(--border); }
.discover-divider-text { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.discover-invite-row {
  display: flex;
  gap: 10px;
}

.discover-invite-input {
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 13px;
}
.discover-invite-input::placeholder {
  text-transform: none;
  letter-spacing: 0;
}

/* ══════════════════════════════════════
   CREATE SUB-SERVER MODAL
   Two-panel: form left, live preview right
══════════════════════════════════════ */

.css-modal-overlay {
  align-items: center;
  justify-content: center;
}

.css-modal-inner {
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  display: flex;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
}

/* ── Left panel ── */
.css-left {
  flex: 0 0 380px;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
}

.css-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  cursor: default;
}

/* Icon picker */
.css-icon-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.css-icon-preview {
  width: 100px; height: 100px;
  border-radius: var(--radius-frame);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border);
  transition: border-color var(--transition-fast);
}
.css-icon-preview:hover { border-color: var(--yellow); }
.css-icon-preview:hover .css-icon-overlay { opacity: 1; }

.css-icon-abbr {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.css-icon-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
  color: white;
}

.css-icon-preview img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Shuffle button next to name */
.css-shuffle-btn {
  width: 36px; height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.css-shuffle-btn:hover { color: var(--yellow); border-color: var(--yellow); }

/* Color swatches */
.css-color-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.css-color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: border-color var(--transition-fast), transform var(--transition-fast);
}
.css-color-swatch:hover    { transform: scale(1.15); }
.css-color-swatch.selected { border-color: white; transform: scale(1.15); }

/* ── Right panel — live preview ── */
.css-right {
  flex: 1;
  background: var(--bg-well);
  padding: 28px;
  display: flex;
  flex-direction: column;
}

.css-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 16px;
}

.css-preview-shell {
  background: var(--bg-well-3);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex: 1;
  border: 1px solid rgba(255,255,255,0.06);
}

/* Mini rail */
.css-preview-rail {
  width: 54px;
  background: var(--bg-well);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 6px;
  flex-shrink: 0;
}

.css-preview-main-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 2px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--yellow);
  overflow: hidden;
}

.css-preview-sub-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: #7b68ee22;
  border: 2px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  color: #7b68ee;
  transition: background var(--transition-fast), color var(--transition-fast);
}

/* Mini sidebar */
.css-preview-sidebar {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.css-preview-server-name {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-display);
  color: var(--text-primary);
  margin-bottom: 2px;
}

.css-preview-sub-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 2px 6px;
  background: rgba(var(--accent-rgb),0.1);
  border-radius: 3px;
  display: inline-block;
  width: fit-content;
}

.css-preview-section { margin-top: 8px; }

.css-preview-section-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 4px;
}

.css-preview-row {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 3px 4px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
}

/* ── Create Server — game search bar ── */
.cs-game-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  margin-bottom: 10px;
  transition: border-color var(--transition-base);
}
.cs-game-search-wrap:focus-within { border-color: var(--border-strong); }
.cs-game-search-wrap svg { color: var(--text-muted); flex-shrink: 0; }
.cs-game-search-wrap input {
  background: none; border: none; outline: none;
  font-size: 14px; color: var(--text-primary);
  padding: 9px 0; width: 100%;
  font-family: var(--font-body);
}
.cs-game-search-wrap input::placeholder { color: var(--text-muted); }

/* Game grid */
.cs-game-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-height: 240px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.cs-game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  text-align: center;
}
.cs-game-card:hover    { background: var(--bg-hover); }
.cs-game-card.selected { border-color: var(--yellow); background: rgba(var(--accent-rgb),0.06); }

.cs-game-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.cs-game-card-name {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
  font-weight: 500;
}

/* Invite row */
.cs-invite-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

/* ══════════════════════════════════════
   ADD FRIEND MODAL
══════════════════════════════════════ */

/* Search bar that grows with chips */
.af-search-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-height: 44px;
  cursor: text;
  transition: border-color var(--transition-base);
  margin-bottom: 12px;
}
.af-search-wrap:focus-within { border-color: var(--border-strong); }

/* Selected user chip */
.af-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(var(--accent-rgb),0.15);
  border: 1px solid rgba(var(--accent-rgb),0.4);
  border-radius: 20px;
  padding: 3px 10px 3px 6px;
  font-size: 13px;
  color: var(--text-primary);
}

.af-chip-avatar {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #1a1b1e;
  flex-shrink: 0;
  overflow: hidden;
}
.af-chip-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.af-chip-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 2px;
  transition: color var(--transition-fast);
}
.af-chip-remove:hover { color: var(--red); }

.af-search-input {
  flex: 1;
  min-width: 120px;
  background: none;
  border: none;
  outline: none;
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  padding: 2px 0;
}
.af-search-input::placeholder { color: var(--text-muted); }

/* Results list */
.af-results {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

.af-results-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.af-result-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background var(--transition-fast);
  border-bottom: 1px solid var(--border);
}
.af-result-row:last-child { border-bottom: none; }
.af-result-row:hover { background: var(--bg-hover); }
.af-result-row.selected { background: rgba(var(--accent-rgb),0.08); }

.af-result-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.af-result-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.af-result-info  { flex: 1; min-width: 0; }
.af-result-name  { font-size: 14px; font-weight: 600; }
.af-result-sub   { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.af-result-check {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  font-size: 11px;
  color: transparent;
}
.af-result-row.selected .af-result-check {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #1a1b1e;
}

/* ══════════════════════════════════════
   CREATE CHANNEL MODAL
   ═════════════════════════════════════ */
.cc-modal-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 28px 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.cc-modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.cc-field { margin-bottom: 18px; }
.cc-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.cc-name-row { display: flex; align-items: center; gap: 8px; }
.cc-name-input { flex: 1; }
.cc-name-check { font-size: 18px; font-weight: 700; }

/* Channel type grid */
.cc-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.cc-type-btn {
  background: var(--bg-input);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
.cc-type-btn:hover { background: var(--bg-card-hover); }
.cc-type-btn.active {
  border-color: var(--yellow);
  background: var(--yellow);
}
.cc-type-btn.active .cc-type-icon { color: #1a1b1e; }
.cc-type-icon { font-size: 18px; line-height: 1; }

/* Preview + Description row */
.cc-preview-row {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 14px;
  min-height: 140px;
}
.cc-preview-panel {
  flex: 1;
  background: var(--bg-rail);
  border-radius: var(--radius-sm);
  padding: 10px;
  overflow: hidden;
}
.cc-type-desc {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cc-type-desc strong {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.cc-type-desc p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

/* Preview: Chat */
.cc-preview-chat { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.cc-preview-header { font-size: 11px; color: var(--text-muted); font-weight: 700; margin-bottom: 4px; }
.cc-preview-hash { margin-right: 4px; }
.cc-preview-msg { display: flex; gap: 6px; align-items: flex-start; }
.cc-preview-avatar { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; }
.cc-preview-name { font-size: 10px; font-weight: 700; }
.cc-preview-text { font-size: 10px; color: var(--text-secondary); }
.cc-preview-input {
  background: var(--bg-modal);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: auto;
}

/* Preview: Media */
.cc-preview-media { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.cc-preview-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.cc-preview-thumb { aspect-ratio: 1; border-radius: 4px; }

/* Preview: Voice */
.cc-preview-voice { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.cc-preview-voice-users { display: flex; flex-direction: column; gap: 6px; }
.cc-preview-voice-user { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-secondary); }
.cc-preview-voice-controls { display: flex; gap: 12px; justify-content: center; margin-top: auto; font-size: 14px; }

/* Preview: Announcement */
.cc-preview-announce { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.cc-preview-announce-post { display: flex; gap: 8px; align-items: flex-start; background: var(--bg-modal); border-radius: 4px; padding: 8px; }
.cc-preview-announce-badge { font-size: 14px; }
.cc-preview-announce-text { font-size: 10px; }
.cc-preview-announce-text strong { color: var(--text-primary); }
.cc-preview-announce-text p { color: var(--text-secondary); margin: 2px 0 0; }

/* Preview: Doc */
.cc-preview-doc { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.cc-preview-doc-block { background: var(--bg-modal); border-radius: 4px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.cc-preview-doc-line { height: 6px; background: var(--bg-modal-hover); border-radius: 3px; }

/* Preview: List */
.cc-preview-list { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.cc-preview-list-item { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-secondary); background: var(--bg-modal); padding: 6px 8px; border-radius: 4px; }
.cc-preview-check { font-size: 12px; }

/* Preview: Forum */
.cc-preview-forum { display: flex; flex-direction: column; gap: 6px; height: 100%; }
.cc-preview-forum-topic { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-secondary); background: var(--bg-modal); padding: 6px 8px; border-radius: 4px; }
.cc-preview-forum-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Preview: Calendar */
.cc-preview-calendar { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.cc-preview-cal-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; }
.cc-preview-cal-day { aspect-ratio: 1; background: var(--bg-modal); border-radius: 3px; }
.cc-preview-cal-day.active { background: var(--yellow); }
.cc-preview-cal-event { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--text-secondary); background: var(--bg-modal); padding: 6px 8px; border-radius: 4px; }
.cc-preview-cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--yellow); flex-shrink: 0; }

/* Public toggle */
.cc-field-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.cc-toggle-info { flex: 1; }
.cc-toggle-label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.cc-toggle-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* Actions */
.cc-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════
   CHANNEL SETTINGS MODAL
   ═════════════════════════════════════ */
.cs-modal-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  padding: 28px 32px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.cs-modal-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.cs-field { margin-bottom: 16px; }
.cs-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.cs-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.cs-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.cs-field-toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.cs-toggle-info { flex: 1; }
.cs-toggle-label { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.cs-toggle-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.cs-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
/* ══════════════════════════════════════
   QUICK SWITCHER (Quick Switcher beta)
══════════════════════════════════════ */
.qs-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.qs-box {
  width: 100%;
  max-width: 560px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.qs-input {
  width: 100%;
  padding: 16px 18px;
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  background: none;
  color: var(--text-primary);
  font-size: 17px;
  font-family: var(--font-body);
}
.qs-input::placeholder { color: var(--text-muted); }
.qs-results { max-height: 360px; overflow-y: auto; padding: 6px; }
.qs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.qs-item.active { background: var(--bg-hover); }
.qs-icon { width: 20px; text-align: center; color: var(--text-muted); font-weight: 700; flex-shrink: 0; }
.qs-label { font-size: 14px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qs-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.qs-kind { margin-left: auto; padding-left: 10px; font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.qs-item.active .qs-kind { color: var(--yellow); }
.qs-empty { padding: 18px 12px; font-size: 13px; color: var(--text-muted); text-align: center; }
.qs-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.qs-footer kbd {
  margin-right: 3px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--bg-card);
  font-size: 11px;
  font-family: var(--font-body);
}
.qs-beta { margin-left: auto; color: var(--yellow); }
