/* ============================================
   EXPLORADOR ESTELAR - ESTILOS PRINCIPALES
   Atlas interactivo de exoplanetas (50 años luz)
   Inspiración: Space Engine, NASA Eyes, ciencia ficción realista
   ============================================ */

/* ---------- RESET Y BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Evita scrollbars no deseadas, el contenido se maneja interno */
    background-color: #05070d;
    font-family: 'Segoe UI', Roboto, Arial, sans-serif;
    color: #d8e6ff;
}

body {
    display: flex;
    flex-direction: column;
}

/* ---------- VARIABLES GLOBALES ---------- */
:root {
    --bg-primary: #05070d;
    --bg-secondary: #0b1120;
    --bg-glass: rgba(11, 17, 32, 0.75);
    --bg-card: #101827;
    --bg-card-hover: #162033;
    --text-primary: #d8e6ff;
    --text-secondary: #8ba3c7;
    --accent-color: #4fc3f7;
    --accent-glow: #00e5ff;
    --habitable: #4caf50;
    --warning: #ffb74d;
    --border-subtle: rgba(79, 195, 247, 0.2);
    --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.5);
    --glass-blur: blur(12px);
    --transition: all 0.3s ease;
}

/* ---------- HEADER (barra superior) ---------- */
.main-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    z-index: 20;
    backdrop-filter: var(--glass-blur);
    position: relative;
}

.logo-title {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff, var(--accent-color));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    text-shadow: 0 0 8px rgba(79,195,247,0.3);
}

.title {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: var(--text-secondary);
}

.subtitle {
    font-size: 0.8rem;
    color: #5a78a0;
    font-style: italic;
}

.header-nav {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border-radius: 30px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.nav-btn:hover {
    background: rgba(79, 195, 247, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 5px var(--accent-glow);
}

/* ---------- LAYOUT PRINCIPAL (index) ---------- */
.app-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ---------- PANEL IZQUIERDO (filtros) ---------- */
.filters-panel {
    width: 280px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-subtle);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 15;
    transition: var(--transition);
    overflow-y: auto;
}

.search-section label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

#star-search {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 30px;
    padding: 0.7rem 1rem;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

#star-search:focus {
    outline: none;
    border-color: var(--accent-glow);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.filters-section h2 {
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-left: 3px solid var(--accent-color);
    padding-left: 10px;
}

.filters-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.filters-list li label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: var(--transition);
}

.filters-list li label:hover {
    color: var(--text-primary);
}

/* Checkbox personalizado */
.filters-list input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.filters-list input[type="checkbox"]:checked {
    background: var(--accent-color);
    border-color: var(--accent-glow);
}

.filters-list input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    color: black;
    font-size: 12px;
    top: 0px;
    left: 3px;
}

/* ---------- CONTENEDOR DEL MAPA 3D ---------- */
/* ---------- CONTENEDOR DEL MAPA 3D ---------- */
.map-container {
    flex: 1;
    position: relative;
    background: #000000;
    overflow: hidden; /* 🌟 Evita que el canvas se desborde o se meta bajo otros paneles */
}


#star-map {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
}

.loading-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(5px);
    padding: 1rem 2rem;
    border-radius: 40px;
    color: var(--accent-color);
    font-size: 0.9rem;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 10;
}

/* ---------- PANEL DERECHO (info estrella) ---------- */
.info-panel {
    position: absolute;
    right: 20px;
    top: 80px;
    width: 320px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    padding: 1.2rem;
    z-index: 20;
    transition: transform 0.3s ease, opacity 0.3s;
    opacity: 1;
    transform: translateX(0);
}

.info-panel[hidden] {
    display: none;
}

.info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.info-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--accent-glow);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
}

.close-btn:hover {
    color: var(--accent-color);
    transform: scale(1.1);
}

.star-properties {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.2rem;
}

.prop-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.prop-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.prop-value {
    color: var(--text-primary);
    font-weight: 400;
}

.star-special h3, .star-funfacts h3 {
    font-size: 0.9rem;
    color: var(--accent-color);
    margin: 1rem 0 0.5rem 0;
    letter-spacing: 1px;
}

.features-list, .funfacts-list {
    list-style: none;
    padding-left: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.features-list li, .funfacts-list li {
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    position: relative;
}

.features-list li::before, .funfacts-list li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-size: 0.7rem;
}

.info-footer {
    margin-top: 1.5rem;
}

.explore-btn {
    width: 100%;
    background: linear-gradient(90deg, #1e3a5f, #0f2a44);
    border: 1px solid var(--accent-color);
    color: var(--accent-glow);
    padding: 0.7rem;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 1px;
}

.explore-btn:hover {
    background: linear-gradient(90deg, #2a4c7a, #1a3a5a);
    box-shadow: 0 0 12px rgba(79,195,247,0.4);
    color: white;
}

/* ---------- BARRA INFERIOR (estadísticas) ---------- */
.status-bar {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 0.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    z-index: 20;
    backdrop-filter: var(--glass-blur);
}

.stat-item {
    display: flex;
    gap: 0.5rem;
}

.stat-label {
    font-weight: 600;
    color: #6e8bb8;
}

.stat-value {
    color: var(--accent-color);
    font-family: monospace;
    font-size: 0.85rem;
}

/* ---------- ESTILOS PARA SYSTEM.HTML (vista de sistema planetario) ---------- */
/* Reutilizamos mismos colores, añadimos específicos */
#system-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
}

.system-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Panel de estrella en system.html (similar al derecho pero izquierdo) */
.star-info-panel-system {
    position: absolute;
    left: 20px;
    top: 80px;
    width: 300px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    border: 1px solid var(--border-subtle);
    padding: 1rem;
    z-index: 20;
    pointer-events: auto;
}

/* Lista de planetas (abajo) */
.planets-list-container {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    padding: 1rem;
    z-index: 20;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid var(--border-subtle);
}

.planets-scroll {
    display: inline-flex;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

/* Tarjetas de planetas */
.planet-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0.8rem;
    width: 180px;
    display: inline-block;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-align: left;
}

.planet-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.planet-name {
    font-weight: bold;
    font-size: 1rem;
    color: var(--accent-glow);
    margin-bottom: 0.3rem;
}

.planet-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.habit-bar {
    background: #2a3345;
    border-radius: 10px;
    height: 6px;
    width: 100%;
    margin: 0.5rem 0;
    overflow: hidden;
}

.habit-fill {
    background: var(--habitable);
    height: 100%;
    width: 0%;
    border-radius: 10px;
}

/* Modal flotante (planet details) */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 24px;
    max-width: 450px;
    width: 90%;
    padding: 1.5rem;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 30px rgba(0,229,255,0.2);
    animation: slideUp 0.2s ease;
}

.modal-content h3 {
    color: var(--accent-glow);
    margin-bottom: 1rem;
}

.close-modal {
    float: right;
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-info-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin: 1rem 0;
}

/* ---------- SCROLLBAR PERSONALIZADA ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0f1420;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #2c4568;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ---------- ANIMACIONES ---------- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 rgba(79, 195, 247, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(79, 195, 247, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 195, 247, 0); }
}

/* Elemento seleccionado (por ejemplo estrella en 3D highlight) */
.star-highlight {
    animation: pulseGlow 1.5s infinite;
}

/* Botón explorar hover efecto */
.explore-btn:active {
    transform: scale(0.98);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
    .filters-panel {
        width: 260px;
    }
    .info-panel {
        width: 280px;
        right: 10px;
        top: 70px;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.8rem;
    }
    .app-layout {
        flex-direction: column;
    }
    .filters-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.8rem;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        overflow-x: auto;
    }
    .search-section, .filters-section {
        width: auto;
        min-width: 200px;
    }
    .info-panel {
        top: auto;
        bottom: 70px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 60vh;
        overflow-y: auto;
    }
    .status-bar {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    .planets-list-container {
        left: 10px;
        right: 10px;
    }
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }
    .title {
        font-size: 0.8rem;
    }
    .nav-btn {
        padding: 0.2rem 0.8rem;
        font-size: 0.7rem;
    }
    .planet-card {
        width: 150px;
    }
    .filters-panel {
        flex-direction: column;
    }
}

/* ---------- UTILIDADES ADICIONALES ---------- */
/* Para ocultar elementos sin eliminar del DOM */
.hidden {
    display: none !important;
}

/* Texto brillante */
.glow-text {
    text-shadow: 0 0 5px var(--accent-glow);
}

/* Fondo de canvas Three.js (asegurar que ocupe todo) */
canvas {
    display: block;
    
}

/* Ajustes para que el mapa 3D reciba eventos correctamente */
/* Ajustes para que el mapa 3D reciba eventos correctamente */
#star-map canvas {
    position: relative; /* 🌟 Cambiado de absolute a relative */
    width: 100% !important;
    height: 100% !important;
    outline: none;

}
.star-label {

    position: absolute;

    color: white;

    font-family: Arial, sans-serif;

    font-size: 13px;

    font-weight: bold;

    white-space: nowrap;

    pointer-events: none;

    user-select: none;

    transform: translate(-50%, -100%);

    text-shadow:
        0 0 3px black,
        0 0 6px black,
        0 0 10px black;

     white-space: nowrap;

}

.scale-switch-container{

    display:flex;

    align-items:center;

    gap:10px;

    color:white;

    font-weight:bold;

}

.switch{

    position:relative;

    display:inline-block;

    width:60px;

    height:30px;

}

.switch input{

    opacity:0;

    width:0;

    height:0;

}

.slider{

    position:absolute;

    cursor:pointer;

    top:0;

    left:0;

    right:0;

    bottom:0;

    background:#2196F3;

    transition:.3s;

    border-radius:34px;

}

.slider:before{

    position:absolute;

    content:"";

    height:22px;

    width:22px;

    left:4px;

    bottom:4px;

    background:white;

    transition:.3s;

    border-radius:50%;

}

.switch input:checked + .slider{

    background:#2196F3;

}

.switch input:checked + .slider:before{

    transform:translateX(30px);

}
#star-map{
    position:relative;
}

#galaxy-fade{
    position:absolute;
    inset:0;
    background:black;
    opacity:0;
    pointer-events:none;
}
.panel-header{

    display:flex;

    align-items:center;

    gap:10px;

    margin-bottom:10px;

}

#toggle-filters{

    background:none;

    border:none;

    color:white;

font-size: 24px;
    cursor: pointer;
    display: block;
    margin-bottom: 10px;

}
.filters-panel.collapsed{
    position: absolute;
    width:160px;
    height: 40px;
padding: 5px;       /* IMPORTANTE: pon el padding a 0 */
    margin: 0;
    background: transparent !important;
    border: none !important; /* Elimina bordes si existen */
    display: flex;
    overflow: visible; /* Permitimos que el botón sea lo único visible */

  

}
.filters-panel.collapsed .search-section,
.filters-panel.collapsed .filters-section{

    display:none;

}