/* ============================================================================
   Admin console — professional, cyber-themed, mobile/touch friendly.
   Layered on top of style.css (shares the design tokens).
   ============================================================================ */

.admin-body { min-height: 100vh; }

/* ── Auth gate (login / setup) ── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth__card { position: relative; width: min(420px, 100%); padding: 40px 34px 34px; border-radius: 22px;
    background: rgba(18, 18, 32, 0.86); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-lit); box-shadow: var(--shadow), 0 0 70px rgba(108, 99, 255, 0.16);
    text-align: center; overflow: hidden; animation: auth-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.auth__card::before { content: ''; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); }
@keyframes auth-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
.auth__brand { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.3px; color: var(--faint); margin-bottom: 20px; }
.auth__brand img { border-radius: 6px; }
.auth__logo { font-size: 44px; margin-bottom: 14px; filter: drop-shadow(0 0 22px rgba(108, 99, 255, 0.55)); }
.auth__title { font-size: 24px; font-weight: 900; margin-bottom: 8px; font-family: var(--font-head); }
.auth__sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.auth__form { display: flex; flex-direction: column; gap: 16px; text-align: start; }
.auth__form label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.auth__form input { padding: 13px 14px; border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); color: var(--text); font-size: 16px; font-family: inherit; }
.auth__form input:focus { outline: none; border-color: var(--border-lit); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15); }
.auth__form .btn { margin-top: 6px; }
.auth__err { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 18px;
    background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35);
    color: var(--danger); font-size: 13.5px; font-weight: 600; }
.auth__back { display: inline-block; margin-top: 22px; color: var(--faint); font-size: 13px; }
.auth__back:hover { color: var(--muted); }

/* ── Editor shell ── */
.adm { max-width: 1080px; margin-inline: auto; padding: 20px clamp(14px, 3vw, 24px) 60px; }

/* Top bar */
.adm__top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 16px; margin-bottom: 20px; border-radius: 16px;
    background: rgba(12, 12, 22, 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3); }
.adm__brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 800;
    font-family: var(--font-head); white-space: nowrap; }
.adm__top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adm__user { font-size: 13px; color: var(--muted); font-weight: 600; }
.adm__lang { display: inline-flex; align-items: center; gap: 7px; }
.adm__lang img { border-radius: 2px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12); }
.adm__menu-toggle { display: none; width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 20px; }

/* Flash + hint */
.adm__flash { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 16px; font-weight: 600; font-size: 14.5px; }
.adm__flash--ok { background: rgba(74, 222, 128, 0.12); border: 1px solid rgba(74, 222, 128, 0.35); color: #4ade80; }
.adm__flash--err { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.35); color: var(--danger); }
.adm__hint { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.6; }

/* ── Collapsible groups ── */
.grp { border: 1px solid var(--border); border-radius: 16px; margin-bottom: 16px; overflow: hidden;
    background: var(--surface); }
.grp--danger { border-color: rgba(248, 113, 113, 0.25); }
.grp--media { border-color: rgba(34, 211, 238, 0.28); }
.grp__head { display: flex; align-items: center; gap: 12px; padding: 17px 20px; cursor: pointer; user-select: none;
    font-weight: 800; font-size: 16px; list-style: none; min-height: 56px; font-family: var(--font-head); }
.grp__head::-webkit-details-marker { display: none; }
.grp__head::after { content: '▾'; margin-inline-start: auto; color: var(--faint); font-size: 13px; transition: transform 0.2s; }
.grp[open] > .grp__head::after { transform: rotate(180deg); }
.grp__head:hover { background: var(--surface-2); }
.grp__icon { font-size: 20px; }
.grp__title { flex: 1; }
.grp__count { font-size: 12px; font-weight: 700; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--surface-2); }
.grp[open] > .grp__head { border-bottom: 1px solid var(--border); }
.grp__body { padding: 20px; display: flex; flex-direction: column; gap: 22px; }

/* ── Fields ── */
.fld { display: flex; flex-direction: column; gap: 8px; }
.fld__label { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fld__badge { font-size: 11px; font-weight: 600; color: var(--accent-2); padding: 2px 9px; border-radius: 999px; background: rgba(34, 211, 238, 0.1); }
.fld__inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fld__col { display: flex; flex-direction: column; gap: 6px; }
.fld__lang { font-size: 11.5px; font-weight: 600; color: var(--faint); }
.fld input, .fld textarea { width: 100%; padding: 12px 13px; border-radius: 10px;
    background: rgba(0, 0, 0, 0.28); border: 1px solid var(--border); color: var(--text); font-size: 15px; font-family: inherit; resize: vertical; line-height: 1.6; }
.fld textarea { min-height: 120px; }
.fld input:focus, .fld textarea:focus { outline: none; border-color: var(--border-lit); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.13); }

/* "Pick from library" button on image fields */
.fld__pick { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
    background: rgba(34, 211, 238, 0.12); border: 1px solid rgba(34, 211, 238, 0.35); color: var(--accent-2);
    font-family: inherit; font-size: 12px; font-weight: 700; transition: background 0.15s; }
.fld__pick:hover { background: rgba(34, 211, 238, 0.2); }
.fld__preview { margin-top: 4px; }
.fld__preview img { max-height: 130px; width: auto; border-radius: 10px; border: 1px solid var(--border); }

/* ── Media manager ── */
.media-up { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; margin-bottom: 6px; }
.media-up__drop { flex: 1; min-width: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; padding: 22px; border-radius: 14px; cursor: pointer; text-align: center;
    background: rgba(0, 0, 0, 0.22); border: 2px dashed var(--border); transition: border-color 0.15s, background 0.15s; }
.media-up__drop:hover { border-color: var(--border-lit); background: rgba(108, 99, 255, 0.06); }
.media-up__drop.is-drag { border-color: var(--accent-2); background: rgba(34, 211, 238, 0.08); }
.media-up__drop.has-file { border-style: solid; border-color: rgba(74, 222, 128, 0.5); }
.media-up__icon { font-size: 26px; }
.media-up__text { font-size: 14.5px; font-weight: 700; color: var(--text); word-break: break-all; }
.media-up__hint { font-size: 12px; color: var(--faint); }
.media-up__btn { align-self: center; padding-inline: 30px; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 8px; }
.media-item { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
    background: rgba(0, 0, 0, 0.24); border: 1px solid var(--border); }
.media-item__thumb { aspect-ratio: 16 / 10; background: #0a0a16; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-item__meta { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; }
.media-item__path { flex: 1; min-width: 0; padding: 7px 9px; border-radius: 8px; font-size: 11.5px;
    background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); color: var(--muted); }
.media-item__size { font-size: 11px; color: var(--faint); white-space: nowrap; }
.media-item__actions { display: flex; gap: 8px; padding: 0 10px 12px; }
.media-item__actions .btn { flex: 1; padding: 9px 8px; }
.media-copy.is-ok { color: #4ade80; border-color: rgba(74, 222, 128, 0.4); }
.media-empty { color: var(--muted); font-size: 14px; padding: 8px 2px; }

/* ── Save bar ── */
.adm__save { position: sticky; bottom: 14px; display: flex; justify-content: center; margin: 26px 0 8px; z-index: 30; }
.adm__save .btn { box-shadow: 0 14px 40px rgba(108, 99, 255, 0.5); padding-inline: 44px; }

/* ── Site-settings form (accessibility button) ── */
.grp--settings { border-color: rgba(108, 99, 255, 0.28); }
.set-form { display: flex; flex-direction: column; gap: 18px; max-width: 520px; }
.set-toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.set-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.set-toggle__track { position: relative; flex-shrink: 0; width: 46px; height: 26px; border-radius: 999px;
    background: rgba(255, 255, 255, 0.14); border: 1px solid var(--border); transition: background 0.18s; }
.set-toggle__dot { position: absolute; top: 2px; inset-inline-start: 2px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; transition: transform 0.18s; }
.set-toggle input:checked + .set-toggle__track { background: linear-gradient(135deg, var(--accent), #5b53e8); border-color: transparent; }
.set-toggle input:checked + .set-toggle__track .set-toggle__dot { transform: translateX(20px); }
html[dir="rtl"] .set-toggle input:checked + .set-toggle__track .set-toggle__dot { transform: translateX(-20px); }
.set-toggle input:focus-visible + .set-toggle__track { box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.3); }
.set-toggle__label { font-size: 14.5px; font-weight: 600; color: var(--text); }
.set-row { display: flex; gap: 16px; flex-wrap: wrap; }
.set-field { display: flex; flex-direction: column; gap: 7px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 180px; flex: 1; }
.set-field select { padding: 11px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border); color: var(--text); font-size: 15px; font-family: inherit; cursor: pointer; }
.set-field select:focus { outline: none; border-color: var(--border-lit); box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.13); }

/* Space the password section away from the Save bar */
.grp--pw { margin-top: 40px; }
.pw-form__help { font-size: 13.5px; color: var(--muted); line-height: 1.7; margin-bottom: 18px; max-width: 620px; }
.pw-form { display: flex; flex-direction: column; gap: 14px; max-width: 360px; }
.pw-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pw-form input { padding: 12px 13px; border-radius: 10px; background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border); color: var(--text); font-size: 15px; font-family: inherit; }
.pw-form input:focus { outline: none; border-color: var(--border-lit); }

/* ── Delete modal ── */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(4, 4, 10, 0.72);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.2s ease; }
.modal__card { position: relative; width: min(440px, 100%); padding: 30px 28px; border-radius: 20px; text-align: center;
    background: rgba(20, 20, 36, 0.96); border: 1px solid rgba(248, 113, 113, 0.3);
    box-shadow: var(--shadow), 0 0 60px rgba(248, 113, 113, 0.14); animation: modal-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
.modal__icon { font-size: 40px; margin-bottom: 12px; }
.modal__title { font-size: 21px; font-weight: 800; margin-bottom: 10px; font-family: var(--font-head); }
.modal__text { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 16px; }
.modal__preview { margin-bottom: 22px; }
.modal__preview img { max-height: 120px; width: auto; border-radius: 10px; border: 1px solid var(--border); margin-inline: auto; }
.modal__actions { display: flex; gap: 12px; justify-content: center; }
.modal__actions .btn { flex: 1; max-width: 180px; }
.modal__card--wide { width: min(720px, 100%); text-align: start; }
.modal__card--wide .modal__title { text-align: start; }

/* Image picker grid */
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px;
    max-height: 52vh; overflow-y: auto; padding: 4px; margin-bottom: 20px; }
.picker__item { display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 12px; cursor: pointer;
    background: rgba(0, 0, 0, 0.24); border: 1px solid var(--border); font-family: inherit; text-align: start;
    transition: transform 0.12s, border-color 0.15s, background 0.15s; }
.picker__item:hover { transform: translateY(-3px); border-color: var(--border-lit); background: rgba(108, 99, 255, 0.08); }
.picker__thumb { display: block; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: #0a0a16; }
.picker__thumb img, .picker__thumb .illus, .picker__thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker__label { font-size: 12px; font-weight: 600; color: var(--muted); word-break: break-all; }
.picker__tag { color: var(--accent-2); font-weight: 700; }

/* ── Mobile / touch ── */
@media (max-width: 720px) {
    .adm__menu-toggle { display: inline-flex; align-items: center; justify-content: center; order: 3; }
    .adm__top { flex-wrap: wrap; }
    .adm__top-actions { display: none; order: 4; width: 100%; flex-direction: column; align-items: stretch; gap: 8px; padding-top: 6px; }
    .adm__top-actions.is-open { display: flex; }
    .adm__top-actions .btn { width: 100%; justify-content: center; padding-block: 13px; }
    .adm__user { text-align: center; padding-block: 4px; }
}
@media (max-width: 620px) {
    .fld__inputs { grid-template-columns: 1fr; }
    .media-up__btn { width: 100%; }
    .modal__actions { flex-direction: column-reverse; }
    .modal__actions .btn { max-width: none; }
    /* Comfortable tap targets on touch screens */
    .grp__head { min-height: 60px; }
    .btn { padding-block: 13px; }
}
