/**
 * Video Article Manager - Frontend Stylesheet v5.0.0
 * - Player Responsive: Orizzontale 16:9 su Desktop/Tablet, Verticale 9:16 su Mobile
 * - Mini-player fluttuante:
 *     * Su DESKTOP: Orizzontale 16:9 (320px x 180px) in basso a destra con [X]
 *     * Su MOBILE: Rimpicciolito in VERTICALE 9:16 (130px x 231px) in basso a destra con [X]
 * - Carosello correlati automatico con pausa all'hover ("Consigliati per te in base ai tuoi interessi")
 * - Brand Palette: Amasens Crimson Red (#FF1744 / #E11D48) & Dark (#0A0A0C)
 */

:root {
    --vam-mobile-w: 375.188px;
    --vam-mobile-h: 667.013px;
    --vam-desktop-w: 780px;

    /* Mini-player Desktop (16:9 Orizzontale) */
    --vam-mini-desk-w: 320px;
    --vam-mini-desk-h: 180px;

    /* Mini-player Mobile (9:16 Verticale) */
    --vam-mini-mob-w: 130px;
    --vam-mini-mob-h: 231px;

    --vam-radius: 16px;
    --vam-mini-radius: 12px;

    /* BRAND IDENTITY PALETTE (Amasens Red & Dark) */
    --vam-brand-primary: #FF1744;
    --vam-brand-hover: #E11D48;
    --vam-brand-gradient: linear-gradient(135deg, #E11D48 0%, #FF2D55 100%);
    --vam-brand-subtle: rgba(255, 23, 68, 0.15);
    --vam-brand-border: rgba(255, 23, 68, 0.3);
    --vam-brand-text: #FF4D6D;
    --vam-brand-dark: #0A0A0C;
    --vam-brand-card: #141418;
    --vam-brand-card-border: #27272A;
}

/* ==========================================================================
   SLOT E CONTENITORE RESPONSIVE
   ========================================================================== */

.vam-video-slot {
    width: 100%;
    margin: 28px auto 36px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* Su MOBILE (< 768px): formato verticale mobile */
@media (max-width: 767px) {
    .vam-video-slot {
        min-height: 520px;
    }
    .vam-video-container {
        width: 100% !important;
        max-width: var(--vam-mobile-w) !important;
        height: var(--vam-mobile-h) !important;
        aspect-ratio: 375.188 / 667.013 !important;
    }
}

/* Su DESKTOP, LAPTOP e TABLET ORIZZONTALE (>= 768px): formato orizzontale 16:9 senza stretchare */
@media (min-width: 768px) {
    .vam-video-slot {
        min-height: 440px;
    }
    .vam-video-container {
        width: 100% !important;
        max-width: var(--vam-desktop-w) !important;
        height: auto !important;
        aspect-ratio: 16 / 9 !important;
    }

    .vam-video-container.vam-format-vertical {
        max-width: var(--vam-mobile-w) !important;
        height: var(--vam-mobile-h) !important;
        aspect-ratio: 375.188 / 667.013 !important;
    }
}

.vam-video-container {
    position: relative;
    background: #000000;
    border-radius: var(--vam-radius);
    overflow: hidden;
    box-shadow: 0 18px 45px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 23, 68, 0.12);
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), height 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.vam-media-element {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
    object-fit: contain !important;
    background: #000;
}

/* ==========================================================================
   MINI-PLAYER FLUTTUANTE (DESKTOP E MOBILE) CON PULSANTE [X]
   ========================================================================== */

.vam-float-close-btn,
.vam-float-badge {
    display: none;
}

/* Mini-Player su DESKTOP (>= 992px): Orizzontale 16:9 */
@media (min-width: 992px) {
    .vam-video-container.vam-is-floating {
        position: fixed !important;
        z-index: 999999 !important;
        bottom: 24px !important;
        right: 24px !important;
        left: auto !important;
        top: auto !important;
        width: var(--vam-mini-desk-w) !important;
        height: var(--vam-mini-desk-h) !important;
        aspect-ratio: 16 / 9 !important;
        max-width: none !important;
        border-radius: var(--vam-mini-radius) !important;
        box-shadow: 0 24px 50px rgba(0, 0, 0, 0.65), 0 0 0 2px var(--vam-brand-primary) !important;
        animation: vamFloatInDesk 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    .vam-video-container.vam-is-floating.vam-pos-bottom-left {
        right: auto !important;
        left: 24px !important;
    }

    /* Pulsante di chiusura "X" Desktop */
    .vam-video-container.vam-is-floating .vam-float-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 1000000;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: rgba(10, 10, 12, 0.9);
        color: #ffffff;
        border: 1.5px solid rgba(255, 255, 255, 0.35);
        cursor: pointer;
        padding: 0;
        transition: all 0.2s ease;
        backdrop-filter: blur(4px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    }

    .vam-video-container.vam-is-floating .vam-float-close-btn:hover {
        background: var(--vam-brand-primary);
        border-color: var(--vam-brand-primary);
        transform: scale(1.12);
    }

    /* Badge "In riproduzione" */
    .vam-video-container.vam-is-floating .vam-float-badge {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
        position: absolute;
        top: 8px;
        left: 8px;
        z-index: 1000000;
        padding: 4px 10px;
        background: rgba(10, 10, 12, 0.88);
        border: 1px solid var(--vam-brand-border);
        border-radius: 12px;
        color: #f8fafc;
        font-size: 11px;
        font-weight: 600;
        letter-spacing: 0.2px;
        pointer-events: none;
        backdrop-filter: blur(4px);
    }

    .vam-float-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--vam-brand-primary);
        box-shadow: 0 0 8px var(--vam-brand-primary);
        animation: vamPulse 1.8s infinite;
    }
}

/* Mini-Player su MOBILE (< 992px): Rimpicciolito in VERTICALE 9:16 */
@media (max-width: 991px) {
    .vam-video-container.vam-is-floating {
        position: fixed !important;
        z-index: 999999 !important;
        bottom: 16px !important;
        right: 14px !important;
        left: auto !important;
        top: auto !important;
        width: var(--vam-mini-mob-w) !important;
        max-width: var(--vam-mini-mob-w) !important;
        height: var(--vam-mini-mob-h) !important;
        aspect-ratio: 9 / 16 !important; /* RAPPORTO VERTICALE SU MOBILE */
        border-radius: 12px !important;
        box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 0 2px var(--vam-brand-primary) !important;
        animation: vamFloatInMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* Pulsante [X] Mobile: comodo e ben cliccabile */
    .vam-video-container.vam-is-floating .vam-float-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 6px;
        right: 6px;
        z-index: 1000000;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: rgba(10, 10, 12, 0.92);
        color: #ffffff;
        border: 1.5px solid var(--vam-brand-primary);
        cursor: pointer;
        padding: 0;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
    }

    .vam-video-container.vam-is-floating .vam-float-badge {
        display: none !important; /* Nascosto su mobile per non coprire il video */
    }
}

@keyframes vamFloatInDesk {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes vamFloatInMobile {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes vamPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ==========================================================================
   COPERTINA OVERLAY (OPZIONALE)
   ========================================================================== */

.vam-cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background: #000;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.vam-cover-overlay:not(.active) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.vam-cover-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.vam-big-play-btn {
    position: relative;
    z-index: 2;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--vam-brand-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 4px;
    box-shadow: 0 10px 25px rgba(255, 23, 68, 0.4), 0 0 0 6px rgba(255, 23, 68, 0.25);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.vam-big-play-btn:hover {
    transform: scale(1.1);
    background: var(--vam-brand-hover);
    box-shadow: 0 14px 30px rgba(255, 23, 68, 0.5), 0 0 0 8px rgba(255, 23, 68, 0.35);
}

/* ==========================================================================
   CAROSELLO ARTICOLI CORRELATI
   "Consigliati per te in base ai tuoi interessi" (Brand Identity Amasens)
   ========================================================================== */

.vam-related-section {
    margin: 48px auto 24px auto;
    max-width: 820px;
    padding: 24px;
    background: var(--vam-brand-dark);
    border: 1px solid var(--vam-brand-card-border);
    border-radius: 18px;
    box-sizing: border-box;
    color: #f9fafb;
    position: relative;
    box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.4);
}

.vam-related-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vam-related-title-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.vam-related-title {
    font-size: 18px;
    font-weight: 700;
    color: #f9fafb !important;
    margin: 0;
    letter-spacing: -0.2px;
}

.vam-cat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 20px;
    background: var(--vam-brand-subtle);
    color: var(--vam-brand-text);
    border: 1px solid var(--vam-brand-border);
    font-weight: 600;
}

.vam-carousel-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vam-carousel-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.vam-carousel-btn:hover {
    background: var(--vam-brand-primary);
    border-color: var(--vam-brand-primary);
    transform: scale(1.08);
    box-shadow: 0 0 12px rgba(255, 23, 68, 0.4);
}

.vam-carousel-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 4px 0;
}

.vam-carousel-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
}

.vam-carousel-track::-webkit-scrollbar {
    display: none;
}

.vam-related-card {
    flex: 0 0 260px;
    min-width: 260px;
    background: var(--vam-brand-card);
    border: 1px solid var(--vam-brand-card-border);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.vam-related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px -2px rgba(255, 23, 68, 0.2);
    border-color: var(--vam-brand-primary);
}

.vam-card-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    text-decoration: none !important;
    color: inherit;
    height: 100%;
    box-sizing: border-box;
}

.vam-card-thumb {
    position: relative;
    width: 68px;
    height: 68px;
    min-width: 68px;
    border-radius: 8px;
    overflow: hidden;
    background: #27272A;
}

.vam-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.vam-related-card:hover .vam-card-thumb img {
    transform: scale(1.08);
}

.vam-card-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--vam-brand-gradient);
    color: #ffffff;
}

.vam-video-indicator {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    background: var(--vam-brand-primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.vam-card-content {
    flex: 1;
    min-width: 0;
}

.vam-card-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    margin: 0 0 4px 0;
    color: #f3f4f6 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vam-card-meta {
    font-size: 11.5px;
    color: #a1a1aa;
}

.vam-error-msg {
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: 8px;
    font-size: 13px;
    text-align: center;
}
