/* ==========================================================================
   matchapp.mx — Mapa Maestro Público (Fase 2B · Arranque en Modo Light)
   Tipografía: Quicksand · Estética limpia de alto contraste con acento #ffcc00
   ========================================================================== */

:root {
    --bg: #f4f5f7;
    --panel-bg: rgba(255, 255, 255, 0.94);
    --panel-bg-solid: #ffffff;
    --panel-border: rgba(15, 23, 42, 0.12);
    --text: #111827;
    --text-muted: #525d70;
    --chip-bg: #ffffff;
    --chip-border: rgba(15, 23, 42, 0.14);
    --chip-text: #1f2937;
    --gold: #ffcc00;
    --gold-dark: #b38900;
    --green: #25d366;
    --venta-bg: #0f172a;
    --venta-emerald: #047857;
    --renta-blue: #1d4ed8;
    --shadow-float: 0 10px 28px rgba(15, 23, 42, 0.16);
    --shadow-sheet: 0 -10px 36px rgba(0, 0, 0, 0.25);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --font: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.theme-dark {
    --bg: #0a0a0a;
    --panel-bg: rgba(18, 18, 18, 0.92);
    --panel-bg-solid: #141414;
    --panel-border: rgba(255, 255, 255, 0.12);
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --chip-bg: #1c1c1c;
    --chip-border: rgba(255, 255, 255, 0.14);
    --chip-text: #e5e7eb;
    --shadow-float: 0 12px 32px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    -webkit-text-size-adjust: 100%;
}

button,
input,
select {
    font-family: inherit;
    font-size: 16px;
}

a {
    color: inherit;
    text-decoration: none;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   Contenedor Mapbox Pantalla Completa
   ========================================================================== */
#master-map {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-error-overlay {
    position: fixed;
    inset: 0;
    z-index: 5;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #0f172a;
    color: #f8fafc;
    text-align: center;
}

/* ==========================================================================
   Barra Superior Flotante (2 Líneas Limpias, Mobile-First)
   ========================================================================== */
.map-topbar {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 1220px;
    margin: 0 auto;
}

.topbar-line {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-line-1 {
    background: var(--panel-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    box-shadow: var(--shadow-float);
    flex-wrap: wrap;
    justify-content: space-between;
}

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-mark-dot {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--gold), #ff9900);
    color: #0a0a0a;
    font-weight: 700;
    font-size: 17px;
    display: grid;
    place-items: center;
}

.brand-wordmark {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.brand-wordmark span {
    color: var(--gold-dark);
}

body.theme-dark .brand-wordmark span {
    color: var(--gold);
}

.topbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

/* Segmented Switch Todo | Venta | Renta */
.op-switch {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 3px;
}

body.theme-dark .op-switch {
    background: rgba(255, 255, 255, 0.07);
}

.op-switch-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    min-height: 34px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.op-switch-btn.is-active {
    background: #111827;
    color: #ffffff;
}

body.theme-dark .op-switch-btn.is-active {
    background: var(--gold);
    color: #0a0a0a;
}

/* Selector de Zona */
.zone-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.zone-select {
    min-height: 40px;
    max-width: 175px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--chip-border);
    background: var(--chip-bg);
    color: var(--chip-text);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.btn-zone-aerial {
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1.5px solid #111827;
    background: var(--gold);
    color: #0a0a0a;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-publish-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 15px;
    border-radius: 999px;
    background: var(--gold);
    color: #0a0a0a;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(255, 204, 0, 0.42);
    white-space: nowrap;
    transition: transform 0.14s ease, filter 0.16s ease;
}

.btn-publish-cta:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
}

/* Línea 2 · Carrusel horizontal táctil de 8 categorías + toggles */
.topbar-line-2 {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 4px;
    gap: 7px;
}

.topbar-line-2::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    appearance: none;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 38px;
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    color: var(--chip-text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
    transition: all 0.16s ease;
    white-space: nowrap;
}

.filter-chip.is-active {
    background: #111827;
    border-color: #111827;
    color: var(--gold);
}

body.theme-dark .filter-chip.is-active {
    background: var(--gold);
    border-color: var(--gold);
    color: #0a0a0a;
}

.filter-chip.is-toggle-360.is-active {
    background: var(--gold);
    border-color: #b38900;
    color: #0a0a0a;
}

.filter-chip.is-toggle-direct.is-active {
    background: #0f2e1b;
    border-color: var(--green);
    color: var(--green);
}

/* ==========================================================================
   Controles Flotantes Inferiores: Contador + Selector de 3 Estilos
   ========================================================================== */
.map-counter-pill {
    position: fixed;
    left: 12px;
    bottom: 24px;
    z-index: 15;
    padding: 7px 13px;
    border-radius: 999px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    box-shadow: var(--shadow-float);
}

.style-switcher {
    position: fixed;
    right: 12px;
    bottom: 24px;
    z-index: 15;
    display: inline-flex;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 4px;
    gap: 2px;
    box-shadow: var(--shadow-float);
}

.style-btn {
    appearance: none;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 11px;
    min-height: 32px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.16s ease;
}

.style-btn.is-active {
    background: #111827;
    color: #ffffff;
}

body.theme-dark .style-btn.is-active {
    background: var(--gold);
    color: #0a0a0a;
}

/* ==========================================================================
   Hotspots Redondos con Foto (Zoom Cercano), Callouts de Zona y Pines de Dron
   ========================================================================== */
.photo-hotspot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transform-origin: center bottom;
    transition: transform 0.15s ease;
    user-select: none;
}

.photo-hotspot:hover {
    transform: scale(1.08);
}

.photo-hotspot.has-360 {
    z-index: 6 !important;
}

.hotspot-avatar-ring {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    padding: 3px;
    background: #ffffff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
}

.photo-hotspot.has-360 .hotspot-avatar-ring {
    background: linear-gradient(135deg, #ffcc00, #ff8800, #ffe566);
    box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.45);
}

.hotspot-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: #1f2937;
}

.hotspot-badge-360 {
    position: absolute;
    top: -6px;
    right: -8px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #0a0a0a;
    color: var(--gold);
    border: 1.5px solid var(--gold);
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
}

.hotspot-badge-stack {
    position: absolute;
    top: -6px;
    left: -10px;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--gold);
    color: #0a0a0a;
    border: 1.5px solid #0a0a0a;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
}

.hotspot-label-pill {
    margin-top: -8px;
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--venta-bg);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.1;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.32);
    white-space: nowrap;
}

.hotspot-label-pill.is-venta {
    background: var(--venta-emerald);
}

.hotspot-label-pill.is-renta {
    background: var(--renta-blue);
}

.hotspot-cat-mini {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    opacity: 0.88;
    padding-left: 4px;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
}

/* Callout de Zona Macro */
.zone-callout-marker {
    cursor: pointer;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.84);
    color: #ffffff;
    border: 1px solid rgba(255, 204, 0, 0.65);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    white-space: nowrap;
    transition: transform 0.15s ease, background 0.15s ease;
}

.zone-callout-marker:hover {
    transform: scale(1.06);
    background: #0a0a0a;
    color: var(--gold);
}

/* Pin de Dron / Toma Aérea krpano */
.drone-pin-marker {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #0a0a0a;
    color: var(--gold);
    border: 1.5px solid var(--gold);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
    white-space: nowrap;
    transition: transform 0.15s ease;
}

.drone-pin-marker:hover {
    transform: scale(1.07);
}

/* ==========================================================================
   Tarjeta Inferior Deslizable (Propiedad Individual o Carrusel de Torre)
   ========================================================================== */
.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 35;
    padding: 0 10px calc(12px + env(safe-area-inset-bottom));
    pointer-events: none;
    transform: translateY(110%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-sheet.is-open {
    transform: translateY(0);
}

.sheet-shell {
    pointer-events: auto;
    max-width: 680px;
    margin: 0 auto;
    background: #141414;
    color: #f5f5f5;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sheet);
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.sheet-header-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--gold);
}

.sheet-close-btn {
    appearance: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}

.sheet-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.sheet-carousel::-webkit-scrollbar {
    display: none;
}

.sheet-card {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: 124px 1fr;
    gap: 12px;
    background: #1c1c1c;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 10px;
}

.sheet-carousel.is-multi .sheet-card {
    flex: 0 0 88%;
}

@media (max-width: 440px) {
    .sheet-card {
        grid-template-columns: 104px 1fr;
    }
}

.sheet-card-media {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 4;
    background: #0a0a0a;
}

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

.sheet-media-360 {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.88);
    color: var(--gold);
    border: 1px solid var(--gold);
    font-size: 10px;
    font-weight: 700;
}

.sheet-card-body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    gap: 6px;
}

.sheet-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.sheet-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 8px;
    border-radius: 999px;
}

.sheet-pill-op {
    background: var(--gold);
    color: #0a0a0a;
}

.sheet-pill-direct {
    background: rgba(37, 211, 102, 0.16);
    color: var(--green);
    border: 1px solid rgba(37, 211, 102, 0.4);
}

.sheet-pill-asesor {
    background: rgba(255, 204, 0, 0.14);
    color: var(--gold);
    border: 1px solid rgba(255, 204, 0, 0.4);
}

.sheet-price {
    font-size: 19px;
    font-weight: 700;
    color: var(--gold);
    line-height: 1.15;
}

.sheet-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.25;
}

.sheet-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
}

.sheet-spec-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sheet-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    background: var(--gold);
    color: #0a0a0a;
    font-size: 13px;
    font-weight: 700;
    margin-top: 2px;
}

/* ==========================================================================
   Modal Pantalla Completa para Visor Aéreo krpano
   ========================================================================== */
.krpano-modal {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: #0a0a0a;
    display: flex;
    flex-direction: column;
}

.krpano-modal-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #141414;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: #f5f5f5;
}

.krpano-modal-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.krpano-close-btn {
    appearance: none;
    min-height: 38px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.krpano-iframe {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
}

/* Ajustes móviles compactos */
@media (max-width: 640px) {
    .topbar-line-1 {
        padding: 7px 8px;
        gap: 6px;
    }
    .brand-wordmark {
        font-size: 15px;
    }
    .zone-select {
        max-width: 138px;
        font-size: 16px;
    }
    .map-counter-pill {
        bottom: 66px;
        left: 10px;
    }
    .style-switcher {
        bottom: 16px;
        right: 10px;
    }
}
