/* =========================================================
   Admin-only styles (loaded only when logged in)
   ========================================================= */
.adm { display: none !important; }
body.edit-mode .adm { display: inline-flex !important; }
body.edit-mode .adm-block.adm { display: flex !important; }

/* Floating admin bar */
.admbar { position: fixed; z-index: 60; left: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 4px; padding: 5px; background: var(--ink); color: var(--bg); border-radius: 999px; box-shadow: var(--shadow-2); }
@media (min-width: 1024px) { .admbar { bottom: 20px; left: 20px; } }
.admbar button, .admbar a { height: 36px; min-width: 36px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; font-size: 14px; cursor: pointer; }
.admbar button:hover, .admbar a:hover { background: rgba(127,127,127,.25); }
.admbar .uil { font-size: 18px; }
.admbar .lbl { display: none; }
@media (min-width: 640px) { .admbar .lbl { display: inline; } }
.switch { position: relative; width: 38px; height: 22px; border-radius: 99px; background: rgba(127,127,127,.5); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.on .switch { background: #22c55e; } .on .switch::after { transform: translateX(16px); }

/* Add buttons in section headers */
.adm-add { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px dashed var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; align-items: center; gap: 4px; }
.adm-add:hover { background: var(--accent); color: #fff; border-style: solid; }
.adm-add .uil { font-size: 18px; }

/* "⋯" on cards */
.adm-more { position: absolute; top: 8px; right: 8px; z-index: 3; width: 32px; height: 32px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); align-items: center; justify-content: center; font-size: 20px; color: var(--ink); cursor: pointer; }
.adm-more:hover { background: var(--ink); color: var(--bg); }
.doc .adm-more { position: static; box-shadow: none; }
.post .adm-more { top: 6px; right: 6px; }
.menu { position: fixed; z-index: 100; min-width: 190px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; font-size: 15px; text-align: left; color: var(--ink); }
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* Drop zones */
.drop-hint { position: absolute; inset: 0; z-index: 20; display: none; place-items: center; text-align: center; border: 3px dashed var(--accent); border-radius: var(--r-lg); background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent); font-weight: 700; font-size: 18px; pointer-events: none; }
.drop-hint .uil { font-size: 44px; display: block; }
body.dragging-files.edit-mode [data-drop] { position: relative; }
body.dragging-files.edit-mode [data-drop] > .drop-hint { display: grid; }
[data-drop].drop-over > .drop-hint { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }

/* Album tools */
.alb-tools { flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.alb-tools .btn { height: 32px; font-size: 13px; padding: 0 10px; }
.cur-tools { flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); padding: 8px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 8px; }
.cur-tools .btn { height: 30px; font-size: 13px; padding: 0 10px; }
.thumbs .cov { position: absolute; top: 3px; left: 3px; background: var(--gold); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 5px; line-height: 16px; }
.thumbs.selecting button { opacity: 1; }
.thumbs.selecting button::after { content: ""; position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; background: rgba(0,0,0,.3); box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.thumbs.selecting button.sel { border-color: var(--red); }
.thumbs.selecting button.sel::after { background: var(--red); }

/* Forms */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span, .field > label.lab { font-weight: 600; font-size: 14px; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 13px; }
.row2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 600px) { .row2 { grid-template-columns: 1fr 1fr; } }
.input, .form input[type=text], .form input[type=url], .form input[type=email], .form input[type=date], .form input[type=password], .form select, .form textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.form textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.seg input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; user-select: none; }
.pub input { width: 20px; height: 20px; accent-color: var(--green); }
.pub b { font-size: 15px; } .pub small { display: block; color: var(--muted); font-size: 13px; }

.dropzone { position: relative; display: grid; place-items: center; text-align: center; gap: 4px; min-height: 120px; padding: 16px; border: 2px dashed var(--line); border-radius: 14px; background: var(--surface-2); color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .uil { font-size: 34px; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-prev { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.file-prev img, .file-prev .ic { width: 72px; height: 54px; object-fit: contain; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 26px; color: var(--muted); flex: none; }
.file-prev .t { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 6px; }
.pending-grid img { aspect-ratio: 1; object-fit: cover; border-radius: 8px; width: 100%; }

/* Rich editor */
.editor-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.editor-wrap .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: -18px; z-index: 2; }
.editor-wrap .ql-container.ql-snow { border: 0; font: inherit; font-size: 16px; }
.editor-wrap .ql-editor { min-height: 220px; max-height: 55vh; overflow-y: auto; line-height: 1.7; color: var(--ink); }
.editor-wrap .ql-editor img { max-width: 100%; height: auto; }
.editor-wrap textarea.raw { width: 100%; min-height: 260px; border: 0; padding: 12px; font: 13px/1.5 ui-monospace, Menlo, monospace; background: var(--surface); color: var(--ink); resize: vertical; }
.editor-switch { display: flex; justify-content: flex-end; padding: 4px 8px; border-top: 1px solid var(--line); background: var(--surface-2); }
.editor-switch button { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
:root[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--ink-2); } :root[data-theme="dark"] .ql-snow .ql-fill { fill: var(--ink-2); } :root[data-theme="dark"] .ql-snow .ql-picker { color: var(--ink-2); }
:root[data-theme="dark"] .ql-snow .ql-picker-options { background: var(--surface); }

/* Quiz builder */
.qb { border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 8px; background: var(--surface-2); }
.qb-head { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.qb-head .sp { flex: 1; }
.qb-opt { display: grid; grid-template-columns: auto auto 1fr; gap: 8px; align-items: center; }
.qb-opt input[type=radio] { width: 20px; height: 20px; accent-color: var(--green); }
.qb-opt b { width: 18px; text-align: center; color: var(--muted); }
.qb-opt input[type=text] { height: 38px; }
.qb-opt:has(input[type=radio]:checked) input[type=text] { border-color: var(--green); background: var(--green-soft); }

/* Upload queue */
.upq { position: fixed; z-index: 110; right: 12px; bottom: calc(92px + env(safe-area-inset-bottom)); width: min(340px, calc(100% - 24px)); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); overflow: hidden; }
@media (min-width: 1024px) { .upq { bottom: 20px; right: 20px; } }
.upq-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--line); }
.upq-head .sp { flex: 1; }
.upq-list { max-height: 220px; overflow-y: auto; }
.upq-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.upq-item .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upq-item .st { color: var(--muted); }
.upq-item .bar { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.upq-item .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upq-item.done .bar i { background: var(--green); } .upq-item.err .st { color: var(--red); } .upq-item.err .bar i { background: var(--red); }

/* Settings tabs */
.stabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.cat-row .sp { flex: 1; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches label { cursor: pointer; }
.swatches input { position: absolute; opacity: 0; }
.swatches span { display: block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatches input:checked + span { box-shadow: 0 0 0 2px var(--ink); }

/* Manager (admin/index.php) */
.mgr { padding: 20px 0 60px; }
.mgr-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.mgr-head h1 { font-size: 24px; margin-right: auto; }
.mgr-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; margin-bottom: 10px; }
.mgr-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.mgr-bar .search { flex: 1; min-width: 200px; position: relative; }
.mgr-bar .search input { width: 100%; height: 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px 0 38px; font: inherit; color: var(--ink); }
.mgr-bar .search .uil { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 18px; }
.mgr-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.mrow { display: flex; gap: 10px; align-items: center; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.mrow .th { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); font-size: 24px; cursor: pointer; }
.mrow .t { flex: 1; min-width: 0; cursor: pointer; }
.mrow .t b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .t small { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mrow .acts { display: flex; gap: 4px; flex: none; }
.vis-btn.is-pub { color: var(--green); } .vis-btn.is-draft { color: var(--gold); }
body.edit-mode .adm.hidden { display: none !important; }
@media (min-width: 700px) { .mgr-grid { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.mrow .acts .icon-btn { width: 30px; height: 30px; border-color: transparent; }
.mrow .acts .icon-btn:hover { border-color: var(--line); }
.mrow .t small .badge { padding: 0 6px; }

/* Profile photo picker (settings) */
.hero-pics { display: flex; flex-wrap: wrap; gap: 10px; }
.hp { position: relative; width: 72px; height: 72px; }
.hp img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: top; border: 2px solid var(--line); }
.hp.main img { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hp button { position: absolute; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 12px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.hp .hp-star { left: -4px; bottom: -4px; color: var(--gold); } .hp.main .hp-star { background: var(--gold); color: #fff; border-color: var(--gold); }
.hp .hp-x { right: -4px; top: -4px; color: var(--red); }
