/* =========================================================
 * MemoTV - Cards
 * ========================================================= */


/* =========================================================
 * VERTICAL CARD
 * ========================================================= */

.memotv-view {
    display: none;
}

.memotv-view.active {
    display: block;
}


/* Griglia */

.memotv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));

    column-gap: 18px;
    row-gap: 30px;
}


/* Card */

.memotv-card {
    position: relative;
    min-width: 0;
}


/* Poster */

.memotv-poster {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 14px;
    background: #111;
}

.memotv-poster img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================
 * BADGE PRIMA VISIONE TV — CARD VERTICALI
 * ========================================================= */

.memotv-poster img.memotv-badge-prime-tv {
    position: absolute;
    top: 0;
    left: 0;

    width: 30%;
    height: auto;

    object-fit: contain;

    z-index: 4;

    pointer-events: none;
}


/* =========================================================
 * Overlay
 * ========================================================= */

.memotv-overlay {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;
    justify-content: flex-end;

    padding: 10px;

    background:
        linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.45),
            transparent 35%,
            transparent 55%,
            rgba(0, 0, 0, 0.85)
        );

    opacity: 1;

    z-index: 2;
}



/* =========================================================
 * Fascia inferiore overlay
 * ========================================================= */

.memotv-card-bottom {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;

    width: 100%;
    gap: 12px;
}


/* =========================================================
 * Colonna sinistra
 * ========================================================= */

.memotv-card-rating-category {
    min-width: 0;

    display: flex;
    flex-direction: column;

    justify-content: center;
    align-items: flex-start;

    flex: 1 1 auto;

    min-height: 36px;
}


/* =========================================================
 * Rating
 * ========================================================= */

.memotv-rating {
    display: flex;
    align-items: center;
    gap: 3px;

    line-height: 1;

    color: #fff;
}

.memotv-rating .dashicons {
    width: 16px;
    height: 16px;

    font-size: 16px;
    line-height: 16px;

    color: #fff;
}


/* =========================================================
 * Valore rating
 * ========================================================= */

.memotv-rating-value {
    margin-left: 4px;

    font-size: 12px;
    font-weight: 600;
    line-height: 1;

    white-space: nowrap;

    color: #fff;
}


/* =========================================================
 * Categoria secondaria
 * ========================================================= */

.memotv-category-secondary {
    max-width: 100%;

    overflow: hidden;
    
    margin-top: 4px;
    
    color: #fff;
    font-size: 13px;
    line-height: 1.25;

    white-space: nowrap;
    text-overflow: ellipsis;

    opacity: 0.85;
}


/* =========================================================
 * Azioni
 * ========================================================= */

.memotv-actions {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;

    gap: 8px;

    margin: 0;

    flex: 0 0 auto;
}

.memotv-btn {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 30px;
    height: 30px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: var(--theme-palette-color-1);
    color: var(--theme-palette-color-2);

    cursor: pointer;

    transition:
        transform 0.18s ease,
        opacity 0.18s ease,
        background-color 0.18s ease,
        color 0.18s ease;
}

.memotv-btn:hover {
    background: var(--theme-palette-color-6);
    color: var(--theme-palette-color-8);
}

.memotv-btn .dashicons {
    width: 25px;
    height: 25px;

    font-size: 25px;
}


/* =========================================================
 * Titolo
 * ========================================================= */

.memotv-card-title {
    margin-top: 10px;

    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;

    color: var(--theme-palette-color-4);
}

.memotv-rating-label {
    font-size: 0.8em;
    opacity: 0.72;
}

.memotv-card-meta {
    margin-top: 5px;

    font-size: 15px;
    line-height: 1.35;

    color: var(--theme-palette-color-3);
    opacity: 0.72;
}

.memotv-card-separator {
    margin: 0 4px;
}


/* =========================================================
 * PROGRESS BAR
 * ========================================================= */

.memotv-card-progress {
    position: absolute;

    right: 0;
    bottom: 0;
    left: 0;

    width: 100%;
    height: 3px;

    overflow: hidden;

    border-radius: 999px;
    
    background: transparent;
    
    z-index: 3;

    /*
     * Di default la barra è invisibile.
     * Lo spazio/elemento esiste sempre.
     */
    background: transparent;
}

.memotv-card-progress.is-active {
    /*
     * Tempo rimanente
     */
    background: transparent;
}

.memotv-card-progress::after {
    content: "";

    position: absolute;
    inset: 0 auto 0 0;

    width: var(--memotv-progress, 0%);

    border-radius: inherit;

    /*
     * Tempo trascorso
     */
    background: #FF0000;
    
}

/* =========================================================
 * PROGRESS BAR PROGRAMMA CONCLUSO
 * ========================================================= */

.memotv-concluded-card .memotv-card-progress::after {
    width: 100%;

    background: #6a0f96;

    animation: none;
    transition: none;
}


/* =========================================================
 * HORIZONTAL CARD
 * ========================================================= */

.memotv-canali {
    display: flex;
    flex-direction: column;
    width: 100%;
}


/*
 * Struttura:
 *
 * poster | orario | informazioni | rating | azioni
 */
.memotv-h-card {
    position: relative;

    display: grid;

    grid-template-columns:
        90px
        80px
        minmax(0, 1fr)
        52px
        44px;

    align-items: center;

    min-height: 104px;

    padding: 7px 10px;

    gap: 12px;

    overflow: hidden;

    border-radius: 10px;
}


/* Alternanza righe */

.memotv-h-card:nth-child(odd) {
    background: rgba(127, 127, 127, 0.06);
}

.memotv-h-card:nth-child(even) {
    background: transparent;
}


/* Poster */

.memotv-h-poster {
    width: 90px;
    aspect-ratio: 2 / 3;

    overflow: hidden;
    border-radius: 8px;

    background: #111;
}

.memotv-h-poster img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* Orario */

.memotv-h-time {
    min-width: 0;

    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.memotv-h-time-main {
    display: block;
}


/* Informazioni */

.memotv-h-info {
    min-width: 0;
}

.memotv-h-title {
    overflow: hidden;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;

    text-overflow: ellipsis;
}

.memotv-h-channel {
    margin-top: 4px;

    font-size: 13px;
    line-height: 1.3;

    opacity: 0.78;
}

.memotv-h-channel-number {
    margin-left: 4px;
    opacity: 0.6;
}

.memotv-h-category-secondary {
    margin-top: 3px;

    font-size: 12px;
    line-height: 1.3;

    opacity: 0.6;
}


/* Rating */

.memotv-h-rating {
    display: flex;
    justify-content: center;
}

.memotv-h-rating .memotv-rating-stars {
    flex-wrap: nowrap;
}


/* Azioni */

.memotv-h-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.memotv-h-actions .memotv-btn {
    width: 32px;
    height: 32px;
}

.memotv-h-actions .dashicons {
    font-size: 16px;
}


/* Progress */

.memotv-h-card-progress {
    position: absolute;

    right: 0;
    bottom: 0;
    left: 0;

    height: 3px;

    overflow: hidden;

    background: rgba(127, 127, 127, 0.15);
}

.memotv-h-card-progress::after {
    content: "";

    position: absolute;

    top: 0;
    bottom: 0;
    left: 0;

    width: var(--memotv-progress, 0%);

    background: currentColor;
}


/* =========================================================
 * RESPONSIVE - TABLET
 * ========================================================= */

@media (min-width: 600px) {

    .memotv-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

}


/* =========================================================
 * RESPONSIVE - DESKTOP
 * ========================================================= */

@media (min-width: 900px) {

    .memotv-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

}


@media (min-width: 1200px) {

    .memotv-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

}


/* =========================================================
 * RESPONSIVE - TABLET COMPATTO
 * ========================================================= */

@media (min-width: 600px) and (max-width: 1099px) {

    .memotv-card-bottom {
        gap: 6px;
    }

    .memotv-rating {
        gap: 1px;
    }

    .memotv-rating .dashicons,
    .memotv-rating .dashicons-star-half {
        width: 15px;
        height: 15px;
        font-size: 15px;
    }

    .memotv-actions {
        gap: 5px;
    }

    .memotv-btn {
        width: 32px;
        height: 32px;
    }

    .memotv-btn .dashicons {
        width: 16px;
        height: 16px;
        font-size: 16px;
    }
}


/* =========================================================
 * RESPONSIVE - MOBILE
 * ========================================================= */

@media (max-width: 599px) {

    .memotv-grid {
        column-gap: 8px; /* tra le card */
        row-gap: 30px;    /* tra le righe */
    }

    .memotv-overlay {
        opacity: 1;
        padding: 6px 4px;
    }

    .memotv-card-bottom {
        gap: 3px;
    }

    .memotv-rating {
        gap: 1px;
    }

    .memotv-rating .dashicons,
    .memotv-rating .dashicons-star-half {
        width: 14px;
        height: 14px;
        font-size: 14px;
    }

    .memotv-actions {
        gap: 8px;
    }

    .memotv-btn {
        width: 25px;
        height: 25px;
    }

    .memotv-btn .dashicons {
        width: 18px;
        height: 18px;
        font-size: 18px;
    }


    /*
     * Versione mobile card orizzontale
     */

    .memotv-h-card {
        grid-template-columns:
            70px
            minmax(0, 1fr)
            44px;

        min-height: 84px;
        padding: 6px 7px;
        gap: 10px;
    }

    .memotv-h-poster {
        width: 70px;
    }

    .memotv-h-time {
        display: none;
    }

    .memotv-h-info::before {
        content: "";
    }

    .memotv-h-title {
        font-size: 14px;
    }

    .memotv-h-channel {
        font-size: 12px;
    }

    .memotv-h-category-secondary {
        font-size: 11px;
    }

    .memotv-h-rating {
        display: none;
    }

    .memotv-h-actions {
        gap: 4px;
    }

    .memotv-h-actions .memotv-btn {
        width: 30px;
        height: 30px;
    }

}