/* Redesign 2026-10-15, second handover: settings. Built from tokens.css; shared components live in ui.css.
   Postavke (member/settings.html.twig): pill tabs, one card per section, the
   notification switches as a table, and one sticky save bar. */

.settings { max-width: none; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.settings__tabs { margin-bottom: var(--space-4); }
.settabs { margin: 0; padding: 0; list-style: none; display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; }
.settabs::-webkit-scrollbar { display: none; }
.settabs > li { flex: 0 0 auto; }
.settab, .settab:visited {
    display: inline-flex; align-items: center; min-height: var(--touch-target); padding: 0 var(--space-4);
    border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface);
    color: var(--ink-2); font: 800 13px/1 var(--font-sans); white-space: nowrap;
}
.settab:hover { color: var(--ink); border-color: var(--muted); text-decoration: none; }
.settab:focus-visible { outline: 2px solid var(--blue-700); outline-offset: 2px; }
.settabs .settab.is-current { background: var(--blue-100) !important; border-color: var(--blue-700) !important; color: var(--blue-700) !important; }

/* ── The card each section lives in ───────────────────────────────────── */
.setpanel[hidden] { display: none; }
.setcard {
    display: flex; flex-direction: column; gap: 18px; max-width: 640px; margin: 0; padding: 22px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl);
}
.setcard--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.setcard--grid > .setfield--wide { grid-column: 1 / -1; }
.setcard--flush { max-width: none; padding: 0; gap: 0; overflow: hidden; }

.setfield { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.setfield__label { margin: 0; font: 800 13px/1.3 var(--font-sans); color: var(--ink); }
.setfield__input {
    width: 100%; height: 48px; padding: 0 14px;
    border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface);
    font: 500 16px/1 var(--font-sans); color: var(--ink);
}
.setfield__input:focus { border-color: var(--blue-700); outline: none; box-shadow: 0 0 0 3px var(--blue-100); }
.setfield__select {
    padding-right: 38px; appearance: none; -webkit-appearance: none;
    background: var(--surface) 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.75 6 6.25 11 1.75' fill='none' stroke='%235c6780' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center;
}
.setfield__static {
    display: flex; align-items: center; min-height: 48px; margin: 0; padding: 0 14px;
    border: 1px solid var(--border); border-radius: 12px; background: var(--ground);
    font: 500 16px/1.3 var(--font-sans); color: var(--ink-2); overflow-wrap: anywhere;
}
.setfield__hint { margin: 0; font: 500 13px/1.45 var(--font-sans); color: var(--muted); }
/* An inline link keeps the line height but gets a 44 px tall hit area. */
.setfield__hint a { display: inline-block; min-height: var(--touch-target); line-height: var(--touch-target); margin: -13px 0; color: var(--blue-700); font-weight: 700; }
.setfield__hint--pending { color: var(--amber-800); font-weight: 600; }

/* The current-password box for an e-mail change: shown once the address
   differs, and always when scripts are off (the server decides either way;
   base.html.twig drops `.js` when scripts never run). Hidden from the first
   paint, not only once the controller connects, so the page does not jump. */
.js .setfield--reveal:not(.is-shown) { display: none; }
.setfield--reveal.is-shown { animation: setslide var(--duration-base) var(--ease-out); }
@keyframes setslide { from { opacity: 0; transform: translateY(-4px); } }

.setidentity { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--space-4); margin: 0; padding: var(--space-3) 14px; border-radius: var(--radius-md); background: var(--ground); font: 500 14px/1.4 var(--font-sans); }
.setidentity > div { display: contents; }
.setidentity dt { color: var(--muted); font-weight: 700; }
.setidentity dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.setnote { margin: 0; padding: 10px var(--space-3); border-radius: var(--radius-md); background: var(--ground); font: 500 13px/1.45 var(--font-sans); color: var(--ink-2); }

/* ── Lozinka ──────────────────────────────────────────────────────────── */
.setrules { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: var(--space-1) 0 0; padding: 0; list-style: none; }
.setrules__item { font: 700 13px/1.4 var(--font-sans); color: var(--muted); }
.setrules__item::before { content: "○"; margin-right: 4px; }
.setrules__item.is-met { color: var(--green-700); }
.setrules__item.is-met::before { content: "✓"; }
.setfield__hint--note { margin-top: -4px; }
.setcard .btn--dark { min-height: 48px; padding: 0 20px; font-size: 15px; font-weight: 800; }

/* ── Obavijesti: a table of switches ──────────────────────────────────── */
.setnotif { --setnotif-cols: minmax(0, 1fr) 100px; }
.setnotif--app { --setnotif-cols: minmax(0, 1fr) 100px 110px; }
.setnotif__head, .setnotif__row { display: grid; grid-template-columns: var(--setnotif-cols); gap: var(--space-3); align-items: center; }
.setnotif__head { padding: var(--space-3) 22px; background: var(--ground); font: 800 12px/1.3 var(--font-sans); color: var(--muted); }
.setnotif__col { justify-self: center; text-align: center; }
.setnotif__group { margin: 0; padding: 0 0 var(--space-2); border: 0; border-top: 1px solid var(--border); min-width: 0; }
.setnotif__legend { float: left; width: 100%; padding: 14px 22px 6px; font: 800 12px/1.3 var(--font-sans); letter-spacing: .04em; text-transform: uppercase; color: var(--blue-700); }
.setnotif__legend + * { clear: both; }
.setnotif__row { padding: 8px 22px; }
.setnotif__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.setnotif__label { font: 700 15px/1.35 var(--font-sans); color: var(--ink); }
.setnotif__hint { font: 500 13px/1.4 var(--font-sans); color: var(--muted); }
.setnotif__consent { margin: 0; padding: 0 22px var(--space-2); font: 600 13px/1.4 var(--font-sans); color: var(--green-700); }

/* The switch is a real checkbox drawn as a track; the label around it is the
   44 × 44 target. */
.setswitch__hit { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; min-height: var(--touch-target); cursor: pointer; }
.setswitch {
    position: relative; flex: none; width: 48px; height: 28px; margin: 0;
    appearance: none; -webkit-appearance: none; border-radius: var(--radius-pill); background: var(--border-strong);
    cursor: pointer; transition: background-color var(--duration-fast) var(--ease-out);
}
.setswitch::before {
    content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%;
    background: var(--surface); box-shadow: var(--shadow-float); transition: transform var(--duration-fast) var(--ease-out);
}
.setswitch:checked { background: var(--green-700); }
.setswitch:checked::before { transform: translateX(20px); }
.setswitch:focus-visible { outline: 2px solid var(--blue-700); outline-offset: 3px; }

.setlocale { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0; padding: var(--space-4) 22px; border: 0; border-top: 1px solid var(--border); min-width: 0; }
.setlocale__legend { margin-right: auto; font: 800 13px/1.3 var(--font-sans); color: var(--ink); }
.setlocale__options { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-left: auto; }
.setlocale__pill { position: relative; display: inline-flex; cursor: pointer; }
.setlocale__pill input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.setlocale__pill span {
    display: inline-flex; align-items: center; min-height: var(--touch-target); padding: 0 var(--space-4);
    border: 1px solid var(--border-strong); border-radius: var(--radius-pill); background: var(--surface);
    font: 800 13px/1 var(--font-sans); color: var(--ink-2);
}
.setlocale__pill input:checked + span { background: var(--blue-100) !important; border-color: var(--blue-700) !important; color: var(--blue-700) !important; }
.setlocale__pill input:focus-visible + span { outline: 2px solid var(--blue-700); outline-offset: 2px; }

/* ── The save bar ─────────────────────────────────────────────────────── */
/* The top rule keeps the bar apart from the navy footer when scrolled to the end. */
.savebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; border-top: 1px solid var(--tone-sky-ink); background: var(--navy-900); color: var(--surface); box-shadow: var(--shadow-sheet); }
.savebar[hidden] { display: none; }
/* Before the controller connects, a scripted page must not flash the bar. */
.js .settings:not(.is-enhanced) .savebar { display: none; }
.savebar.is-shown { animation: setbarin var(--duration-base) var(--ease-out); }
.savebar.is-nudged { animation: setbarnudge 400ms var(--ease-out); }
@keyframes setbarin { from { transform: translateY(100%); } }
@keyframes setbarnudge { 25% { transform: translateY(-6px); } 60% { transform: translateY(2px); } }
.savebar__inner { display: flex; align-items: center; gap: var(--space-3); max-width: var(--content-max); margin: 0 auto; padding: 14px var(--space-8); padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.savebar__text { flex: 1; margin: 0; font: 700 15px/1.3 var(--font-sans); }
.savebar__discard {
    min-height: var(--touch-target); padding: 0 var(--space-4); border: 1px solid var(--tone-sky-ink); border-radius: var(--radius-md);
    background: transparent; color: var(--surface); font: 700 13px/1 var(--font-sans); cursor: pointer;
}
.savebar__discard:hover { border-color: var(--surface); }
.savebar__discard:focus-visible, .savebar__save:focus-visible { outline: 2px solid var(--surface); outline-offset: 2px; }
.savebar .savebar__save { min-height: var(--touch-target); padding: 0 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 800; }
/* Room under the page for the bar, so it never covers the last row. */
body:has(.settings .savebar:not([hidden])) { padding-bottom: 80px; }
/* And a field focused mid-page scrolls clear of it, not behind it. */
html:has(.settings .savebar:not([hidden])) { scroll-padding-bottom: 96px; }

@media (max-width: 700px) {
    .settabs { margin: 0 calc(-1 * var(--space-4)); padding: 0 var(--space-4); }
    .settabs::after { content: ""; flex: 0 0 var(--space-1); }
    .setcard { padding: var(--space-4); border-radius: var(--radius-lg); }
    .setcard--flush { padding: 0; }
    /* Poštanski broj and Grad stay side by side, as in the design. */
    .setcard--grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: var(--space-4) var(--space-3); }
    .setnotif { --setnotif-cols: minmax(0, 1fr) 64px; }
    .setnotif--app { --setnotif-cols: minmax(0, 1fr) 56px 72px; }
    .setnotif__head, .setnotif__row { gap: var(--space-2); padding-left: var(--space-4); padding-right: var(--space-4); }
    .setnotif__head { font-size: 12px; }
    .setnotif__head .setnotif__col { white-space: nowrap; }
    .setnotif__legend { padding-left: var(--space-4); padding-right: var(--space-4); }
    .setnotif__consent { padding-left: var(--space-4); padding-right: var(--space-4); }
    .setlocale { padding: var(--space-4); }
    .setlocale__options { margin-left: 0; }
    .savebar__inner { flex-wrap: wrap; padding-left: var(--space-4); padding-right: var(--space-4); gap: var(--space-2) var(--space-3); }
    .savebar__text { flex: 1 1 100%; font-size: 14px; }
    .savebar__discard, .savebar .savebar__save { flex: 1 1 0; justify-content: center; }
    body:has(.settings .savebar:not([hidden])) { padding-bottom: 128px; }
    html:has(.settings .savebar:not([hidden])) { scroll-padding-bottom: 140px; }
}

@media (prefers-reduced-motion: reduce) {
    .setfield--reveal.is-shown, .savebar.is-shown, .savebar.is-nudged { animation: none; }
    .setswitch, .setswitch::before { transition: none; }
}
