/* iSite website control panel (sites.js). Same four colours as app.css: black, white, mint, orange. Phone first. */

/* Tap targets: small buttons stay 44px high inside the panel */
.st .btn.small { min-height: 44px; }
.st .sm { font-size: 0.8rem; }
.st h2 { overflow-wrap: anywhere; }
.st-wrap { overflow-wrap: anywhere; text-align: right; }
.st-note { margin: 0; padding: 8px 12px; border: 2px solid var(--orange); border-radius: 10px; font-weight: 800; }
.st-bad { color: var(--orange); font-weight: 800; }
.st-h2gap { margin: 18px 0 0; }
.st-flabel { font-weight: 800; font-size: 0.92rem; }
.st-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
body.st-lock { overflow: hidden; }

/* Header */
.st-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; margin-top: 10px; }
.st-title { min-width: 0; }
.st-title h1 { overflow-wrap: anywhere; }
.st-title .row { gap: 8px; }
.st-actions .btn { flex: 1 1 auto; }
#msg { margin: 14px 0 0; }

/* Tab row: scrolls sideways inside itself on phones */
.st-tabs { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: thin; scrollbar-color: var(--mint) var(--black); margin: 18px 0 18px; padding: 2px 2px 10px; }
.st-tabs a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 2px solid var(--white); border-radius: 999px; color: var(--white); text-decoration: none; font-weight: 800; white-space: nowrap; }
.st-tabs a:hover { border-color: var(--mint); color: var(--mint); }
.st-tabs a[aria-current="page"] { background: var(--mint); border-color: var(--mint); color: var(--black); }

/* Template cards */
.st-tpls { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.st-tpl { position: relative; display: block; cursor: pointer; }
.st-tpl input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; min-height: 0; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.st-tpl-in { display: flex; flex-direction: column; gap: 6px; height: 100%; border: 2px solid var(--white); border-radius: 16px; padding: 12px; transition: border-color .15s, background .15s; }
.st-tpl-in strong { font: 900 1.15rem var(--font); }
.st-tpl input:checked + .st-tpl-in { background: var(--mint); border-color: var(--mint); color: var(--black); }
.st-tpl input:focus-visible + .st-tpl-in { outline: 2px solid var(--orange); outline-offset: 2px; }
.st-mock { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: 12px 46px 26px; gap: 5px; padding: 8px; height: 110px; border-radius: 10px; background: var(--white); border: 2px solid var(--black); }
.st-mock i { grid-column: 1 / -1; border-radius: 4px; background: var(--black); }
.st-mock b { grid-column: 1 / -1; border-radius: 6px; background: var(--mint); }
.st-mock em { border-radius: 6px; border: 2px solid var(--black); }
.st-mock-nails b { background: var(--orange); border-radius: 22px; }
.st-mock-nails em { border-radius: 50%; }
.st-mock-barber { background: var(--black); border-color: var(--white); }
.st-mock-barber i { background: var(--orange); }
.st-mock-barber b { background: repeating-linear-gradient(45deg, var(--white) 0 8px, var(--black) 8px 16px); }
.st-mock-barber em { border-color: var(--white); }
.st-mock-guesthouse { grid-template-rows: 12px 58px 14px; }
.st-mock-guesthouse b { background: linear-gradient(var(--mint) 60%, var(--orange) 60%); }
.st-mock-guesthouse em { background: var(--black); border-radius: 3px; }
.st-mock-general b { background: var(--black); }
.st-mock-general em { background: var(--mint); border-color: var(--mint); }

/* Address field with a fixed prefix */
.st-prefix { display: flex; align-items: stretch; flex-wrap: wrap; border: 2px solid var(--white); border-radius: 10px; overflow: hidden; }
.st-prefix > span { display: flex; align-items: center; padding: 8px 10px; background: var(--white); color: var(--black); font: 500 0.85rem var(--mono); overflow-wrap: anywhere; max-width: 100%; }
.st-prefix input { flex: 1 1 140px; min-width: 0; border: 0; border-radius: 0; }
.st-prefix:focus-within { border-color: var(--mint); }

/* Editor */
.st-ed { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; align-items: start; }
.st-pages { position: sticky; top: 16px; }
.st-ed .card + .card, .st-secs .card + .card { margin-top: 0; }
.st-secs { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.st-plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.st-plist li { display: flex; flex-direction: column; gap: 6px; border: 2px solid var(--white); border-radius: 12px; padding: 6px; }
.st-plist li.on { border-color: var(--mint); }
.st-pbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 8px; background: var(--black); color: var(--white); font-weight: 900; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.st-plist li.on .st-pbtn { background: var(--mint); color: var(--black); }
.st-slug { font: 500 0.78rem var(--mono); }
.st-mini { gap: 6px; }
.st-mini .btn { padding: 4px 10px; }
.st-sec header { margin-bottom: 12px; gap: 8px; }
.st-sec.is-hidden { border-style: dashed; border-color: var(--orange); }
.st-add { align-items: flex-end; }
.st-add .f { flex: 1 1 220px; }
.st-items { gap: 10px; }
.st-item { display: flex; flex-direction: column; gap: 10px; border: 2px solid var(--mint); border-radius: 12px; padding: 12px; }
.st-img { display: flex; flex-direction: column; gap: 6px; }
.st-img-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.st-img-row img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 2px solid var(--white); background: var(--black); }
.st-noimg { display: grid; place-items: center; width: 96px; height: 96px; border: 2px dashed var(--white); border-radius: 10px; font-size: 0.8rem; text-align: center; }
.st-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.st-gal figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.st-gal img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; border: 2px solid var(--white); }
.st-colour .row { flex-wrap: nowrap; gap: 8px; }
.st-colour input[type="color"] { width: 56px; min-width: 56px; height: 46px; padding: 4px; cursor: pointer; }
.st-count { font: 500 0.78rem var(--mono); }
.st-count.over { background: var(--orange); color: var(--black); border-radius: 999px; padding: 0 8px; }
.st-warn { border: 2px solid var(--orange); border-radius: 12px; padding: 10px 14px; margin-top: 14px; }
.st-warn ul { margin: 6px 0 0; padding-left: 18px; }

/* Sticky save bar: sits above the phone tab bar */
.st-save { position: sticky; bottom: 12px; z-index: 8; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; padding: 10px 12px; background: var(--black); border: 2px solid var(--white); border-radius: 14px; font-weight: 800; }
.st-save.on { border-color: var(--orange); }
.st-save.on #st-savestate { color: var(--orange); }
.st-save .btn { flex: 0 0 auto; }
@media (max-width: 820px) { .st-save { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); } }

/* Media */
.st-file { position: relative; overflow: hidden; }
.st-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.st-up { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; font-size: 0.88rem; }
.st-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-up .track { height: 12px; border: 2px solid var(--white); border-radius: 999px; overflow: hidden; }
.st-up .fill { height: 100%; background: var(--mint); transition: width .15s; }
.st-up.bad .st-up-state { color: var(--orange); }
.st-up.bad .fill { background: var(--orange); width: 100% !important; }
@media (max-width: 480px) { .st-up { grid-template-columns: minmax(0, 1fr) auto; } .st-up .track { grid-column: 1 / -1; grid-row: 2; } }
.st-mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.st-mitem { margin: 0; border: 2px solid var(--white); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.st-mitem img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--black); }
.st-mitem figcaption { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.st-mitem .row { gap: 6px; }
.st-mitem .btn { flex: 1 1 auto; padding: 4px 8px; }

/* Media picker */
.st-modal { position: fixed; inset: 0; z-index: 60; background: var(--black); display: flex; justify-content: center; align-items: flex-start; padding: 16px; overflow-y: auto; }
.st-modal-in { width: 100%; max-width: 760px; background: var(--black); }
.st-pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.st-pick { display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 2px solid var(--white); border-radius: 12px; background: var(--black); color: var(--white); font-weight: 800; cursor: pointer; min-height: 44px; }
.st-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.st-pick[aria-pressed="true"] { border-color: var(--mint); background: var(--mint); color: var(--black); }

/* Preview */
.st-ov { position: fixed; inset: 0; z-index: 60; background: var(--black); display: flex; flex-direction: column; padding: 12px 16px; gap: 8px; }
.st-ovhead h2 { margin: 0; }
.st-ov .st-pv { flex: 1; min-height: 0; }
.st-pv { display: flex; flex-direction: column; gap: 8px; }
.st-pv .muted-note { margin: 0; }
.st-pvbar { align-items: flex-end; gap: 8px; }
.st-pvpage { flex: 1 1 180px; }
.st-seg { display: flex; gap: 0; }
.st-seg .btn { border-radius: 0; }
.st-seg .btn:first-child { border-radius: 12px 0 0 12px; }
.st-seg .btn:last-child { border-radius: 0 12px 12px 0; margin-left: -2px; }
.st-seg .btn[aria-pressed="true"] { background: var(--mint); border-color: var(--mint); color: var(--black); }
.st-frame { flex: 1; min-height: 70vh; display: flex; justify-content: center; border: 2px solid var(--mint); border-radius: 14px; padding: 8px; overflow: auto; }
.st-ov .st-frame { min-height: 0; }
.st-frame iframe { width: 100%; height: 100%; min-height: 66vh; border: 0; border-radius: 8px; background: var(--white); }
.st-frame.phone iframe { width: 390px; max-width: 100%; }

/* Enquiries */
.st-enq { display: flex; flex-direction: column; gap: 10px; }
.st-enq.done { border-style: dashed; }
.st-msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.st-enqs .card + .card, #st-enqs .card + .card { margin-top: 0; }

/* Settings */
.st-toggle { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; min-height: 44px; }
.st-toggle input { width: 28px; height: 28px; min-height: 28px; flex-shrink: 0; margin: 2px 0 0; accent-color: var(--mint); }
.st-toggle > span { display: flex; flex-direction: column; gap: 2px; }
.st-danger { border-color: var(--orange); margin-top: 14px; }
.st .stack > .card + .card { margin-top: 0; }

@media (max-width: 900px) {
  .st-ed { grid-template-columns: minmax(0, 1fr); }
  .st-pages { position: static; }
}
@media (max-width: 480px) {
  .st-actions { width: 100%; }
  .st-sec header { flex-direction: column; align-items: flex-start; }
}
