/**
 * Cotizador y Mapa Interactivo - Estilos Estandarizados
 * Bosques del Sol CRM
 */

:root {
    --cotizador-primary: #22c55e;
    --cotizador-primary-hover: #16a34a;
    --cotizador-dark-bg: #111827;
    --cotizador-header-bg: #1e293b;
    --cotizador-border: #e2e8f0;
    --cotizador-text-muted: #94a3b8;
}

/* ==========================================================================
   0. Optimización para Mapa Interactivo en Dispositivos Móviles y Escritorio
   ========================================================================== */
.map-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
    margin-bottom: 30px;
}

.map-scroll-container {
    position: relative;
    width: 100%;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.map-scroll-container img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 16px;
}

/* Control Desplegable de Filtrado de Lotes (Ubicado Arriba del Mapa) */
.lot-filter-dropdown-wrapper {
    position: relative;
    display: inline-block;
    z-index: 100;
}

.btn-filter-dropdown {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.btn-filter-dropdown:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.lot-filter-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 200px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 8px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    z-index: 105;
}

.lot-filter-dropdown-menu.show {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.lot-filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.lot-filter-item:hover {
    background-color: #f8fafc;
    color: #1e293b;
}

.lot-filter-item.active {
    background-color: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.dot-disponible { background-color: #10b981; }
.dot-apartado { background-color: #f59e0b; }
.dot-vendido { background-color: #ef4444; }

/* Oscurecimiento completo de polígonos y textos no coincidentes */
polygon.highlight {
    transition: all 0.3s ease;
}

polygon.highlight.polygon-darkened {
    fill: #1e293b !important;
    opacity: 0.95 !important;
    filter: grayscale(100%) brightness(0.35) !important;
    pointer-events: none !important;
}

polygon.highlight.polygon-darkened + text {
    fill: rgba(255, 255, 255, 0.25) !important;
    opacity: 0.35 !important;
    pointer-events: none !important;
    transition: all 0.3s ease;
}

@media (max-width: 767.98px) {
    .map-scroll-container {
        min-width: 750px;
    }

    .tooltip-one.mobile-popover {
        position: fixed !important;
        left: 50% !important;
        top: auto !important;
        bottom: 20px !important;
        transform: translateX(-50%) !important;
        z-index: 1040 !important;
        width: 92vw !important;
        max-width: 340px !important;
    }

    .tooltip-one.mobile-popover .lot-card-popover {
        width: 100% !important;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25) !important;
    }
}

/* ==========================================================================
   1. Tooltip & Popover Flotante de Lotes
   ========================================================================== */
.tooltip-one {
    display: none;
    position: absolute;
    z-index: 99999;
    pointer-events: auto;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.lot-card-popover {
    width: 280px;
    padding: 18px;
    background: #ffffff;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.16), 0 5px 15px rgba(0, 0, 0, 0.08);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1a202c;
    position: relative;
}

.lot-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.lot-card-close {
    background: transparent;
    border: none;
    font-size: 20px;
    font-weight: 700;
    color: #a0aec0;
    cursor: pointer;
    line-height: 1;
    padding: 0 0 0 8px;
    transition: color 0.15s ease;
}

.lot-card-close:hover {
    color: #4a5568;
}

.lot-card-title {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.5px;
}

.lot-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

.lot-badge-disponible {
    background-color: #d1fae5;
    color: #065f46;
}

.lot-badge-apartado {
    background-color: #fef3c7;
    color: #92400e;
}

.lot-badge-vendido {
    background-color: #fee2e2;
    color: #991b1b;
}

.lot-card-subtitle {
    color: #64748b;
    font-size: 13px;
    margin-top: 2px;
    margin-bottom: 10px;
}

.lot-card-divider {
    border: 0;
    border-top: 1px solid #f1f5f9;
    margin: 10px 0 12px 0;
}

.lot-card-grid {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.lot-card-col {
    flex: 1;
}

.lot-card-label {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 2px;
}

.lot-card-val {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    display: block;
}

.lot-card-subval {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    display: block;
}

.lot-card-actions {
    margin-top: 14px;
}

.btn-cotizar-action {
    display: block;
    width: 100%;
    text-align: center;
    color: #10b981;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 10px;
    text-decoration: none !important;
    background: transparent;
    border: none;
    padding: 2px 0;
    transition: color 0.15s ease;
}

.btn-cotizar-action:hover {
    color: #059669;
}

.btn-whatsapp-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    background-color: #00a884;
    color: #ffffff !important;
    font-weight: 700;
    font-size: 13px;
    padding: 9px 0;
    border-radius: 12px;
    text-decoration: none !important;
    transition: background-color 0.2s ease;
}

.btn-whatsapp-card:hover {
    background-color: #008f70;
    color: #ffffff !important;
}

/* ==========================================================================
   2. Side Drawer Panel (Escritorio) & Fullscreen Panel (Móvil)
   ========================================================================== */
.side-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.side-drawer-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.side-drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 92vw;
    height: 100vh;
    background-color: #ffffff;
    z-index: 1050;
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.side-drawer-panel.show {
    transform: translateX(0);
}

/* En Móviles (<768px): Panel a Pantalla Completa */
@media (max-width: 767.98px) {
    .side-drawer-panel {
        top: 0;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
        box-shadow: none;
    }

    .side-drawer-panel.show {
        transform: translateY(0);
    }
}

.side-drawer-badges {
    display: flex;
    align-items: center;
    gap: 10px;
}

.side-drawer-close {
    background: transparent;
    border: none;
    font-size: 28px;
    font-weight: 700;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.15s ease;
}

.side-drawer-close:hover {
    color: #334155;
}

.side-drawer-hr {
    border: 0;
    border-top: 1px solid #f1f5f9;
    margin: 14px 0;
}

/* ==========================================================================
   3. Simulador Financiero & Tarjetas de Planes
   ========================================================================== */
.plan-pills-wrapper {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 2px 8px 2px;
    margin-bottom: 12px;
    scrollbar-width: thin;
}

.plan-pill-item {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 220px;
    border: 1.5px solid var(--cotizador-border);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    text-align: left;
}

.plan-pill-item:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.plan-pill-item.active {
    border-color: var(--cotizador-primary);
    background-color: #f0fdf4;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

.plan-pill-item strong {
    display: block;
    font-size: 12px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-pill-item small {
    font-size: 11px;
    color: #64748b;
    display: block;
    margin-top: 2px;
}

/* ==========================================================================
   4. Tarjeta Oscura de Cotización
   ========================================================================== */
.side-dark-card {
    background-color: var(--cotizador-dark-bg);
    color: #ffffff;
    border-radius: 20px;
    padding: 20px;
    margin-top: 10px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.side-dark-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
}

.side-dark-row .label {
    color: #9ca3af;
    font-weight: 500;
}

.side-dark-row .val {
    font-weight: 700;
    color: #ffffff;
}

.side-mensual-banner {
    text-align: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 16px 12px;
    margin: 16px 0;
}

.side-mensual-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #9ca3af;
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

.side-mensual-val {
    font-size: 32px;
    font-weight: 800;
    color: var(--cotizador-primary);
    display: block;
    margin: 4px 0;
    letter-spacing: -0.5px;
}

.side-mensual-sub {
    font-size: 12px;
    color: #9ca3af;
    display: block;
    margin-top: 2px;
}

.side-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.btn-side-pdf {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    text-decoration: none !important;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-side-pdf:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-side-formal {
    background: var(--cotizador-primary);
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    text-decoration: none !important;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-side-formal:hover {
    background: var(--cotizador-primary-hover);
}

/* ==========================================================================
   5. Modal Cotización Formal
   ========================================================================== */
.formal-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.formal-modal-header {
    background-color: var(--cotizador-header-bg);
    color: #ffffff;
    padding: 20px 24px;
    border-bottom: none;
    position: relative;
}

.formal-modal-title {
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 2px;
}

.formal-modal-subtitle {
    font-size: 13px;
    color: #94a3b8;
}

.formal-modal-body {
    padding: 24px;
    background-color: #ffffff;
}

.custom-formal-label {
    font-size: 13px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 6px;
    display: block;
}

.custom-formal-input {
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    height: auto !important;
    color: #1e293b !important;
    transition: all 0.2s ease !important;
}

.custom-formal-input:focus {
    border-color: var(--cotizador-primary) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15) !important;
    outline: none !important;
}

.formal-modal-footer {
    background-color: #f8fafc;
    padding: 16px 24px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel-formal {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #475569;
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-cancel-formal:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-submit-formal {
    background: var(--cotizador-primary);
    border: none;
    color: #ffffff;
    border-radius: 10px;
    padding: 10px 22px;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-submit-formal:hover {
    background: var(--cotizador-primary-hover);
}

/* LADA & Phone Group Styling */
.lada-phone-group {
    display: flex !important;
    align-items: center !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

.lada-phone-group:focus-within {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.lada-phone-group .input-group-prepend {
    margin-right: 0 !important;
}

.lada-prepend-box {
    display: flex !important;
    align-items: center !important;
    background-color: #f8fafc !important;
    border-right: 1px solid #e2e8f0 !important;
    padding-left: 12px !important;
}

.lada-flag-icon {
    width: 20px !important;
    height: 14px !important;
    object-fit: cover !important;
    border-radius: 2px !important;
    box-shadow: 0 0 2px rgba(0,0,0,0.2) !important;
    margin-right: 6px !important;
}

.lada-phone-group .lada-select {
    border: none !important;
    background-color: transparent !important;
    border-right: none !important;
    border-radius: 0 !important;
    height: 44px !important;
    padding: 0 22px 0 0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: #1e293b !important;
    cursor: pointer !important;
    outline: none !important;
    box-shadow: none !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 4px center !important;
}

.lada-phone-group .phone-input {
    border: none !important;
    border-radius: 0 !important;
    height: 44px !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 14px !important;
    color: #1e293b !important;
    padding-left: 14px !important;
}

.lada-phone-group .phone-input::placeholder {
    color: #94a3b8 !important;
}
