/**
 * styles.css — Main app styles.
 * Project: linkhill
 * SPDX-License-Identifier: MIT
 * Copyright (c) 2026 Hillwork, LLC
 */

:root {
  --fg: #111827;
  --bg: #ffffff;
  --muted: #6b7280;
  --btn-fg: #ffffff;
  --focus: #2563eb;
}
.theme-dark {
  --fg: #e5e7eb;
  --bg: #0b0f19;
  --muted: #9ca3af;
  --btn-fg: #0b0f19;
  --focus: #60a5fa;
}
* { box-sizing: border-box; }
body {
  margin: 0; font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--fg); background: var(--bg);
}
/* One consistent width per viewport; no narrow variant so width doesn't jump between pages */
.container {
  width: 100%;
  max-width: 100%;
  margin: 24px auto;
  padding: 0 16px;
}
/* Mobile: more horizontal padding so text isn't tight on iPhone (Safari/Chrome) */
@media (max-width: 768px) {
  body {
    padding-left: max(20px, 11%, env(safe-area-inset-left, 0px));
    padding-right: max(20px, 11%, env(safe-area-inset-right, 0px));
  }
  .container {
    padding-left: 0;
    padding-right: 0;
  }
}
@media (min-width: 600px) {
  .container { max-width: 560px; }
}
@media (min-width: 768px) {
  .container { max-width: 720px; }
}
@media (min-width: 1024px) {
  .container { max-width: 720px; }
}
h1,h2,h3 { margin: 0 0 12px; }
p { margin: 0 0 12px; color: var(--fg); }
a { color: inherit; }
.profile { text-align: center; margin: 24px 0; }
.avatar { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; }
.avatar.sm { width: 64px; height: 64px; }
.name { font-size: 1.75rem; margin-top: 8px; }
.bio { color: var(--muted); white-space: pre-wrap; }
.links { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 24px; }
.link-btn {
  width: 75%;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-radius: 12px; text-decoration: none;
  background: var(--btn-color, #111827); color: var(--btn-fg);
  border: 2px solid rgba(0,0,0,0.05);
}
.link-btn:focus { outline: 3px solid var(--focus); outline-offset: 3px; }
.link-btn .icon svg { width: 20px; height: 20px; fill: currentColor; color: var(--btn-fg); }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.admin-header nav a { margin-left: 12px; text-decoration: none; }
.admin-header nav a.danger { color: #b91c1c; }
.card { background: rgba(0,0,0,0.03); padding: 16px; border-radius: 12px; margin: 16px 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; }
.cards .card { text-align: center; font-size: 1.25rem; }
.alert { background: #ecfccb; color: #365314; padding: 10px 12px; border-radius: 8px; margin: 10px 0; }
.alert-error { background: #fee2e2; color: #7f1d1d; }
label { display: block; margin: 8px 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="url"], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff;
}
button {
  padding: 10px 14px; border: none; border-radius: 8px;
  background: #111827; color: #fff; cursor: pointer;
}
button.danger { background: #b91c1c; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.add-form__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.add-form__row .grid { flex: 1; min-width: 200px; }
.add-heading__label { flex: 1; min-width: 200px; }
.link-item--heading .link-item__meta { margin-top: 0; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid #ddd; }
.table .actions .inline { display: inline-block; margin-right: 6px; }
.link-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.link-item {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: rgba(0,0,0,0.02);
}
.theme-dark .link-item { border-color: #232428; background: rgba(255,255,255,0.04); }
.link-item__row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.link-item .drag {
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  padding: 10px 4px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}
.link-item .drag:active { cursor: grabbing; }
.link-item__fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.link-item__label {
  display: block;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.link-item__label br { display: block; content: ""; margin-top: 2px; }
.link-item__label input {
  width: 100%;
  margin-top: 4px;
}
.link-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 4px;
  justify-content: space-between;
}
.link-item__meta-left {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.link-item__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.link-item--heading .link-item__heading-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}
.link-item--heading .link-item__heading-row .link-item__label {
  flex: 1;
  min-width: 200px;
}
.link-item--heading .link-item__heading-row .link-item__actions {
  margin-left: auto;
  margin-top: 0;
}
.link-item__meta-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.link-item__meta-label .color { width: 36px; height: 28px; padding: 2px; cursor: pointer; }
.link-item__meta-label .icon { min-width: 100px; }
.link-item .delete { background: #b91c1c; color: #fff; }
.tabs { display: flex; gap: 0; margin: 16px 0; border-bottom: 1px solid #d1d5db; }
.tabs .tab { padding: 10px 16px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .tab:hover { color: var(--fg); }
.tabs .tab.active { color: var(--fg); font-weight: 600; border-bottom-color: var(--focus); }
.muted { color: var(--muted); font-size: 0.9rem; }
.passkey-add { margin-top: 8px; }
.passkey-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed #ddd; }
.passkey-item .cred-id { font-family: monospace; font-size: 0.85rem; color: var(--muted); }
.passkey-item .actions { display: flex; gap: 8px; }
.passkey-item .actions button { padding: 6px 10px; font-size: 0.9rem; }
.passkey-item .actions button.danger { background: #b91c1c; }
