/* ==========================================================================
   1. VARIABLES Y CONFIGURACIÓN (Design Tokens)
   ========================================================================== */
:root {
    /* Paleta MeeyajKaaj */
    --coral: #FF7E67;
    --cyan: #00E5FF;
    --dark: #1A1A1E;
    --white: #FFFFFF;
    
    /* Grises y Soporte */
    --bg-light: #F8FAFC;
    --text-main: #1E293B;
    --text-muted: #94A3B8;
    --border-color: #F1F5F9;
    
    /* Efectos */
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. RESET Y BASE
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
}

body {
    background-color: var(--white);
    color: var(--text-main);
    overflow: hidden; /* Mantiene la App fija */
    height: 100vh;
}

/* ==========================================================================
   3. ESTRUCTURA (Layout)
   ========================================================================== */
.wrapper {
    height: calc(100vh - 70px); /* Ajustar según altura de tu header */
    position: relative;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    height: 100%;
}

/* Contenedor del Mapa */
.map-area {
    position: relative;
    margin: 15px;
    border-radius: 35px;
    overflow: hidden;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    perspective: 1200px; /* Base para efecto 3D */
    transition: var(--transition);
}

#map {
    height: 100%;
    width: 100%;
    z-index: 1;
    transition: transform 0.8s ease-in-out;
}

/* Estado 3D Activo */
.map-3d-active #map {
    transform: rotateX(25deg) translateY(-20px) scale(1.05);
}

/* ==========================================================================
   4. COMPONENTES (UI Elements)
   ========================================================================== */

/* Buscador Flotante */
.search-box {
    position: absolute;
    top: 30px;
    left: 35px;
    z-index: 1000;
    background: var(--white);
    display: flex;
    width: 340px;
    padding: 6px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.search-box input {
    flex: 1;
    border: none;
    padding: 10px 15px;
    outline: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.search-btn {
    background: var(--dark);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.search-btn:hover { background: var(--coral); }

/* Botón de Acción Radar */
.btn-active-radar {
    position: absolute;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--dark);
    color: white;
    padding: 16px 32px;
    border-radius: 100px;
    border: none;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
    transition: var(--transition);
}

.btn-active-radar:hover {
    transform: translateX(-50%) translateY(-3px);
    box-shadow: 0 20px 40px rgba(0, 229, 255, 0.2);
}

/* Sidebar de Matches */
.sidebar {
    background: var(--white);
    padding: 30px;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.sidebar-header h3 { font-weight: 800; font-size: 1.3rem; }

.match-card {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--white);
    border-radius: 24px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
}

.match-card:hover {
    transform: translateX(8px);
    border-color: var(--cyan);
}

.icon-box {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    background: var(--bg-light);
    font-size: 1.2rem;
}

/* ==========================================================================
   5. MAP MARKERS (Leaflet Custom)
   ========================================================================== */

/* Marcador de Usuario (Angel) */
.user-marker {
    width: 22px;
    height: 22px;
    background: var(--dark);
    border: 3px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--cyan);
}

/* Marcador de Negocios/Servicios */
.business-marker {
    background: var(--white);
    border: 2px solid var(--coral);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.business-marker i {
    color: var(--coral);
    font-size: 1rem;
}

/* ==========================================================================
   6. ANIMACIONES (Radar Sonar)
   ========================================================================== */

@keyframes sonar-sweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.radar-sweep-container {
    width: 260px;
    height: 260px;
    border-radius: 50%;
    position: relative;
    border: 1px solid rgba(0, 229, 255, 0.2);
    pointer-events: none;
    overflow: hidden;
}

/* El haz de luz cónico */
.radar-sweep-container::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 100%; height: 100%;
    background: conic-gradient(from 0deg, var(--cyan) 0deg, transparent 90deg);
    transform-origin: top left;
    animation: sonar-sweep 2s linear infinite;
    opacity: 0.3;
}

/* ==========================================================================
   7. RESPONSIVE
   ========================================================================== */


/* --- TABLETS (Menos de 1024px) --- */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr 320px; /* Reducimos un poco la sidebar */
    }
    .search-box {
        width: 300px;
    }
}

/* --- MÓVILES (Menos de 768px) --- */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto; /* Permitimos scroll para ver el contenido inferior */
    }

    .main-layout {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    /* 1. El Mapa ocupa la vista principal (Hero) */
    .map-area {
        margin: 0;
        border-radius: 0;
        height: 60vh; /* El mapa ocupa el 60% de la pantalla */
        width: 100vw;
        border: none;
        position: sticky;
        top: 0;
    }

    /* 2. Buscador en Móvil (Full Width) */
    .search-box {
        top: 15px;
        left: 15px;
        right: 15px;
        width: calc(100% - 30px);
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }

    /* 3. Sidebar transformada en "Bottom Sheet" */
    .sidebar {
        position: relative;
        z-index: 2000;
        background: var(--white);
        width: 100%;
        border-radius: 30px 30px 0 0; /* Bordes redondeados superiores */
        margin-top: -30px; /* Se enciman un poco al mapa */
        padding: 25px 20px 100px 20px; /* Espacio extra abajo para el Navbar */
        border-left: none;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.05);
        height: auto;
        min-height: 50vh;
    }

    /* Indicador de "arrastre" visual para la hoja inferior */
    .sidebar::before {
        content: '';
        position: absolute;
        top: 12px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 5px;
        background: #E2E8F0;
        border-radius: 10px;
    }

    /* 4. Botón de Radar en Móvil */
    .btn-active-radar {
        bottom: 20px;
        width: 85%;
        padding: 14px;
        font-size: 0.8rem;
    }

    /* 5. Ajuste de Cards en Móvil */
    .match-card {
        padding: 15px;
        border-radius: 20px;
    }

    .icon-box {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }

    .sidebar-header h3 {
        font-size: 1.1rem;
    }
}

/* --- MÓVILES PEQUEÑOS (Menos de 480px) --- */
@media (max-width: 480px) {
    .map-area {
        height: 55vh;
    }
    
    .info h4 {
        font-size: 0.9rem;
    }
    
    .info p {
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .btn-active-radar {
        bottom: 40px; /* Sube un poco para no chocar con la Bottom Sheet */
        width: auto; /* No ocupa todo el ancho, se ve más pro como pastilla */
        padding: 12px 24px;
        font-size: 0.75rem;
    }
    
    .search-box {
        top: 20px;
        left: 20px;
        width: calc(100% - 100px); /* Deja espacio para el botón 3D al lado */
    }

    .map-controls {
        top: 20px;
        right: 20px;
    }
}