/* Estilos para el módulo de Historias */
.historias-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap; 
}

.historia-item {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--color-acento);
    justify-content: center;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    padding: 5px;
    background-color: #fff;
    display: flex;
}

.historia-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.historia-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.historia-item span {
    position: absolute; 
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    
    color: var(--color-texto);
    background-color: rgba(255, 255, 255, 0.75);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    white-space: nowrap; 
    max-width: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

/* Overlay para el visor de historias */
.stories-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100; 
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.stories-overlay.visible {
    visibility: visible;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.stories-overlay video {
    max-width: 90%;
    max-height: 90%;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
    object-fit: contain;
    background-color: black;
}

.stories-cerrar {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    cursor: pointer;
    z-index: 1101;
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
}

.stories-navegacion {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
    padding: 0 15px;
    box-sizing: border-box;
    pointer-events: none;
}

/* Solo aseguramos que los botones puedan ser clickeados */
.stories-navegacion button {
    pointer-events: auto; 
}

/* Ajustes responsive para historias */
@media (max-width: 768px) {
    .historia-item {
        width: 100px;
        height: 100px;
        font-size: 0.8em;
    }
    .historia-item span {
        bottom: -20px;
    }
    
    /* CORRECCIÓN FINAL Y ESTRICTA EN MÓVILES */
    .stories-overlay {
        padding: 0;
        height: 100vh;
        width: 100vw;
    }
    
    .stories-overlay video {
        /* Tamaño máximo reducido para garantizar el espacio tocable */
        max-width: 80%; 
        max-height: 80vh; 
        width: auto; 
        height: auto;
        
        object-fit: contain; 
        
        /* MARGEN DE SEGURIDAD FORZADO: 10% en todos los lados */
        margin: 10vh 10vw !important; 
    }
    
    .stories-cerrar {
        top: 15px; 
        right: 15px; 
        font-size: 38px;
        background-color: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        width: 45px;
        height: 45px;
        display: flex;
        justify-content: center;
        align-items: center;
        line-height: 1;
        padding: 0;
    }
    .stories-navegacion {
        padding: 0 10vw;
    }
    .stories-navegacion button {
        padding: 10px 15px;
        font-size: 24px;
    }
}