/* ==========================================================================
   Alap: színek, tipográfia, gombok, űrlapok – Apple Human Interface szellemében
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --bg-3: #fbfbfd;
  --elev: #ffffff;
  --fill: rgba(120, 120, 128, 0.12);
  --fill-2: rgba(120, 120, 128, 0.08);
  --fill-3: rgba(120, 120, 128, 0.05);
  --label: #1d1d1f;
  --label-2: #6e6e73;
  --label-3: #86868b;
  --sep: rgba(60, 60, 67, 0.13);
  --sep-strong: rgba(60, 60, 67, 0.22);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --link: #0066cc;
  --green: #1b8a3e;
  --green-soft: #e3f6e8;
  --orange: #a35f00;
  --orange-soft: #fff4d6;
  --red: #d70015;
  --red-soft: #fde4e2;
  --violet: #6e3fd6;
  --violet-soft: #f3eeff;
  --cell-ai: #eaf3ff;
  --cell-user: #f3eeff;
  --glass: rgba(251, 251, 253, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.06), 0 16px 48px rgba(0, 0, 0, 0.1);
  --shadow-3: 0 12px 32px rgba(0, 0, 0, 0.12), 0 40px 100px rgba(0, 0, 0, 0.18);
  --r-xs: 8px;
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 28px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-2: #161617;
    --bg-3: #0c0c0d;
    --elev: #1c1c1e;
    --fill: rgba(120, 120, 128, 0.26);
    --fill-2: rgba(120, 120, 128, 0.18);
    --fill-3: rgba(120, 120, 128, 0.1);
    --label: #f5f5f7;
    --label-2: #a1a1a6;
    --label-3: #8e8e93;
    --sep: rgba(84, 84, 88, 0.5);
    --sep-strong: rgba(84, 84, 88, 0.8);
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --accent-soft: rgba(10, 132, 255, 0.18);
    --link: #2997ff;
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.16);
    --orange: #ffb340;
    --orange-soft: rgba(255, 159, 10, 0.16);
    --red: #ff6961;
    --red-soft: rgba(255, 69, 58, 0.16);
    --violet: #bf9bff;
    --violet-soft: rgba(191, 90, 242, 0.16);
    --cell-ai: rgba(10, 132, 255, 0.14);
    --cell-user: rgba(191, 90, 242, 0.16);
    --glass: rgba(22, 22, 23, 0.78);
    --glass-strong: rgba(28, 28, 30, 0.88);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-3: 0 20px 60px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-2: #161617;
  --bg-3: #0c0c0d;
  --elev: #1c1c1e;
  --fill: rgba(120, 120, 128, 0.26);
  --fill-2: rgba(120, 120, 128, 0.18);
  --fill-3: rgba(120, 120, 128, 0.1);
  --label: #f5f5f7;
  --label-2: #a1a1a6;
  --label-3: #8e8e93;
  --sep: rgba(84, 84, 88, 0.5);
  --sep-strong: rgba(84, 84, 88, 0.8);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-soft: rgba(10, 132, 255, 0.18);
  --link: #2997ff;
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.16);
  --orange: #ffb340;
  --orange-soft: rgba(255, 159, 10, 0.16);
  --red: #ff6961;
  --red-soft: rgba(255, 69, 58, 0.16);
  --violet: #bf9bff;
  --violet-soft: rgba(191, 90, 242, 0.16);
  --cell-ai: rgba(10, 132, 255, 0.14);
  --cell-user: rgba(191, 90, 242, 0.16);
  --glass: rgba(22, 22, 23, 0.78);
  --glass-strong: rgba(28, 28, 30, 0.88);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 20px 60px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Tipográfia ---------- */
.eyebrow { font-size: 17px; font-weight: 600; color: var(--label-2); letter-spacing: -0.01em; margin: 0 0 8px; }
.display {
  font-size: clamp(44px, 7.4vw, 88px); line-height: 1.04; font-weight: 700;
  letter-spacing: -0.04em; margin: 0;
}
.headline {
  font-size: clamp(34px, 5.2vw, 56px); line-height: 1.07; font-weight: 700;
  letter-spacing: -0.035em; margin: 0;
}
.title { font-size: clamp(24px, 3vw, 32px); line-height: 1.12; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.lead { font-size: clamp(19px, 2.1vw, 24px); line-height: 1.38; color: var(--label-2); letter-spacing: -0.02em; font-weight: 500; }
.muted { color: var(--label-2); }
.small { font-size: 14px; letter-spacing: -0.01em; }
.tiny { font-size: 12px; letter-spacing: 0; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Gombok ---------- */
.btn {
  --h: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 22px; border: 0; border-radius: 980px;
  font-size: 17px; font-weight: 500; letter-spacing: -0.02em; white-space: nowrap;
  cursor: pointer; text-decoration: none !important; user-select: none;
  transition: background-color 0.2s var(--ease), transform 0.15s var(--ease), opacity 0.2s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--fill); color: var(--label); }
.btn-secondary:hover { background: color-mix(in srgb, var(--fill) 100%, var(--label) 6%); }
.btn-tinted { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-plain { background: transparent; color: var(--link); padding: 0 10px; }
.btn-plain:hover { background: var(--fill-2); }
.btn-sm { --h: 32px; padding: 0 14px; font-size: 14px; }
.btn-lg { --h: 52px; padding: 0 30px; font-size: 18px; }
.btn-block { width: 100%; }
.link-arrow { font-size: 17px; color: var(--link); display: inline-flex; align-items: center; gap: 2px; }
.link-arrow::after { content: "›"; font-size: 1.25em; line-height: 1; transform: translateY(-1px); margin-left: 2px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--label-2);
  transition: background-color 0.15s, color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: var(--fill-2); color: var(--label); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }

/* ---------- Űrlapelemek ---------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--label-2); letter-spacing: -0.005em; }
.hint { font-size: 13px; color: var(--label-3); letter-spacing: -0.005em; }
.input, .textarea, .select {
  width: 100%; font: inherit; font-size: 16px; color: var(--label);
  background: var(--fill-2); border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 11px 14px; outline: none; letter-spacing: -0.015em;
  transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}
.input:focus, .textarea:focus, .select:focus {
  background: var(--elev); border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2386868b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.input::placeholder, .textarea::placeholder { color: var(--label-3); }

/* iOS kapcsoló */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 31px; background: var(--fill);
  transition: background-color 0.25s var(--ease); cursor: pointer;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16);
  transition: transform 0.3s var(--spring);
}
.switch input:checked + span { background: #34c759; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--accent-soft); }

/* Szegmentált vezérlő */
.segmented {
  display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
  background: var(--fill-2); border-radius: 10px; padding: 2px; position: relative;
}
.segmented button {
  border: 0; background: transparent; border-radius: 8px; padding: 6px 14px; font-size: 14px;
  font-weight: 500; color: var(--label); cursor: pointer; white-space: nowrap;
  transition: background-color 0.2s, box-shadow 0.2s;
}
.segmented button[aria-pressed="true"] {
  background: var(--elev); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

/* Címkék, jelvények */
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border-radius: 999px; background: var(--fill-2); color: var(--label); font-size: 13px;
  font-weight: 500; letter-spacing: -0.005em; border: 0; cursor: default; white-space: nowrap;
}
button.chip { cursor: pointer; }
button.chip:hover { background: var(--fill); }
.chip.on { background: var(--accent-soft); color: var(--accent); }
.chip svg { width: 14px; height: 14px; }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.badge.a { background: var(--green-soft); color: var(--green); }
.badge.b { background: var(--orange-soft); color: var(--orange); }
.badge.c { background: var(--red-soft); color: var(--red); }
.badge.neutral { background: var(--fill-2); color: var(--label-2); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }

/* Kártya */
.card { background: var(--elev); border-radius: var(--r); box-shadow: var(--shadow-1); }

/* Logó-ikon */
.app-icon {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(145deg, #2f8cff 0%, #0058d6 55%, #4b3fd8 100%);
  display: grid; place-items: center; color: #fff;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
}
.app-icon svg { width: 62%; height: 62%; }
.app-icon.lg { width: 72px; height: 72px; border-radius: 18px; }
.app-icon.xl { width: 96px; height: 96px; border-radius: 22px; }

/* Pörgő jelző */
.spinner {
  width: 16px; height: 16px; border-radius: 50%; flex: none;
  border: 2px solid var(--fill); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-6px); }
  40%, 60% { transform: translateX(6px); }
}
.shake { animation: shake 0.45s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
