/* --------------------------------------------------------------------------
   VIDEOTECA YOUTUBE STYLE - REORGANIZED (ORIGINAL LOGIC)
   -------------------------------------------------------------------------- */

/* Questa classe riduce il padding sx dx del sito web solo nel mobile 
 * e da usarsi solo nella videoteca dove lo spazio laterale è eccessivo */

@media (max-width: 768px) {
    html:not(.avada-has-site-width-percent) #main {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }
}


/* 1. LAYOUT CONTENITORI 
   ========================================================================== */
.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: center;
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
    font-size: 14px;
    position: relative; 
    overflow: hidden; 
}

.article-bottom {
    margin-bottom: 8px;
}

/* 2. CARD RELATORE (SPEAKER CARD) 
   ========================================================================== */
.speaker-card {
    margin-top: 15px;
    padding: 15px;
}

.video-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
}

.speaker-info {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
    flex-wrap: nowrap;
}

.speaker-avatar {
    width: 60px;
    height: 60px;
    min-width: 60px;
    min-height: 60px;
    border-radius: 50%;
    margin-right: 15px;
    transition: opacity 0.3s ease;
    object-fit: cover;
    overflow: hidden;
    flex-shrink: 0;
    display: block;
}

.speaker-avatar:hover {
    opacity: 0.7;
}

.speaker-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.speaker-name {
    font-size: 16px;
    font-weight: bold;
    margin: 0;
    display: flex;
    align-items: center;
}

.person-icon {
    width: 16px;
    height: 16px;
    margin-right: 5px;
    fill: #666;
}

.speaker-job {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.video-description {
    font-size: 14px;
    color: #555;
    background: #f1f1f1;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
    line-height: 1.5;
}

/* 3. CARD ANTEPRIMA VIDEO (LISTA PLAYLIST)
   ========================================================================== */
.video-preview-card {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.3s ease-in-out;
}

/* Quando la card è selezionata */
.video-preview-card.selected {
    background: #f8f8f8;
}

/* Indicatore di selezione - Barra verticale a sinistra */
.video-preview-card.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #A80058;
    border-radius: 2px;
}

/* Miniatura */
.video-thumbnail {
    position: relative;
    width: 140px;
    height: 80px;
    flex-shrink: 0;
}

.video-thumbnail img {
    margin-left: 4px;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
    transition: opacity 0.3s ease, transform 0.3s ease-in-out;
}

.video-thumbnail:hover {
    transform: scale(1.05);
}

.video-thumbnail img:hover {
    opacity: 0.85;
}

.video-duration {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 5px;
}

/* Informazioni video nella lista */
.video-info {
    padding: 5px;
    flex-grow: 1;
    min-height: 80px;
}

.video-info .video-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #222;
    transition: color 0.3s ease-in-out;
}

.video-info .video-title:hover {
    color: #A80058;
}

.video-titolo-capitoli {
    color: #A80058 !important;
}

.video-info .speaker-link {
    text-decoration: none;
    color: black;
    font-size: 14px;
    font-weight: normal;
    transition: text-decoration 0.3s ease-in-out;
}

.video-info .speaker-link:hover {
    text-decoration: underline;
    color: black;
}

.video-count {
    font-size: 12px;
    color: #777;
    margin-top: 2px;
}

/* 4. ELEMENTI UI (LOADING, LOGO E MENU)
   ========================================================================== */

/* Caricamento */
#loading {
    text-align: center;
    padding: 30px;
    font-size: 18px;
    color: #666;
}

.loader {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #A80058;
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Logo */
.logo-container {
    display: inline-block;
    transition: transform 0.3s ease-in-out;
}

.videoteca-logo {
    background: white;
    padding: 2px;
    border-radius: 8px;
    height: 80px;
    transition: transform 0.3s ease-in-out;
}

.logo-container:hover .videoteca-logo {
    transform: scale(1.1);
}

/* Menu */
.awb-menu_row .menu-text {
    transition: border-bottom 0.3s ease-in-out;
}

.awb-menu_row .menu-text:hover {
    border-bottom: 2px solid white;
    padding-bottom: 2px;
}

/* 5. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 768px) {
    .speaker-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .speaker-avatar {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .speaker-card {
        padding: 10px;
    }
    
    .speaker-details {
        width: 100%;
    }
}