:root {
    --bg-color: #050a10;
    --accent-color: #fbbf24;
    --accent-glow: rgba(251, 191, 36, 0.4);
    --glass-bg: rgba(15, 25, 35, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

#globe-viz {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

/* Permitir clicks en todos los elementos interactivos */
header,
.sidebar,
#project-details,
button,
a,
.modal-overlay,
.modal-content,
#add-project-form,
.location-group {
    position: relative;
    pointer-events: auto;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    margin: 10px;
}

header {
    position: fixed;
    /* SIEMPRE arriba */
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: linear-gradient(to bottom,
            rgba(5, 10, 16, 0.95) 0%,
            rgba(5, 10, 16, 0.85) 40%,
            rgba(5, 10, 16, 0.0) 100%);
    pointer-events: auto;
    z-index: 30;
    /* por encima del globo y del UI */
}

nav#main-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 9999;
    /* 🔥 AGREGAR ESTO */
    pointer-events: auto;
}

/* Botón hamburguesa (escondido por defecto en PC) */
/* Botón menú hamburguesa */
.menu-toggle {
    display: none;
    /* solo se mostrará en móvil */
    background: transparent;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    margin-left: auto;
}

.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 999px;
}

/* Versión escritorio: nav normal */
header nav#main-nav {
    display: flex;
    align-items: center;
}


.logo {
    display: flex;
    align-items: center;
    gap: 24px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.custom-logo {
    height: 55px; /* Altura máxima para alinearse con el header elegante */
    width: 500px; /* Mantener proporción original de la foto */
    max-width: 300px; /* Prevenir expansión masiva de logos anchos */
    object-fit: contain;
    margin-top: 20px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px var(--accent-glow);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 25px var(--accent-glow);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 10px var(--accent-glow);
    }
}

h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: 1px;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 32px;
    font-weight: 600;
    transition: color 0.3s;
    font-size: 15px;
}

nav a:hover,
nav a.active {
    color: var(--accent-color);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px 48px;
    width: 380px;
    margin-top: 20px;
    max-height: none;
    overflow: visible;
}

h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.stat-container {
    display: flex;
    gap: 20px;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--text-primary);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.stat-label {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Scroll interno en listas */
.project-list {
    max-height: 40vh;
    overflow-y: auto;
}

.other-project-list {
    max-height: 18vh;
    overflow-y: auto;
}

ul {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
}

/* Custom Scrollbar */
ul::-webkit-scrollbar,
.project-list::-webkit-scrollbar,
.other-project-list::-webkit-scrollbar {
    width: 4px;
}

ul::-webkit-scrollbar-thumb,
.project-list::-webkit-scrollbar-thumb,
.other-project-list::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

li {
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

li:hover {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    transform: translateX(5px);
}

li .prj-name {
    font-weight: 600;
    font-size: 15px;
}

li .prj-loc {
    font-size: 13px;
    color: var(--text-secondary);
}

li .prj-kw {
    font-weight: 800;
    color: var(--accent-color);
    font-size: 14px;
}

/* Detalles del Proyecto (derecha) */
#project-details {
    position: fixed;
    /* fijo respecto a la ventana */
    right: 32px;
    /* pegado a la derecha */
    top: 80px;
    /* debajo del menú */
    width: 360px;
    /* un poco más compacto */
    max-height: calc(100vh - 120px);
    /* que no se salga por abajo */
    overflow-y: auto;
    /* scroll interno si es necesario */
    transform: translateX(120%);
    /* oculto hacia la derecha por defecto */
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 25;
    /* por encima del globo y panel izquierdo */
}

#project-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000 !important;
    /* 🔥 AHORA sí va encima de TODO */
}

#project-modal.show {
    display: flex !important;
    /* 🔥 fuerza a que se muestre */
}

#project-details::-webkit-scrollbar {
    width: 4px;
}

#project-details::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

#project-details.show {
    transform: translateX(0);
    opacity: 1;
}

#close-details {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.3s;
}

#close-details:hover {
    color: var(--accent-color);
}

#det-title {
    font-size: 28px;
    color: white;
    text-transform: none;
    margin-bottom: 8px;
    padding-right: 30px;
}

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-color);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 20px;
}

.det-image {
    width: 100%;
    height: 200px;
    background-color: #1e293b;
    border-radius: 12px;
    margin-bottom: 20px;
    background-size: cover;
    background-position: center;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.btn-primary {
    width: 60%;
    padding: 16px;
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--accent-glow);
    margin: 0;
}

.btn-primary:hover {
    background: #fcd34d;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Otros proyectos: nombre + sector + acciones */
.other-item {
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.other-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.other-name {
    font-size: 13px;
}

.other-sector {
    color: var(--accent-color);
    font-size: 11px;
}

/* Botones mini de editar / borrar */
.other-actions {
    display: flex;
    gap: 6px;
}

/* Botón EDITAR del panel derecho */
#btn-edit-project {
    width: 30%;
    height: 50px;
    justify-content: center;
    font-weight: 600;
    border-color: var(--accent-color);
    color: var(--accent-color);
    padding-inline: 10px;
    margin: 10px;
}

#btn-edit-project:hover {
    background: rgba(251, 191, 36, 0.15);
    color: #fefce8;
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-icon {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(251, 191, 36, 0.1);
}

/* Utilidad genérica para ocultar elementos */
.hidden {
    display: none !important;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-danger:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* Botón tipo enlace debajo del campo de ubicación */
.btn-link {
    margin-top: 6px;
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    align-self: flex-start;
}

.btn-link:hover {
    color: #fef9c3;
}

.btn-danger.hidden {
    display: none;
}

/* --- ESTILOS DEL MODAL DE PROYECTO --- */
.btn-add {
    background: var(--accent-color);
    color: #000 !important;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 800 !important;
    box-shadow: 0 0 10px var(--accent-glow);
}

.btn-add:hover {
    background: #fcd34d;
    box-shadow: 0 0 20px var(--accent-glow);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(5px);
}

.modal-overlay.show {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
}

.modal-content {
    width: min(500px, calc(100% - 32px));
    /* nunca más ancho que la pantalla */
    max-height: 80vh;
    /* un poco más bajo para que no pegue al borde */
    overflow-y: auto;
    overflow-x: hidden;
    /* evita scroll horizontal */
    box-sizing: border-box;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

#add-project-form input,
#add-project-form select,
#add-project-form textarea {
    max-width: 100%;
}

.modal-overlay.show .modal-content {
    transform: translateY(0);
}

/* Etiqueta con el nombre del municipio/departamento */
#region-label {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(15, 25, 35, 0.9);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 13px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 25;
}

#region-label.show {
    opacity: 1;
}

@media (max-width: 768px) {
    #region-label {
        top: 70px;
        font-size: 12px;
    }
}

#close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 28px;
    cursor: pointer;
}

#close-modal:hover {
    color: var(--accent-color);
}

.form-group {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 600;
}

.filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-row select {
    flex: 1;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    font-size: 12px;
}

input,
select,
textarea {
    width: 95%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s;
}

select {
    background-color: #050a10; /* Fuerza color oscuro en el dropdown */
}

select option {
    background-color: #050a10;
    color: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

input[type="file"] {
    padding: 8px;
}

/* Autocomplete de ciudades */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    list-style: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.autocomplete-results.hidden {
    display: none;
}

.autocomplete-results li {
    padding: 10px 16px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.autocomplete-results li:hover {
    background: var(--accent-glow);
    color: white;
}

.det-location {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.det-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

/* Otros proyectos: nombre + sector + acciones */
.other-item {
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.other-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.other-name {
    font-size: 13px;
}

.other-sector {
    color: var(--accent-color);
    font-size: 11px;
}

/* Botones mini de editar / borrar */
.other-actions {
    display: flex;
    gap: 6px;
}

.btn-icon {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 999px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-icon:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(251, 191, 36, 0.1);
}

.det-meta-item {
    display: flex;
    flex-direction: column;
}

.det-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.det-meta-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-color);
}

.right-other {
    margin-top: 20px;
    width: 400px;
}

/* =========================
   RESPONSIVE – TABLET
   ========================= */
@media (max-width: 1024px) {
    header {
        padding: 16px 20px;
    }

    .sidebar {
        padding: 16px 20px;
        width: 320px;
    }

    #project-details {
        right: 20px;
        width: 340px;
    }
}

/* Aviso de instrucciones del globo */
.globe-hint {
    position: fixed;
    left: 50%;
    bottom: 16px;
    /* PC: centrado abajo */
    transform: translateX(-50%);
    max-width: 420px;
    width: calc(100% - 40px);
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    /* fondo oscuro con transparencia */
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
    color: var(--text-secondary);
    font-size: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    z-index: 50;
    /* encima del globo y paneles */
    backdrop-filter: blur(8px);
}

.globe-hint-text strong {
    display: block;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.globe-hint-text p {
    margin: 1px 0;
}

.globe-hint-close {
    border: none;
    background: rgba(248, 250, 252, 0.08);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.globe-hint-close:hover {
    background: rgba(251, 191, 36, 0.4);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

/* Visibilidad de los textos interactivos por defecto (PC) */
.hint-desktop {
    display: block;
}
.hint-mobile {
    display: none;
}

/* Ocultar el aviso cuando se le añada la clase .hidden */
.globe-hint.hidden {
    display: none;
}

/* Versión móvil: debajo del menú */
@media (max-width: 768px) {
    .globe-hint {
        top: 68px;
        /* justo debajo del header fijo */
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: none;
        padding: 8px 10px;
        font-size: 11px;
    }

    .glass-panel h2 {
        font-size: 16px;
    }

    /* Ocultar instrucciones de escritorio y mostrar las de celular en pantallas pequeñas (<768px) */
    .hint-desktop {
        display: none !important;
    }
    .hint-mobile {
        display: block !important;
    }

    /* Ocultar barra de scroll en móviles */
    ::-webkit-scrollbar {
        display: none;
    }
}

/* =========================
   RESPONSIVE – MÓVIL
   ========================= */
@media (max-width: 768px) {

    /* El body ya NO invierte el orden */
    body {
        display: block;
        /* quitamos el flex column-reverse */
        overflow-y: auto;
        overflow-x: hidden;
        background-color: var(--bg-color);
    }

    header {
        padding: 12px 16px;
        z-index: 50;
    }

    /* Mostrar hamburguesa y ocultar nav por defecto */
    .menu-toggle {
        display: flex;
    }

    header nav#main-nav {
        position: absolute;
        top: 56px;
        right: 16px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
        padding: 10px 12px;
        display: none;
        flex-direction: column;
        gap: 8px;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
        z-index: 40;
    }

    header nav#main-nav.nav-open {
        display: flex;
    }

    header nav#main-nav a {
        margin-left: 0;
    }

    /* Menú compacto y fijo arriba */
    nav#main-nav {
        position: absolute;
        top: 56px;
        right: 16px;
        background: rgba(15, 23, 42, 0.96);
        border-radius: 12px;
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
        border: 1px solid var(--glass-border);
        display: none;
        /* se abre con .nav-open */
        z-index: 50;
    }

    .menu-toggle {
        display: block;
    }

    nav#main-nav {
        position: absolute;
        top: 56px;
        right: 16px;
        background: rgba(15, 23, 42, 0.96);
        border-radius: 12px;
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
        border: 1px solid var(--glass-border);
        display: none;
        /* se abre con .nav-open */
        z-index: 50;
    }

    nav#main-nav.nav-open {
        display: flex;
        z-index: 9999;
        /* menú por encima del header */
        pointer-events: auto;
    }

    nav#main-nav a {
        white-space: nowrap;
        font-size: 13px;
        margin: 0;
    }

    header h1 {
        font-size: 18px;
    }

    nav {
        display: flex;
        align-items: center;
        gap: 10px;
        overflow-x: auto;
        white-space: nowrap;
    }

    nav a {
        margin-left: 0;
        font-size: 13px;
        padding: 4px 0;
    }

    .btn-add {
        font-size: 12px;
        padding: 5px 10px;
    }

    /* El globo va DEBAJO del header fijo */
    #globe-viz {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        height: 45vh;
        /* medio alto de pantalla aprox */
        margin-top: 60px;
        /* espacio para que no lo tape el header */
        z-index: 0;
    }

    .globe-hint {
        top: 68px;
        /* justo debajo del header fijo */
        bottom: auto;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 32px);
        max-width: none;
        padding: 8px 10px;
        font-size: 11px;
    }

    /* Toda la info va DEBAJO del mapa */
    #ui-layer {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        height: auto;
        pointer-events: auto;
        padding-top: 12px;
        padding-bottom: 24px;
        display: flex;
        flex-direction: column;
        gap: 16px;
    }

    .sidebar {
        width: 100%;
        padding: 0 16px;
        margin-top: 0;
    }

    .glass-panel.main-stats {
        margin-bottom: 8px;
    }

    .project-list {
        max-height: none;
    }

    /* Cuadro de detalles: bloque completo bajo los otros cuadros */
    #project-details {
        position: relative;
        right: auto;
        top: auto;
        width: calc(100% - 32px);
        max-height: none;
        margin: 8px 16px 0 16px;
        transform: none;
        opacity: 1;
        overflow-y: visible;
    }

    #project-details.hidden {
        display: none;
    }

    #project-details.show {
        display: block;
    }

    /* "Otros proyectos" también ocupará todo el ancho abajo */
    .glass-panel .other-wrapper {
        width: 100%;
        margin-top: 8px;
    }

    /* Reducción sutil del logo en móviles si es necesario */
    .custom-logo {
        height: 38px;
    }

    /* Modal más estrecho en móvil */
    .modal-content {
        width: calc(100% - 32px);
    }
}

/* MENÚ A LA DERECHA EN COMPUTADOR */
@media (min-width: 769px) {

    /* Menú de escritorio: siempre visible, alineado a la derecha */
    nav#main-nav {
        display: flex !important;
        position: static;
        margin-left: auto;
        align-items: center;
        gap: 24px;
    }

    header nav {
        margin-left: auto;
    }

    .menu-toggle {
        display: none;
        /* ocultamos hamburguesa en PC */
    }
}



/* =============================== */
/* BOTON FLOTANTE SCROLL (MÓVIL) */
/* =============================== */
.scroll-down-mobile {
    display: none; /* Oculto en PC por defecto */
    position: fixed; /* Fixed para que soporte el scroll global nuevo */
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999; /* Por encima de todo menos el modal y el lock */
    pointer-events: auto; /* Forzar interactividad */
    color: var(--text-primary);
    text-decoration: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 2px 5px rgba(0,0,0,0.8);
    background: rgba(15, 23, 42, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
    animation: bounce 2s infinite;
}

.scroll-down-mobile .arrow-down {
    font-size: 18px;
    margin-top: 2px;
    color: var(--accent-color);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

@media (max-width: 768px) {
    .scroll-down-mobile {
        display: flex;
    }
}

/* =============================== */
/* BLOQUEO DE ROTACIÓN (PORTRAIT LOCK) */
/* =============================== */

#portrait-lock {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    z-index: 999999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 30px;
    color: var(--text-primary);
}

#portrait-lock .lock-content {
    background: var(--glass-bg);
    border: 1px solid var(--accent-color);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8), 0 0 15px var(--accent-glow);
    max-width: 400px;
}

#portrait-lock .lock-icon {
    font-size: 50px;
    margin-bottom: 20px;
    animation: rotatePhone 2s infinite ease-in-out;
}

@keyframes rotatePhone {
    0% { transform: rotate(-90deg); }
    50% { transform: rotate(0deg); }
    100% { transform: rotate(-90deg); }
}

#portrait-lock h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
}

#portrait-lock p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* Si es un dispositivo móvil (< 900px) y está en horizontal (landscape), activar el bloqueo */
@media screen and (max-width: 900px) and (orientation: landscape) {
    #portrait-lock {
        display: flex !important;
    }
    
    /* Ocultar el resto de la interfaz para no gastar recursos inútiles de GPU detrás del cartel */
    header, .sidebar, #project-details, #globe-hint, #region-label, #globe-viz, .scroll-down-mobile {
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}