/**
 * Mawi YouTube Carousel - Frontend Styles
 */

/* Wrapper principale */
.mawi-youtube-carousel-wrapper {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

/* Swiper container */
.mawi-yt-swiper {
    width: 100%;
    padding: 20px 0;
}

/* Video item */
.mawi-yt-video-item {
    background: #ffffff;
    border: 2px dashed #104476;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    height: auto;
}

.mawi-yt-video-item:hover {
    transform: translateY(calc(-1 * var(--mawi-hover-lift, 5px)));
    box-shadow: 0 10px 30px rgba(16, 68, 118, 0.15);
}

/* Video link */
.mawi-yt-video-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Thumbnail container */
.mawi-yt-video-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 aspect ratio */
    overflow: hidden;
    background: #f6fbff;
}

.mawi-yt-video-thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mawi-yt-video-item:hover .mawi-yt-video-thumbnail img {
    transform: scale(var(--mawi-image-zoom, 1.05));
}

/* Overlay */
.mawi-yt-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(16, 68, 118, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mawi-yt-video-item:hover .mawi-yt-video-overlay {
    opacity: 1;
}

/* Play icon */
.mawi-yt-play-icon {
    width: 60px;
    height: 60px;
    background: rgba(224, 103, 95, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.mawi-yt-play-icon svg {
    width: 30px;
    height: 30px;
    margin-left: 4px;
}

.mawi-yt-video-item:hover .mawi-yt-play-icon {
    transform: scale(1.1);
}

/* Video info */
.mawi-yt-video-info {
    padding: 15px;
}

.mawi-yt-video-title {
    font-size: 14px;
    font-weight: 600;
    color: #104476;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation arrows */
.mawi-yt-swiper .swiper-button-prev,
.mawi-yt-swiper .swiper-button-next {
    color: #104476;
    background: rgba(255, 255, 255, 0.9);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #104476;
    transition: all 0.3s ease;
}

.mawi-yt-swiper .swiper-button-prev:hover,
.mawi-yt-swiper .swiper-button-next:hover {
    background: #104476;
    color: #ffffff;
}

.mawi-yt-swiper .swiper-button-prev::after,
.mawi-yt-swiper .swiper-button-next::after {
    font-size: 16px;
    font-weight: bold;
}

/* Pagination dots */
.mawi-yt-swiper .swiper-pagination {
    position: relative;
    margin-top: 20px;
}

.mawi-yt-swiper .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background: #104476;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.mawi-yt-swiper .swiper-pagination-bullet-active {
    opacity: 1;
    background: #e0675f;
    transform: scale(1.2);
}

/* Error message */
.mawi-yt-error {
    background: #fdf0ef;
    border: 2px dashed #e0675f;
    border-radius: 8px;
    padding: 20px;
    color: #c4504a;
    text-align: center;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .mawi-yt-swiper .swiper-button-prev,
    .mawi-yt-swiper .swiper-button-next {
        width: 32px;
        height: 32px;
    }
    
    .mawi-yt-swiper .swiper-button-prev::after,
    .mawi-yt-swiper .swiper-button-next::after {
        font-size: 14px;
    }
    
    .mawi-yt-play-icon {
        width: 50px;
        height: 50px;
    }
    
    .mawi-yt-play-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .mawi-yt-video-title {
        font-size: 13px;
    }
    

}

/* Schermi molto piccoli */
@media (max-width: 480px) {
    .mawi-yt-video-info {
        padding: 12px;
    }
    
    .mawi-yt-video-title {
        font-size: 12px;
    }
}

/* Loading state */
.mawi-yt-loading {
    text-align: center;
    padding: 40px;
    color: #104476;
}

.mawi-yt-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #104476;
    border-top-color: transparent;
    border-radius: 50%;
    animation: mawi-yt-spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes mawi-yt-spin {
    to {
        transform: rotate(360deg);
    }
}

/* v2: grid and shared accessible presentation. */
.mawi-youtube-carousel-wrapper [hidden] { display: none !important; }
.mawi-yt-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: var(--mawi-grid-gap,20px); align-items: stretch; }
.mawi-yt-grid .mawi-yt-video-item { min-width: 0; }
.mawi-youtube-carousel-wrapper .mawi-yt-video-item { box-sizing: border-box; }
.mawi-yt-video-link { height: 100%; }
.mawi-yt-video-title { overflow-wrap: anywhere; }
.mawi-yt-video-overlay { opacity: 1; background: transparent !important; pointer-events: none; }
.mawi-yt-video-overlay::before, .mawi-yt-video-overlay::after { content: ''; position: absolute; inset: 0; transition: opacity .3s; }
.mawi-yt-video-overlay::before { background: var(--mawi-overlay-normal, transparent); }
.mawi-yt-video-overlay::after { background: var(--mawi-overlay-hover, rgba(16,68,118,.8)); opacity: 0; }
.mawi-yt-video-link:is(:hover,:focus-visible) .mawi-yt-video-overlay::after { opacity: 1; }
.mawi-yt-video-thumbnail > .mawi-yt-play-icon { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); opacity:0; pointer-events:none; color:#fff; transition:opacity .3s,transform .3s,background-color .3s,color .3s; }
.mawi-yt-play-always .mawi-yt-play-icon, .mawi-yt-video-link:is(:hover,:focus-visible) .mawi-yt-play-icon { opacity:1; }
.mawi-yt-video-item:hover .mawi-yt-play-icon { transform:translate(-50%,-50%) scale(1.1); }
.mawi-yt-play-none .mawi-yt-play-icon { display:none; }
.mawi-yt-play-icon svg { width:var(--mawi-play-size,30px); height:var(--mawi-play-size,30px); margin:0; fill:currentColor; }
.mawi-yt-play-icon i { font-size:var(--mawi-play-size,30px); }
.mawi-yt-arrow { padding:0; cursor:pointer; }
.mawi-yt-more-wrap { display:flex; justify-content:center; margin-top:28px; }
.mawi-yt-load-more { display:inline-flex; align-items:center; justify-content:center; gap:10px; cursor:pointer; padding:14px 26px; border:1px solid #104476; border-radius:8px; background:#104476; color:#fff; font:inherit; font-weight:600; line-height:1.4; transition:background-color .25s,color .25s,border-color .25s,box-shadow .25s; }
.mawi-yt-load-more:hover { background:#e0675f; border-color:#e0675f; }
.mawi-yt-icon-before .mawi-yt-more-icon { order:-1; }
.mawi-yt-more-icon { display:inline-flex; font-size:1em; }
.mawi-yt-more-icon svg { width:1em; height:1em; fill:currentColor; }
.mawi-yt-video-link:focus-visible, .mawi-yt-load-more:focus-visible, .mawi-yt-arrow:focus-visible { outline:3px solid #e0675f; outline-offset:-3px; }
.mawi-yt-sr-only { position:absolute!important; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.mawi-yt-reveal { animation:mawi-yt-fade-down var(--mawi-fade-duration,500ms) ease both; }
@keyframes mawi-yt-fade-down { from { opacity:0; transform:translateY(calc(-1 * var(--mawi-fade-distance,24px))); } to { opacity:1; transform:translateY(0); } }
@media (hover:none) { .mawi-yt-play-hover .mawi-yt-play-icon { opacity:1; } }
@media (prefers-reduced-motion:reduce) { .mawi-youtube-carousel-wrapper *, .mawi-youtube-carousel-wrapper *::after { animation:none!important; transition:none!important; } .mawi-yt-video-item:hover { transform:none; } }
@media(max-width:1024px) { .mawi-yt-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:767px) { .mawi-yt-grid { grid-template-columns:1fr; } }
