/* ============================================================
   puestos.css — Estilos Puestos de Venta Mercadito Digital
   Municipalidad de La Cruz
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: #f5f5f0;
    color: #1a1a1a;
    min-height: 100vh;
}

/* ── Header ────────────────────────────────────────────────── */
.page-header {
    background: #6B4FA0;
    color: #fff;
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p  { font-size: 13px; color: #C4A8E8; margin-top: 2px; }
.stats-row {
    display: flex;
    gap: 8px;
}
.stat {
    background: rgba(255,255,255,.12);
    border-radius: 7px;
    padding: 8px 14px;
    text-align: center;
    min-width: 72px;
}
.stat-n { font-size: 20px; font-weight: 700; }
.stat-l { font-size: 10px; color: #C4A8E8; margin-top: 1px; }

/* ── Contenedor principal ─────────────────────────────────── */
.main { padding: 20px 20px 40px; max-width: 1100px; margin: 0 auto; }

/* ── Barra de filtros ─────────────────────────────────────── */
.toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}
.f-btn {
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.f-btn:hover  { background: #f0f0eb; }
.f-btn.active { background: #6B4FA0; color: #fff; border-color: #6B4FA0; }
.search-inp {
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    width: 170px;
}
.search-inp:focus { outline: none; border-color: #6B4FA0; }

/* ── Leyenda ──────────────────────────────────────────────── */
.legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    font-size: 12px;
    color: #666;
    align-items: center;
}
.leg-box {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
}
.leg-avail { background: #C0DD97; border: 1px solid #97C459; }
.leg-taken { background: #F5C4B3; border: 1px solid #F0997B; }

/* ── Contenedor de la calle ───────────────────────────────── */
.street-wrap {
    border: 1px solid #ddddd5;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

/* ── Cabecera de vereda ───────────────────────────────────── */
.side-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: #f7f7f3;
    border-bottom: 1px solid #eee;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.side-header .disp {
    margin-left: auto;
    font-size: 11px;
    color: #6B4FA0;
    font-weight: 600;
}

/* ── Fila scrolleable de puestos ──────────────────────────── */
.scroll-row {
    padding: 10px 12px;
}

/* ── Ambas veredas: fila única horizontal con scroll ───────── */
.scroll-norte,
.scroll-sur {
    overflow-x: auto;
    padding: 10px 12px;
}
.scroll-norte::-webkit-scrollbar,
.scroll-sur::-webkit-scrollbar       { height: 5px; }
.scroll-norte::-webkit-scrollbar-track,
.scroll-sur::-webkit-scrollbar-track { background: #f0f0eb; }
.scroll-norte::-webkit-scrollbar-thumb,
.scroll-sur::-webkit-scrollbar-thumb { background: #bbb; border-radius: 3px; }
.booth-norte,
.booth-sur {
    display: flex;
    flex-wrap: nowrap;
    gap: 4px;
    width: max-content;
}

/* ── Puesto individual ─────────────────────────────────────── */
.booth {
    width: 32px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .1s, box-shadow .1s;
    border: 1px solid transparent;
    user-select: none;
    flex-shrink: 0;
    position: relative;
}
.booth.available {
    background: #C0DD97;
    color: #3B6D11;
    border-color: #97C459;
}
.booth.available:hover {
    background: #3B6D11;
    color: #fff;
    transform: scale(1.25);
    z-index: 2;
    box-shadow: 0 3px 8px rgba(0,0,0,.2);
}
.booth.taken {
    background: #F5C4B3;
    color: #993C1D;
    border-color: #F0997B;
}
.booth.taken:hover {
    background: #D85A30;
    color: #fff;
    transform: scale(1.25);
    z-index: 2;
    box-shadow: 0 3px 8px rgba(0,0,0,.2);
}
.booth.highlight {
    outline: 2px solid #185FA5;
    outline-offset: 1px;
}
.booth.oculto { visibility: hidden; pointer-events: none; }

/* ── Separador de calle ───────────────────────────────────── */
.road {
    background: #3a3a38;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.road-line {
    flex: 1;
    height: 4px;
    background: repeating-linear-gradient(
        90deg,
        #FAC775 0, #FAC775 28px,
        transparent 28px, transparent 56px
    );
    border-radius: 2px;
}
.road-label {
    color: #FAC775;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Modal overlay ─────────────────────────────────────────── */
.modal-bg {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-bg.open { display: flex; }

.modal {
    background: #fff;
    border-radius: 10px;
    width: 100%;
    max-width: 580px;
    max-height: 92vh;
    overflow-y: auto;
    animation: fadeUp .2s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #eee;
}
.modal-head h2 { font-size: 16px; font-weight: 700; }
.modal-head p  { font-size: 12px; color: #888; margin-top: 2px; }
.btn-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    flex-shrink: 0;
}
.btn-close:hover { color: #555; }

.modal-body { padding: 18px 20px; }

/* ── Badge de puesto ──────────────────────────────────────── */
.booth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
}
.badge-free  { background: #EDE6F7; color: #6B4FA0; border: 1px solid #B99FD8; }
.badge-taken { background: #FAECE7; color: #993C1D; border: 1px solid #F0997B; }

/* ── Formulario ────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.col-full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: #666; font-weight: 500; }
.field input,
.field select {
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    background: #fff;
    color: #1a1a1a;
    transition: border-color .15s;
}
.field input:focus,
.field select:focus { outline: none; border-color: #6B4FA0; box-shadow: 0 0 0 3px rgba(107,79,160,.1); }
.field.err input,
.field.err select   { border-color: #E24B4A; }
.err-txt            { font-size: 11px; color: #A32D2D; min-height: 14px; }

/* ── Toggle inicio actividades ─────────────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f7f7f3;
    border-radius: 7px;
    cursor: pointer;
    user-select: none;
}
.toggle-row span { font-size: 13px; color: #444; }
.toggle { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    inset: 0;
    background: #bbb;
    border-radius: 22px;
    cursor: pointer;
    transition: .2s;
}
.slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}
.toggle input:checked + .slider          { background: #6B4FA0; }
.toggle input:checked + .slider::before { transform: translateX(18px); }

/* ── Área de archivo ───────────────────────────────────────── */
.file-area {
    border: 2px dashed #ccc;
    border-radius: 7px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    background: #fafaf8;
    transition: border-color .15s, background .15s;
}
.file-area:hover           { border-color: #6B4FA0; background: #f3eeff; }
.file-area.has-file        { border-style: solid; border-color: #6B4FA0; background: #EDE6F7; }
.file-area p               { font-size: 12px; color: #888; margin-top: 4px; }
.file-area .file-name      { font-size: 13px; color: #6B4FA0; font-weight: 600; margin-top: 6px; }
.file-icon                 { font-size: 26px; color: #aaa; }
.file-area.has-file .file-icon { color: #6B4FA0; }

/* ── Aviso subsistencia ────────────────────────────────────── */
.aviso-subsist {
    background: #FFF8E7;
    border: 1px solid #FAC775;
    border-radius: 6px;
    padding: 9px 12px;
    font-size: 12px;
    color: #633806;
}

/* ── Pie del modal ─────────────────────────────────────────── */
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid #eee;
}
.btn-cancel {
    padding: 8px 18px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
}
.btn-cancel:hover { background: #f0f0eb; }
.btn-submit {
    padding: 8px 22px;
    border: none;
    border-radius: 6px;
    background: #6B4FA0;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.btn-submit:hover    { background: #4A3070; }
.btn-submit:active   { transform: scale(.98); }
.btn-submit:disabled { background: #aaa; cursor: not-allowed; }

/* ── Detalle puesto ocupado ────────────────────────────────── */
.det-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.det-cell {
    background: #f7f7f3;
    border-radius: 7px;
    padding: 10px 12px;
}
.det-cell.full { grid-column: 1 / -1; }
.det-label     { font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.det-val       { font-size: 13px; color: #1a1a1a; font-weight: 600; word-break: break-all; }

/* ── Pantalla de éxito ─────────────────────────────────────── */
.success-box {
    text-align: center;
    padding: 28px 20px;
}
.success-icon {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #EDE6F7;
    color: #6B4FA0;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.success-box h3 { font-size: 17px; margin-bottom: 6px; }
.success-box p  { font-size: 13px; color: #666; margin-bottom: 18px; }

/* ── Spinner de carga ──────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerta flotante ───────────────────────────────────────── */
#alerta {
    display: none;
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 10px 20px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
#alerta.error { background: #E24B4A; color: #fff; }
#alerta.info  { background: #6B4FA0; color: #fff; }

/* ── Responsivo ────────────────────────────────────────────── */
@media (max-width: 500px) {
    .form-grid             { grid-template-columns: 1fr; }
    .det-grid              { grid-template-columns: 1fr; }
    .det-cell.full         { grid-column: 1; }
    .col-full              { grid-column: 1; }
}

/* ── Marcador Virgen de Pocochay ───────────────────────────── */
.vereda-wrap {
    display: flex;
    align-items: stretch;
}

.virgen-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 10px;
    background: #FFF8E7;
    border-right: 2px solid #FAC775;
    flex-shrink: 0;
    min-width: 72px;
    text-align: center;
    position: relative;
}

.virgen-marker::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 8px solid #FAC775;
}

.virgen-icon {
    font-size: 22px;
    line-height: 1;
}

.virgen-txt {
    font-size: 9px;
    font-weight: 700;
    color: #633806;
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1.3;
}

.virgen-arrow {
    font-size: 14px;
    color: #BA7517;
    margin-top: 2px;
}

.vereda-wrap .scroll-row {
    flex: 1;
    min-width: 0;
}

/* ── Botón registrar seleccionados ─────────────────────────── */
.btn-abrir-form {
    padding: 6px 16px;
    border: 1.5px dashed #B99FD8;
    border-radius: 6px;
    background: #fff;
    color: #9B80C8;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    margin-left: auto;
}
.btn-abrir-form:hover {
    background: #EDE6F7;
    border-color: #6B4FA0;
    color: #6B4FA0;
}
.btn-abrir-form.has-sel {
    background: #6B4FA0;
    color: #fff;
    border-style: solid;
    border-color: #4A3070;
    box-shadow: 0 2px 8px rgba(107,79,160,.3);
}
.btn-abrir-form.has-sel:hover {
    background: #4A3070;
}