/* BARRA SUPERIOR (sustituye a las barras laterales) */

#topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 70px;
    transition: box-shadow 0.3s ease;
}

#topbar.con-scroll {
    box-shadow: 0 8px 25px -12px rgb(255, 165, 240);
}


/* AVISOS */

#anuncio-bar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px 50px;
    background: linear-gradient(90deg, #381321 0%, #5a1d4a 50%, #381321 100%);
    font-size: 13px;
}

#anuncio-bar[hidden] {
    display: none;
}

#anuncio-contenido {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.anuncio-icono {
    height: 15px;
    width: 15px;
    color: #ff9fe9;
}

#anuncio-texto strong {
    color: #ffd1ec;
}

.anuncio-detalle {
    opacity: 0.8;
}

#anuncio-enlace {
    color: #ff9fe9;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

#anuncio-enlace:hover {
    text-decoration: underline;
}

#anuncio-cerrar {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    color: #ffd1ec;
    font-size: 14px;
    cursor: pointer;
    opacity: 0.7;
}

#anuncio-cerrar:hover {
    opacity: 1;
}


/* BARRA PRINCIPAL */

#topbar-principal {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 28px;
    height: 70px;
    padding: 0 40px;
    background: rgba(29, 5, 29, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 0.5px solid rgba(255, 209, 236, 0.25);
}

#topbar-logo {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
}

#topbar-logo img {
    height: 40px;
    width: auto;
}

#topbar-logo span {
    font-family: "Abril Fatface", serif;
    font-size: 24px;
}

#topbar-menu {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

#topbar-links {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
}

.topbar-link {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 11px;
    white-space: nowrap;
    border-radius: 8px;
    border: none;
    background: none;
    color: #e8d5e2;
    font-family: inherit;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.topbar-link:hover {
    color: white;
    background: rgba(56, 19, 33, 0.8);
}

.topbar-link.actual {
    color: #ff9fe9;
}


/* Puente invisible para que el menú no se cierre al bajar el ratón */


/* ACCIONES (online + botón) */

#topbar-acciones {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 15px;
}

#topbar-online {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 0.5px solid rgba(255, 209, 236, 0.4);
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
    cursor: default;
}

#topbar-online[hidden] {
    display: none;
}

.topbar-separador {
    opacity: 0.5;
}

/* Contadores de Discord (js/discord-stats.js): si la API falla, solo se ve "No disponible" */
.discord-no-disponible {
    opacity: 0.6;
    font-weight: normal;
}

/* Todos los contadores vienen de la misma API: si falla uno, fallan todos */
body:has(.discord-no-disponible) .ocultar-sin-datos {
    display: none;
}

.punto-online {
    position: relative;
    height: 8px;
    width: 8px;
    border-radius: 50%;
    background: #3ba55d;
}

/* Onda que sale del punto verde */
.punto-online::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #3ba55d;
    animation: latido 2s ease-out infinite;
}

@keyframes latido {
    from { transform: scale(1); opacity: 0.7; }
    to { transform: scale(2.8); opacity: 0; }
}

#topbar-cta {
    padding: 10px 22px;
    border-radius: 8px;
    border: 1px solid #ffd1ec;
    background: #381321;
    color: white;
    font-family: "Abril Fatface", serif;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 0 10px -3px rgb(255, 165, 240);
    transition: background 0.2s;
}

#topbar-cta:hover {
    background: #5a1d4a;
}


/* HAMBURGUESA (solo móvil) */

#topbar-hamburguesa {
    display: none;
    flex-direction: column;
    gap: 5px;
    margin-left: auto;
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
}

#topbar-hamburguesa span {
    display: block;
    height: 2px;
    width: 24px;
    border-radius: 2px;
    background: #ffd1ec;
    transition: transform 0.3s, opacity 0.3s;
}

#topbar.menu-abierto #topbar-hamburguesa span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

#topbar.menu-abierto #topbar-hamburguesa span:nth-child(2) {
    opacity: 0;
}

#topbar.menu-abierto #topbar-hamburguesa span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


@media (max-width: 1500px) and (min-width: 1281px) {
    #topbar-online [data-discord="members"],
    #topbar-online .topbar-separador {
        display: none;
    }
}

@media (max-width: 1280px) {
    #topbar-principal {
        padding: 0 20px;
    }

    #topbar-hamburguesa {
        display: flex;
    }

    #topbar-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        padding: 15px 20px 25px;
        background: #1d051d;
        border-bottom: 0.5px solid #ffd1ec;

        flex-direction: column;
        align-items: stretch;
        gap: 20px;

        display: none;
    }

    #topbar.menu-abierto #topbar-menu {
        display: flex;
    }

    #topbar-principal {
        position: relative;
    }

    #topbar-links {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-link {
        justify-content: space-between;
        width: 100%;
        padding: 12px;
    }


    #topbar-acciones {
        flex-direction: column;
        align-items: stretch;
    }

    #topbar-online {
        justify-content: center;
    }

    #topbar-cta {
        text-align: center;
    }

    #anuncio-bar {
        padding: 9px 40px 9px 15px;
        font-size: 12px;
    }

    #anuncio-contenido {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px 8px;
    }

    .anuncio-detalle {
        display: none;
    }
}
