/* ============================================================
   Login Portal IT — La Salle
   Mapa interactivo + panel dinámico de acceso institucional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --navy: #1B2C65;
    --navy-deep: #18181B;
    --gold: #F5B942;
    --gold-soft: rgba(245, 185, 66, 0.35);
    --ink: #E8EAF2;
    --ink-dim: rgba(232, 234, 242, 0.6);
    --panel-bg: rgba(24, 24, 27, 0.55);
    --panel-border: rgba(245, 185, 66, 0.28);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--navy-deep);
    color: var(--ink);
}

/* ===== Mapa de fondo ===== */
#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

/* Velo sutil para que el panel siempre se lea bien, sin tapar el mapa */
.map-veil {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(100deg,
        rgba(11, 18, 48, 0.05) 0%,
        rgba(11, 18, 48, 0.15) 55%,
        rgba(11, 18, 48, 0.55) 100%);
}

/* ===== Cabecera: logo + buscador ===== */
.top-bar {
    position: absolute;
    top: 28px;
    left: 32px;
    right: 32px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    pointer-events: none;
}

.top-bar > * { pointer-events: auto; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand img {
    height: 96px;
    width: auto;
}

/* ===== Estado inicial del panel (nada seleccionado aún) ===== */
.filial-panel.empty .filial-photo { display: none; }

.panel-empty-state {
    display: none;
    padding: 48px 32px;
    text-align: center;
}
.filial-panel.empty .panel-empty-state { display: block; }
.filial-panel.empty .filial-body { display: none; }

.panel-empty-state i {
    font-size: 26px;
    color: var(--gold);
    margin-bottom: 18px;
    display: block;
}
.panel-empty-state p {
    margin: 0;
    font-size: 14.5px;
    color: var(--ink-dim);
    line-height: 1.6;
}

.search-box {
    position: relative;
    width: 280px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px 12px 42px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(24, 24, 27, 0.55);
    backdrop-filter: blur(10px);
    color: var(--ink);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input::placeholder { color: var(--ink-dim); }
.search-box input:focus { border-color: var(--gold-soft); }

.search-box i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-dim);
    font-size: 13px;
}

.search-suggestions {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--panel-bg);
    backdrop-filter: blur(14px);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    overflow: hidden;
    display: none;
    z-index: 30;
}

.search-suggestions.visible { display: block; }

.search-suggestions button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--ink);
    font-family: inherit;
    font-size: 13.5px;
    cursor: pointer;
    transition: background 0.15s;
}

.search-suggestions button:hover { background: rgba(245, 185, 66, 0.1); }

/* ===== Panel flotante de la filial ===== */
.filial-panel {
    position: absolute;
    top: 50%;
    right: 32px;
    transform: translateY(-50%);
    width: 380px;
    max-width: calc(100vw - 64px);
    z-index: 20;
    background: var(--panel-bg);
    backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--panel-border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    animation: panelIn 0.5s ease;
}

@keyframes panelIn {
    from { opacity: 0; transform: translateY(-50%) translateX(16px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

.filial-photo {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    background: var(--navy);
    transition: opacity 0.25s ease;
}

.filial-body {
    padding: 32px 32px 30px;
}

.filial-nombre {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.3px;
    line-height: 1.3;
    color: #ffffff;
    transition: opacity 0.2s ease;
}

.filial-direccion {
    margin: 0 0 26px;
    font-size: 13px;
    color: var(--ink-dim);
    line-height: 1.5;
}

.panel-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0 0 24px;
}

.panel-subtitle {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.panel-bienvenida {
    margin: 0 0 28px;
    font-size: 14.5px;
    color: var(--ink-dim);
    line-height: 1.6;
}

.alert {
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 12.5px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
    margin-bottom: 20px;
}
.alert i { margin-top: 2px; font-size: 14px; }
.alert-warning { background: rgba(245, 185, 66, 0.08); border: 1px solid rgba(245, 185, 66, 0.22); color: #f5cd7e; }
.alert-error { background: rgba(220, 90, 90, 0.08); border: 1px solid rgba(220, 90, 90, 0.28); color: #f0a3a3; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 16px 0;
    background: #ffffff;
    border: none;
    border-radius: 99px;
    text-decoration: none;
    color: #3c4043;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 26px;
}
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.28); }
.btn-google img { width: 20px; height: 20px; }

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wifi-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-dim);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 7px 15px 7px 13px;
    border-radius: 99px;
    text-decoration: none;
    width: fit-content;
    transition: 0.2s;
}
.wifi-badge i { color: var(--gold); font-size: 11px; }
.wifi-badge:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.help-link {
    font-size: 12px;
    color: var(--ink-dim);
    text-decoration: none;
    font-weight: 400;
}
.help-link:hover { color: #fff; }

/* ===== Pines (estrella institucional de La Salle) ===== */
.pin-star {
    width: 30px;
    height: 38px;
    cursor: pointer;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.55));
    transition: transform 0.15s ease;
}

.pin-star svg {
    width: 100%;
    height: 100%;
    display: block;
}
.pin-star:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px var(--gold)) drop-shadow(0 2px 5px rgba(0,0,0,0.55));
}
.pin-star.selected {
    filter: drop-shadow(0 0 8px var(--gold)) drop-shadow(0 2px 5px rgba(0,0,0,0.55));
    transform: scale(1.2);
}

/* ===== Mini preview al hacer hover sobre un pin individual ===== */
.pin-preview {
    position: absolute;
    bottom: calc(100% - 6px);
    left: 50%;
    transform: translateX(-50%);
    transform-origin: bottom center;
    width: 108px;
    text-align: center;
    z-index: 35;
    cursor: pointer;
    pointer-events: none; /* se habilita en JS recién cuando termina de aparecer */
    animation: previewIn 0.55s cubic-bezier(0.22, 1.2, 0.36, 1);
}

@keyframes previewIn {
    from { opacity: 0; transform: translateX(-50%) scale(0.15); }
    to   { opacity: 1; transform: translateX(-50%) scale(1); }
}

.pin-preview img {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.pin-preview span {
    display: block;
    padding: 4px 8px;
    background: #ffffff;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.3;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}
.pin-cluster {
    position: relative;
    width: 36px;
    height: 40px;
    cursor: pointer;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.6));
    transition: transform 0.15s ease;
}
.pin-cluster img,
.pin-cluster svg {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.pin-cluster:hover {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--gold)) drop-shadow(0 2px 6px rgba(0,0,0,0.6));
}

.pin-cluster-count {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 99px;
    background: var(--navy);
    border: 1.5px solid #ffffff;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', sans-serif;
}

/* ===== Rosetón: tarjetas con foto+nombre desplegadas en semicírculo,
   posicionadas sobre el contenedor del mapa (no dependen del marker) ===== */
.cluster-rosette {
    position: absolute;
    width: 0;
    height: 0;
    z-index: 40;
    pointer-events: none;
}

.cluster-petal {
    position: absolute;
    width: 92px;
    margin-left: -46px;
    margin-top: -50px;
    text-align: center;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.15s ease;
    animation: petalIn 0.6s cubic-bezier(0.22, 1.2, 0.36, 1) backwards;
}

.cluster-petal img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    margin: 0 auto 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.15s ease;
}

.cluster-petal span {
    display: block;
    padding: 4px 8px;
    background: #ffffff;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 600;
    color: var(--navy);
    line-height: 1.25;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.cluster-petal:hover {
    transform: scale(1.08);
}
.cluster-petal:hover img {
    box-shadow: 0 0 0 3px var(--gold), 0 8px 20px rgba(0, 0, 0, 0.4);
}

@keyframes petalIn {
    from { opacity: 0; transform: scale(0.05); }
    to   { opacity: 1; transform: scale(1); }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .top-bar {
        flex-direction: column;
        align-items: stretch;
        top: 14px;
        left: 14px;
        right: 14px;
        gap: 10px;
    }
    .search-box { width: 100%; }

    .search-box input {
        padding: 9px 14px 9px 38px;
        font-size: 13px;
    }

    .brand img {
        height: 52px;
    }

    .filial-panel {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
        top: auto;
        bottom: 12px;
        transform: none;
    }

    @keyframes panelIn {
        from { opacity: 0; transform: translateY(16px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Panel compacto, foto grande, pero legible y con aire */
    .filial-photo { height: 240px; }

    .filial-body { padding: 16px 20px 18px; }

    .filial-nombre {
        font-size: 17px;
        margin-bottom: 3px;
        line-height: 1.25;
    }

    .filial-direccion {
        font-size: 12px;
        margin-bottom: 14px;
        line-height: 1.4;
    }

    .panel-divider { margin-bottom: 14px; }

    .panel-subtitle {
        font-size: 10.5px;
        margin-bottom: 5px;
    }

    .panel-bienvenida {
        font-size: 13px;
        margin-bottom: 16px;
        line-height: 1.45;
    }

    .btn-google {
        padding: 12px 0;
        font-size: 14px;
        margin-bottom: 14px;
    }
    .btn-google img { width: 17px; height: 17px; }

    .footer-links { gap: 8px; }

    .wifi-badge {
        font-size: 11px;
        padding: 5px 12px 5px 10px;
    }

    .help-link { font-size: 11px; }

    .panel-empty-state {
        padding: 18px 16px;
    }

    .panel-empty-state i {
        font-size: 22px;
        margin-bottom: 10px;
    }
    .panel-empty-state p {
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .filial-panel { animation: none; }
    .pin-star, .pin-cluster, .btn-google { transition: none; }
}