/* ============================================================
   ITs Photobooth — staff area (login, template studio, editor)
   Loads on top of app.css.
   ============================================================ */

.inline { display: inline; }

.linkbtn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--ink-soft);
    cursor: pointer;
}

.linkbtn:hover { color: var(--pink-deep); }

.topnav__who { font-weight: 800; color: var(--ink); font-size: .95rem; }

.foot__staff { color: inherit; font-weight: 700; }

.flash {
    max-width: 760px;
    margin: 18px auto 0;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: .95rem;
}

.flash--ok { background: #e2f7f3; color: #0e7c6f; border: 1px solid #b8ebe2; }
.flash--err { background: #ffe9f0; color: #c2255c; border: 1px solid #ffd0e0; margin-bottom: 16px; }

/* ---------- auth ---------- */

.auth { display: grid; place-items: center; padding: clamp(40px, 8vw, 90px) 16px; }

.auth__card {
    width: min(420px, 100%);
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

.auth__card h1 { font-size: 1.6rem; }

.auth__sub { margin: 6px 0 22px; color: var(--ink-soft); font-size: .92rem; font-weight: 600; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }

.field span { font-weight: 800; font-size: .85rem; color: var(--ink-soft); }

.field input, .field select {
    padding: 11px 14px;
    border: 2px solid rgba(43, 35, 51, .12);
    border-radius: 12px;
    font: inherit;
    background: #fff;
}

.field input:focus { outline: none; border-color: var(--pink); }

.check { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; font-weight: 700; font-size: .9rem; color: var(--ink-soft); }

/* ---------- studio ---------- */

.studio { max-width: 1200px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) clamp(16px, 5vw, 56px); }

.studio__head h1 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); }

.studio__head p { margin: 6px 0 0; color: var(--ink-soft); font-weight: 600; }

.newtpl { margin-top: 34px; }

.newtpl h2, .tpls h2 { font-size: 1.2rem; }

.newtpl__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.newtpl__card {
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    background: var(--paper);
    border: 2px dashed rgba(43, 35, 51, .15);
    border-radius: var(--radius);
    padding: 18px 12px 14px;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.newtpl__card:hover { transform: translateY(-3px); border-color: var(--pink); box-shadow: var(--shadow-soft); }

.newtpl__card b { font-family: 'Baloo 2', sans-serif; font-size: .88rem; line-height: 1.25; }

.newtpl__card small { color: var(--ink-soft); font-weight: 700; font-size: .75rem; }

.newtpl__thumb {
    position: relative;
    width: 64px;
    height: 96px;
    margin-bottom: 8px;
    background: #fff;
    border: 2px solid rgba(43, 35, 51, .2);
    border-radius: 6px;
}

.newtpl__thumb--grid2x2 { width: 110px; height: 74px; }
.newtpl__thumb--grid3x3 { width: 96px; height: 96px; }
.newtpl__thumb--square  { width: 86px; height: 86px; }

.newtpl__thumb i {
    position: absolute;
    background: rgba(124, 92, 255, .25);
    border: 1px dashed #7c5cff;
    border-radius: 2px;
}

/* ---------- saved templates ---------- */

.tpls { margin-top: 44px; }

.tpls__count {
    display: inline-grid;
    place-items: center;
    min-width: 26px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--pink);
    color: #fff;
    font-size: .8rem;
}

.tpls__empty { color: var(--ink-soft); font-weight: 600; }

.tpls__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.tpl {
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.tpl--off { opacity: .55; }

.tpl__preview {
    display: grid;
    place-items: center;
    background:
        repeating-conic-gradient(#f3eee7 0 25%, #fff 0 50%) 0 0 / 22px 22px;
    min-height: 190px;
    max-height: 240px;
    overflow: hidden;
}

.tpl__preview img { max-width: 100%; max-height: 240px; object-fit: contain; display: block; }

.tpl__noimg { color: var(--ink-soft); font-weight: 700; font-size: .85rem; }

.tpl__meta { padding: 14px 16px 6px; display: grid; gap: 2px; }

.tpl__meta b { font-family: 'Baloo 2', sans-serif; }

.tpl__meta small { color: var(--ink-soft); font-weight: 700; font-size: .78rem; }

.tpl__badge {
    justify-self: start;
    margin-top: 6px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(43, 35, 51, .08);
    color: var(--ink-soft);
    font-size: .72rem;
    font-weight: 800;
}

.tpl__badge--on { background: #e2f7f3; color: #0e7c6f; }

.tpl__actions { display: flex; gap: 8px; padding: 12px 16px 16px; flex-wrap: wrap; }

.btn--sm { padding: 7px 14px; font-size: .85rem; }

.btn--danger { color: #c2255c; background: #ffe9f0; }

.btn--danger:hover { background: #ffd0e0; }

/* ---------- editor ---------- */

.page-editor .foot { display: none; }

.editor {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 22px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px clamp(12px, 3vw, 36px) 40px;
    align-items: start;
}

.editor__panel {
    position: sticky;
    top: 80px;
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 22px 20px;
}

.editor__title { font-size: 1.25rem; }

.editor__layout { margin: 2px 0 16px; color: var(--pink-deep); font-weight: 800; font-size: .85rem; }

.tools h3 {
    margin: 18px 0 8px;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-soft);
}

.tools__row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }

.tools__row input[type="color"] {
    width: 44px;
    height: 38px;
    padding: 2px;
    border: 2px solid rgba(43, 35, 51, .12);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.tools__row select {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid rgba(43, 35, 51, .12);
    border-radius: 10px;
    font: inherit;
    font-size: .88rem;
    background: #fff;
}

.tool {
    flex: 1;
    padding: 9px 8px;
    border: 2px solid rgba(43, 35, 51, .12);
    border-radius: 10px;
    background: #fff;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: .84rem;
    color: var(--ink);
    cursor: pointer;
    transition: border-color .12s ease, transform .12s ease;
    white-space: nowrap;
}

.tool:hover { border-color: var(--pink); transform: translateY(-1px); }

.tool--danger { color: #c2255c; }
.tool--danger:hover { border-color: #c2255c; }

.tools__hint { margin: 0; color: var(--ink-soft); font-size: .8rem; font-weight: 600; }

.objprops {
    margin-top: 14px;
    padding: 12px;
    border-radius: 12px;
    background: #faf6ff;
    border: 1px solid #e9defc;
}

.editor__save { margin-top: 20px; display: grid; gap: 10px; }

.editor__status { margin: 0; min-height: 1.2em; font-size: .85rem; font-weight: 700; color: var(--ink-soft); text-align: center; }

.editor__stage {
    display: grid;
    justify-items: center;
    padding: 12px 0;
}

.editor__canvaswrap {
    background:
        repeating-conic-gradient(#efe9e0 0 25%, #faf7f2 0 50%) 0 0 / 24px 24px;
    padding: 18px;
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.editor__canvaswrap canvas { display: block; }

@media (max-width: 900px) {
    .editor { grid-template-columns: 1fr; }
    .editor__panel { position: static; order: 2; }
    .editor__stage { order: 1; }
}

/* ---------- booth mode ---------- */

.page-booth .foot { display: none; }

.booth { max-width: 1150px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 36px) 40px; }

.booth__head { text-align: center; margin-bottom: 18px; }

.booth__head h1 { font-size: clamp(1.5rem, 3vw, 2rem); }

.booth__head p { margin: 4px 0 0; color: var(--ink-soft); font-weight: 700; }

.booth__stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 20px;
    align-items: start;
}

.cam {
    position: relative;
    background: #14101a;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    aspect-ratio: 16 / 9;
}

.cam video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);   /* mirror preview, parang salamin */
}

.cam__count {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-family: 'Baloo 2', sans-serif;
    font-size: clamp(5rem, 18vw, 11rem);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 6px 30px rgba(0, 0, 0, .55);
    background: rgba(20, 16, 26, .25);
    pointer-events: none;
}

.cam__count--pop { animation: pop .9s ease-out; }

@keyframes pop {
    0% { transform: scale(1.6); opacity: 0; }
    25% { transform: scale(1); opacity: 1; }
    100% { transform: scale(.92); opacity: .9; }
}

.cam__rec {
    position: absolute;
    top: 14px;
    left: 16px;
    color: #fff;
    background: rgba(220, 40, 70, .92);
    padding: 4px 12px;
    border-radius: 999px;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: .85rem;
    letter-spacing: .06em;
    animation: recblink 1s steps(2) infinite;
}

@keyframes recblink { 50% { opacity: .45; } }

.encodebar {
    position: relative;
    height: 34px;
    border-radius: 999px;
    background: rgba(43, 35, 51, .08);
    overflow: hidden;
}

.encodebar__fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0%;
    background: linear-gradient(135deg, var(--pink), var(--purple));
    transition: width .2s ease;
}

.encodebar__label {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: .8rem;
    color: var(--ink);
}

.cam__flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    transition: opacity .1s ease;
}

.cam__flash--on { opacity: .95; }

.cam__error {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    gap: 4px;
    text-align: center;
    color: #fff;
    font-weight: 700;
    padding: 20px;
}

.cam__error-sub { color: rgba(255, 255, 255, .7); font-size: .9rem; }

.booth__side { display: grid; gap: 16px; }

.shots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.shot {
    aspect-ratio: 4 / 3;
    border: 2px dashed rgba(43, 35, 51, .25);
    border-radius: 12px;
    background: var(--paper);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0;
}

.shot--done { border-style: solid; border-color: var(--teal); }

.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

.booth__controls {
    background: var(--paper);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 18px;
    display: grid;
    gap: 12px;
}

.booth__hint { margin: 0; color: var(--ink-soft); font-size: .85rem; font-weight: 700; text-align: center; }

.check--boxed {
    margin: 0;
    padding: 10px 12px;
    border: 2px solid rgba(43, 35, 51, .12);
    border-radius: 12px;
}

/* result stage */

.booth__result { grid-template-columns: minmax(0, 1fr) 300px; }

.result__imgwrap {
    display: grid;
    justify-items: center;
    background:
        repeating-conic-gradient(#efe9e0 0 25%, #faf7f2 0 50%) 0 0 / 24px 24px;
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow);
}

.result__imgwrap img {
    max-width: 100%;
    max-height: 72vh;
    box-shadow: 0 12px 36px rgba(43, 35, 51, .25);
    display: block;
}

.result__status { margin: 0; text-align: center; font-weight: 800; font-size: .9rem; color: var(--ink-soft); }

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 28px;
}

.pager__info { font-weight: 800; color: var(--ink-soft); font-size: .9rem; }

/* ---------- branded modal (pamalit sa native confirm/alert) ---------- */

.pbmodal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(20, 16, 26, .55);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s ease, visibility .18s ease;
}

.pbmodal--show { opacity: 1; visibility: visible; }

.pbmodal__card {
    width: min(400px, 100%);
    background: var(--paper);
    border-radius: 22px;
    padding: 30px 28px 26px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(20, 16, 26, .35);
    transform: translateY(14px) scale(.96);
    transition: transform .22s cubic-bezier(.2, 1.3, .4, 1);
}

.pbmodal--show .pbmodal__card { transform: translateY(0) scale(1); }

.pbmodal__icon {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 14px;
    border-radius: 50%;
    font-size: 1.7rem;
    background: #f1ecff;
}

.pbmodal__icon--danger { background: #ffe9f0; }

.pbmodal__title {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.pbmodal__msg {
    margin: 0 0 22px;
    color: var(--ink-soft);
    font-weight: 600;
    font-size: .95rem;
}

.pbmodal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.pbmodal__actions .btn[hidden] { display: none; }

.pbmodal__actions .btn:only-child,
.pbmodal__actions .btn[hidden] + .btn { grid-column: 1 / -1; }

.btn--danger-solid {
    color: #fff;
    background: linear-gradient(135deg, #ff5d7e, #d6244f);
    box-shadow: 0 8px 20px rgba(214, 36, 79, .35);
}

.btn--danger-solid:hover { box-shadow: 0 12px 26px rgba(214, 36, 79, .45); }

@media (max-width: 900px) {
    .booth__stage, .booth__result { grid-template-columns: 1fr; }
    .shots { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- bookings admin ---------- */
.bk-errors { background: #fdecea; border: 1px solid #f5c2bd; color: #8a1f17; border-radius: 12px; padding: 14px 18px; margin-top: 18px; font-size: .9rem; }
.bk-errors ul { margin: 8px 0 0; padding-left: 18px; }
.bk-new, .bk-list { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; margin-top: 22px; }
.bk-new > h2, .bk-list > h2 { margin: 0 0 16px; font-family: "Baloo 2", sans-serif; font-size: 1.2rem; }
.bk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.bk-grid label { display: flex; flex-direction: column; gap: 5px; font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.bk-grid label small { color: var(--gold-deep); font-weight: 700; text-transform: uppercase; font-size: .6rem; letter-spacing: .04em; }
.bk-grid input, .bk-grid select, .bk-grid textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: .92rem; background: var(--cream); color: var(--navy); }
/* Never let a field spill out of its column (long values, date/select widgets). */
.bk-grid input, .bk-grid select, .bk-grid textarea { width: 100%; max-width: 100%; box-sizing: border-box; min-height: 42px; }
.bk-grid textarea { min-height: 64px; resize: vertical; }
.bk-grid__wide { grid-column: span 3; }
.bk-form__actions { margin-top: 16px; }
.bk-hint { color: var(--ink-soft); font-size: .84rem; margin: -6px 0 14px; line-height: 1.5; }
.bk-row { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden; background: #fff; }
.bk-row > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; font-weight: 700; }
.bk-row > summary::-webkit-details-marker { display: none; }
.bk-row__date { font-family: "Baloo 2", sans-serif; color: var(--navy); }
.bk-row__badge { font-size: .64rem; text-transform: uppercase; letter-spacing: .03em; padding: 3px 10px; border-radius: 999px; }
.bk-row__badge--reserved { background: var(--navy); color: #fff; }
.bk-row__badge--pending { background: var(--gold-soft); color: var(--gold-deep); }
.bk-row__badge--blocked { background: #e6eaed; color: var(--ink-soft); }
.bk-row__badge--done { background: #e2f7f3; color: #0e7c6f; }
.bk-row__badge--reschedule { background: #fde7d8; color: #9a5b14; }
.appt__badge--done { background: #e2f7f3; color: #0e7c6f; }
.appt__badge--reschedule { background: #fde7d8; color: #9a5b14; }
.bk-quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.bk-quick__lbl { font-size: .78rem; font-weight: 700; color: var(--ink-soft); }
.bk-row__sum { color: var(--ink-soft); font-weight: 600; font-size: .86rem; }
.bk-row .bk-form { padding: 4px 16px 14px; }
.bk-del { padding: 0 16px 16px; }
.linkbtn--danger { color: #b3261e; }
.bk-empty { color: var(--ink-soft); }
.bk-past { margin-top: 18px; }
.bk-past > summary { cursor: pointer; font-weight: 700; color: var(--ink-soft); padding: 6px 0; }
.bk-pastrow { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: center; padding: 9px 4px; border-top: 1px solid var(--line); font-size: .86rem; }
.bk-pastrow__act { display: inline-flex; gap: 14px; align-items: center; justify-content: flex-end; }
.is-active { color: var(--gold-deep) !important; }
@media (max-width: 720px) { .bk-grid { grid-template-columns: 1fr 1fr; } .bk-grid__wide { grid-column: span 2; } }

/* Phones: roomier taps, no iOS zoom-on-focus (needs >=16px), full-width action. */
@media (max-width: 640px) {
    .bk-new, .bk-list { padding: 18px 15px; border-radius: 14px; margin-top: 16px; }
    .bk-new > h2, .bk-list > h2 { font-size: 1.08rem; }
    .bk-grid { gap: 12px; }
    .bk-grid input, .bk-grid select, .bk-grid textarea { font-size: 16px; padding: 11px 12px; min-height: 46px; }
    .bk-form__actions { display: flex; }
    .bk-form__actions .btn { width: 100%; justify-content: center; }
    .studio__head .btn { display: flex; width: 100%; justify-content: center; margin-top: 14px; }
}

@media (max-width: 480px) { .bk-grid { grid-template-columns: 1fr; } .bk-grid__wide { grid-column: auto; } .bk-pastrow { grid-template-columns: 1fr 1fr; } }