/* NostCard — Feature components (screens, modals, lists). Desktop-first
   values; phone overrides live in responsive.css. Load order (cascade): theme.css → base.css → components.css → responsive.css */

/* ── Trust gate ──────────────────────────────────────────────────────────── */

.public-mode-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--warning-text);
  margin-bottom: 4px;
}

.trust-gate { max-width: 420px; }
.trust-gate h2 { margin-top: 12px; }
.trust-gate > .muted { margin-top: 6px; margin-bottom: 24px; }
.trust-icon { font-size: 3rem; }

.trust-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.btn-trust-yes,
.btn-trust-no {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .15s, border-color .15s;
  width: 100%;
}
.btn-trust-yes {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--text);
}
.btn-trust-yes:hover { background: var(--primary-light-h); }

.btn-trust-no {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
.btn-trust-no:hover { background: var(--hover); }

.trust-choice-icon  { font-size: 1.4rem; }
.trust-choice-label { font-size: 1rem; font-weight: 600; margin-top: 2px; }
.trust-choice-hint  { font-size: 0.8rem; color: var(--text-muted); }

/* ── Editor actions ──────────────────────────────────────────────────────── */

.editor-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.status-msg { font-size: 13px; }
.status-msg.success { color: var(--success); }
.status-msg.error   { color: var(--danger);  }

/* ── Relay manager ───────────────────────────────────────────────────────── */

.relay-manager {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.relay-manager-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}

.relay-manager-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.relay-manager-toggle {
  font-size: 12px;
  color: var(--text-muted);
}

.relay-manager-body {
  margin-top: 12px;
}

.relay-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.relay-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: monospace;
}

.relay-row-url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.relay-status-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.relay-status-badge--ok   { background: var(--ok-bg);   color: var(--ok-text); }
.relay-status-badge--fail { background: var(--fail-bg); color: var(--fail-text); }
.relay-status-badge--wait { background: var(--wait-bg); color: var(--wait-text); }

.relay-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.relay-add-row input { flex: 1; font-family: monospace; font-size: 13px; }

.relay-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ── Share modal ─────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 500px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  /* Cap to the viewport (dvh tracks iOS collapsing toolbars) and scroll
     internally so a tall modal can never push its Close button off-screen. */
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal h3 { font-size: 18px; margin-bottom: 8px; }

/* Confirm modal body keeps the paragraph breaks used by the dialog texts. */
#modal-confirm-body { white-space: pre-line; }

.share-url-box {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.share-url-box input {
  flex: 1;
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Contacts paste box ──────────────────────────────────────────────────── */

.paste-contact-details {
  margin: 0 0 8px;
}
.paste-contact-details summary {
  cursor: pointer;
  font-size: 0.85rem;
}
.paste-contact-box {
  margin: 6px 0 4px;
}
.paste-contact-error {
  font-size: 0.85rem;
  margin: 4px 0 12px;
  color: var(--danger);
}

/* ── Share modal: split-sharing section ──────────────────────────────────── */

.share-split {
  margin: 10px 0 0;
}
.share-split summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.share-split .share-url-box {
  margin: 8px 0;
}

.qr-container {
  display: flex;
  justify-content: center;
  margin: 16px 0;
}

.vcard-qr-section {
  margin-top: 28px;
  text-align: center;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.vcard-qr-label {
  font-size: 13px;
  margin-bottom: 12px;
}

.vcard-qr-section .qr-container svg {
  max-width: 220px;
  width: 100%;
  height: auto;
}

.modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 0 4px;
  background: var(--surface);
}

/* ── Contact card (recipient view) ──────────────────────────────────────── */

.contact-card { max-width: 500px; margin: 40px auto; }

.contact-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.contact-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-accent);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-card h1 { font-size: 22px; font-weight: 700; }
.contact-subtitle { font-size: 14px; margin-top: 2px; }

.contact-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.contact-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.field-icon { font-size: 18px; line-height: 1.4; flex-shrink: 0; }

/* Real brand SVG icons (globe for websites, logos for social platforms) */
.platform-icon {
  display: block;
  width: 1.2em;
  height: 1.2em;
}

.field-icon .platform-icon { margin-top: .1em; }
.dynamic-url-icon .platform-icon { margin: 0 auto; }

.field-value { font-size: 14px; word-break: break-word; }

.field-value a { color: var(--primary); text-decoration: none; }
.field-value a:hover { text-decoration: underline; }

.card-actions { text-align: center; margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.card-actions-header { margin-bottom: 24px; }

.update-hint {
  margin-top: 24px;
  padding: 14px 16px;
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: 8px;
  text-align: left;
}

.update-hint-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.update-hint-body {
  font-size: 12px;
  line-height: 1.6;
}

/* ── Setup screen ────────────────────────────────────────────────────────── */

#screen-setup .card-panel {
  max-width: 480px;
  margin: 80px auto;
  text-align: center;
}

#screen-setup h2 { font-size: 20px; margin-bottom: 12px; }

#screen-setup p { margin-bottom: 24px; }

#screen-setup .card-panel > .btn-lg { display: flex; width: 100%; }
#screen-setup .card-panel > .btn-lg + .btn-lg { margin-top: 10px; }

.setup-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 13px;
}
.setup-divider::before,
.setup-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── Cards list screen ───────────────────────────────────────────────────── */

.cards-screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.cards-screen-header h2 { font-size: 20px; font-weight: 700; }

.cards-screen-actions { display: flex; gap: 8px; align-items: center; }

/* ── Screen footer (Advanced menu entry point) ──────────────────────────── */

.screen-footer-actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

/* ── Advanced menu modal ─────────────────────────────────────────────────── */

.adv-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.adv-menu-item { width: 100%; justify-content: flex-start; text-align: left; }

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-list-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: border-left-color .15s;
}
.card-list-row:hover { border-left-color: var(--primary); }

.card-list-info { flex: 1; min-width: 0; }

.card-list-name {
  display: block;
  font-weight: 700;
  font-size: 16px;
}

.card-list-meta {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-list-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Per-relay publish status badges in card list */
.relay-badges {
  display: inline-flex;
  gap: 4px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.relay-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.relay-badge--ok   { background: var(--ok-bg);   color: var(--ok-text); }
.relay-badge--fail { background: var(--fail-bg); color: var(--fail-text); }

.btn-card-rename {
  padding: 2px 6px;
  font-size: 12px;
  vertical-align: middle;
  margin-left: 4px;
  opacity: 0.5;
}
.btn-card-rename:hover { opacity: 1; }

.card-rename-input {
  font-size: 16px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid var(--primary);
  max-width: 180px;
  width: 100%;
  font-family: inherit;
}

/* ── Saved links screen ──────────────────────────────────────────────────── */

.saved-link-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow);
}

.saved-link-info { flex: 1; min-width: 0; }

.saved-link-label {
  display: block;
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-link-date {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.saved-link-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Auto-clear countdown ─────────────────────────────────────────────────── */

.auto-clear-countdown {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Restore backup modal ────────────────────────────────────────────────── */

.modal textarea {
  width: 100%;
  font-family: monospace;
  font-size: 0.8em;
  box-sizing: border-box;
}

/* ── Create card wizard modal ────────────────────────────────────────────── */

/* Three buttons can outgrow the modal's content box (buttons are nowrap);
 * wrapping keeps them inside the padding instead of overflowing to the left. */
#modal-create .modal-actions {
  flex-wrap: wrap;
}

.create-error {
  font-size: 0.85rem;
  margin: 4px 0 0;
  color: var(--danger);
}

/* ── Sync modal ───────────────────────────────────────────────────────────── */

/* The setup section stacks controls inside .field-group, where labels and
 * inputs carry no bottom margin — without this the buttons sit flush against
 * the element above them. */
#modal-sync .field-group .btn {
  margin-top: 10px;
}

/* The four manage buttons use btn-sm so they fit one line within the modal's
 * 500px box even in Swedish; on narrow phones (where even compact buttons
 * outgrow the content box) wrapping keeps them inside the padding instead of
 * overflowing to the left, out of the box. */
#modal-sync .modal-actions {
  flex-wrap: wrap;
}

/* ── Language switcher ───────────────────────────────────────────────────── */

.lang-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 8px;
}

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  padding: 2px 7px;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.lang-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text-muted);
}

.lang-btn.lang-btn--active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-accent);
}

/* ── Help screen ─────────────────────────────────────────────────────────── */

.help-panel { max-width: 760px; margin: 0 auto; }

.help-panel h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 1.75rem 0 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.help-panel h3:first-of-type {
  margin-top: 1rem;
  padding-top: 0;
  border-top: none;
}

.help-panel p { margin: 0 0 0.5rem; }

.help-list {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.35rem;
  list-style: disc;
}

.help-list li {
  margin-bottom: 0.4rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.help-list li strong { color: var(--text); }
.help-list li code,
.help-panel p code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}
