* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: rgb(123, 203, 230);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Arial, sans-serif;
    padding: 24px 0;
}

/* ─── Página principal ───────────────────────────── */

.lp-page {
    background: rgba(255,255,255,0.20);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    box-shadow: 0 8px 36px rgba(11,78,150,0.16);
    max-width: 920px;
    width: 96vw;
    padding: 24px 24px 0;
    display: flex;
    flex-direction: column;
}

.lp-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}
.lp-logo img { max-width: 180px; }

/* Formulário compacto */
.lp-form {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.lp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lp-field label {
    font-weight: 600;
    color: #0b1632;
    font-size: 13px;
}

.lp-field select {
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    font-size: 13px;
    background: #f3f4f6;
    color: #0b1632;
    outline: none;
    cursor: pointer;
}

.lp-field select:disabled { opacity: 0.55; cursor: default; }

/* Card da cena */
.lp-scene-card {
    background: white;
    border-radius: 14px;
    padding: 16px 16px 0;
}

.lp-scene-title {
    font-size: 17px;
    font-weight: 700;
    color: #0b1632;
    margin-bottom: 14px;
}

/* Layout da cena */
.lp-scene {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    position: relative;
}

/* ─── Coluna da pessoa ───────────────────────────── */

.lp-person-col {
    flex: 0 0 240px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-right: 8px;
}

/* Linhas de referência de altura */
.lp-ref {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    z-index: 2;
}

.lp-ref-182 { top: 0; }

/* 1,60m fica a ~12% do topo (1 - 1.60/1.82 ≈ 0.121) da altura da cena */
.lp-ref-160 { top: 12%; }

.lp-ref-label {
    font-size: 11px;
    font-weight: 700;
    color: #374151;
    white-space: nowrap;
    background: white;
    padding: 1px 3px;
    border-radius: 3px;
}

.lp-ref-hline {
    flex: 1;
    height: 1px;
    background: #9ca3af;
    position: relative;
}
.lp-ref-hline::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -4px;
    border-left: 7px solid #9ca3af;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

/* SVG da pessoa — altura sincronizada via JS com 4 linhas de lockers */
.lp-person-svg {
    width: auto;
    height: auto;
    max-width: 100%;
    display: block;
    flex-shrink: 0;
}

/* ─── Coluna do grid ─────────────────────────────── */

.lp-grid-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Piso azul */
.lp-floor {
    height: 20px;
    background: #2563eb;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
}

/* ─── Grid de lockers ────────────────────────────── */

#lockersGrid {
    overflow-y: auto;
    /* max-height calculado via JS = 4 linhas */
    scrollbar-width: thin;
    scrollbar-color: #2563eb #f3f4f6;
}
#lockersGrid::-webkit-scrollbar { width: 6px; }
#lockersGrid::-webkit-scrollbar-track { background: #f3f4f6; }
#lockersGrid::-webkit-scrollbar-thumb { background: #2563eb; border-radius: 3px; }

.grid {
    display: grid;
    gap: 2px;
    background: white;
}

.locker-card {
    /* altura = 2,5× largura */
    aspect-ratio: 13 / 20;
    position: relative;
    overflow: hidden;
}

.locker-card[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 2px;
    text-align: center;
    font-size: 8px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
    background: rgba(0, 0, 0, 0.72);
    opacity: 0;
    transition: opacity 0.18s;
    pointer-events: none;
}
.locker-card[data-status="1"][data-tooltip]::after { background: rgba(22, 163, 74, 0.88); }
.locker-card[data-status="2"][data-tooltip]::after { background: rgba(220, 38, 38, 0.88); }
.locker-card[data-status="3"][data-tooltip]::after { background: rgba(202, 138, 4, 0.88); }
.locker-card:hover[data-tooltip]::after { opacity: 1; }

.locker-card.selected .locker-image-bg {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}

.locker-image-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

.locker-ident-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 9px;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    line-height: 1;
    text-align: center;
    word-break: break-all;
    padding: 2px;
}

.locker-empty {
    color: #6b7280;
    padding: 28px 20px;
    text-align: center;
    font-size: 14px;
    grid-column: 1 / -1;
}

/* ─── Rodapé ─────────────────────────────────────── */

.lp-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 2px 20px;
    position: sticky;
    bottom: 0;
    background: rgba(255, 255, 255, 0.20);
    backdrop-filter: blur(10px);
}

.lp-total {
    font-size: 14px;
    color: #0b1632;
}

.lp-btn-continuar {
    background: #d1d5db;
    color: #9ca3af;
    padding: 10px 28px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    cursor: default;
    transition: background .15s, color .15s;
}

.lp-btn-continuar.active {
    background: linear-gradient(180deg, #2563eb, #1e40af);
    color: white;
    cursor: pointer;
}
.lp-btn-continuar.active:hover { opacity: 0.92; }

/* ─── Botões utilitários ─────────────────────────── */

.btn-primary {
    background: linear-gradient(180deg, #2563eb, #1e40af);
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
}
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
    background: #e5e7eb;
    color: #1e40af;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

/* ─── Modais ─────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(123,203,230,1);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-card {
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(11,78,150,0.18);
    max-width: 400px;
    width: 90vw;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal-logo { max-width: 180px; margin-bottom: 18px; }

.modal-title {
    color: #000;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 18px;
}

.modal-input {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 16px;
    margin-bottom: 12px;
    background: #f3f4f6;
    color: #0b1632;
    outline: none;
}
.modal-input:focus { border: 2px solid #2563eb; }

.modal-field {
    width: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}
.modal-field .modal-input { margin-bottom: 0; }

.modal-label {
    display: block;
    text-align: left;
    color: #0b1632;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.modal-error {
    color: #e11d48;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
    white-space: pre-line;
}

.modal-info {
    color: #2563eb;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 4px;
}

@media (max-width: 600px) {
    body {
        align-items: flex-start;
        padding: 16px 0;
    }
    .lp-form { grid-template-columns: 1fr; }
    .lp-person-col { flex: 0 0 120px; }
    .lp-person-svg { width: 100px; }
    .modal-card { padding: 24px 14px; }
}
