/* =============================================================
   PDV – On Demand Single (griglia video + modal player)
   ============================================================= */

/* ── Griglia ──────────────────────────────────────────────── */
.pdv-ods-wrap { font-family: inherit; }

.pdv-ods-grid {
    display: grid;
    gap: 18px;
}
.pdv-ods-grid--2col { grid-template-columns: repeat(2, 1fr); }
.pdv-ods-grid--3col { grid-template-columns: repeat(3, 1fr); }
.pdv-ods-grid--4col { grid-template-columns: repeat(4, 1fr); }

/* ── Card video ───────────────────────────────────────────── */
.pdv-ods-card {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: box-shadow .2s, transform .2s;
    display: flex;
    flex-direction: column;
    outline: none;
}
.pdv-ods-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.09);
    transform: translateY(-3px);
}
.pdv-ods-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(21, 101, 192, .35);
}
.pdv-ods-card--hidden {
    display: none;
}

/* ── Thumbnail 16:9 ───────────────────────────────────────── */
.pdv-ods-thumb-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    overflow: hidden;
    background: #1a3a5c;
    flex-shrink: 0;
}

.pdv-ods-thumb {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease;
    /* Previene l'interpolazione pixelata */
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
.pdv-ods-card:hover .pdv-ods-thumb { transform: scale(1.04); }

.pdv-ods-thumb-placeholder {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #e8edf2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aab4c0;
    font-size: 2rem;
}

/* ── Overlay play ─────────────────────────────────────────── */
.pdv-ods-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    opacity: 0;
    transition: opacity .2s;
}
.pdv-ods-card:hover .pdv-ods-overlay { opacity: 1; }

.pdv-ods-play-icon {
    width: 54px;
    height: 54px;
    background: rgba(21, 101, 192, 0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: transform .15s;
    flex-shrink: 0;
}
.pdv-ods-card:hover .pdv-ods-play-icon { transform: scale(1.1); }

/* ── Durata ───────────────────────────────────────────────── */
.pdv-ods-duration {
    position: absolute;
    bottom: 7px;
    right: 8px;
    background: rgba(0, 0, 0, 0.68);
    color: #fff;
    font-size: 0.72em;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    letter-spacing: 0.02em;
}

/* ── Corpo card ───────────────────────────────────────────── */
.pdv-ods-card-body {
    padding: 12px 16px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pdv-ods-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a3a5c;
    line-height: 1.4;
}

/* ── Descrizione ──────────────────────────────────────────── */
.pdv-ods-card-desc {
    margin: 0;
    font-size: 0.82em;
    color: #5a7a9a;
    line-height: 1.6;
    white-space: pre-line; /* rispetta i ritorni a capo */
}
.pdv-ods-card-desc--collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
}

/* ── Link "Leggi di più" ──────────────────────────────────── */
.pdv-ods-readmore {
    display: inline;
    font-size: 0.8em;
    font-weight: 600;
    color: #1565C0;
    text-decoration: none;
    cursor: pointer;
    transition: color .2s;
    align-self: flex-start;
}
.pdv-ods-readmore:hover { color: #0d47a1; text-decoration: underline; }

/* ── Pulsante "Carica altri" ──────────────────────────────── */
.pdv-ods-loadmore-wrap {
    display: flex;
    justify-content: center;
    margin-top: 28px;
}

.pdv-ods-loadmore {
    display: inline-block;
    background-color: #1565C0;
    color: #fff;
    border: none;
    border-radius: 25px;
    padding: 12px 36px;
    font-size: 0.92em;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color .2s, transform .1s;
}
.pdv-ods-loadmore:hover { background-color: #0d47a1; transform: translateY(-1px); }
.pdv-ods-loadmore:active { transform: translateY(0); }
.pdv-ods-loadmore[hidden] { display: none; }

/* ── Modal ────────────────────────────────────────────────── */
.pdv-ods-modal[hidden] { display: none; }

.pdv-ods-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: pdv-ods-fadein .18s ease;
}

@keyframes pdv-ods-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pdv-ods-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    cursor: pointer;
}

.pdv-ods-modal-box {
    position: relative;
    width: 100%;
    max-width: 920px;
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    z-index: 1;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    animation: pdv-ods-slidein .2s ease;
}

@keyframes pdv-ods-slidein {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Pulsante chiudi modal ────────────────────────────────── */
.pdv-ods-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.60);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .2s, transform .15s;
    flex-shrink: 0;
    line-height: 1;
}
.pdv-ods-modal-close svg {
    display: block;
    flex-shrink: 0;
}
.pdv-ods-modal-close:hover {
    background: rgba(0, 0, 0, 0.90);
    transform: scale(1.08);
}

.pdv-ods-player-wrap {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
}

.pdv-ods-iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

/* ── Messaggi ─────────────────────────────────────────────── */
.pdv-ods-error {
    padding: 16px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    font-size: .9em;
    color: #555;
}
.pdv-ods-empty {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: 40px 0;
}

/* ── Responsive ───────────────────────────────────────────── */
@media ( max-width: 960px ) {
    .pdv-ods-grid--4col { grid-template-columns: repeat(3, 1fr); }
}
@media ( max-width: 700px ) {
    .pdv-ods-grid--3col,
    .pdv-ods-grid--4col { grid-template-columns: repeat(2, 1fr); }
}
@media ( max-width: 480px ) {
    .pdv-ods-grid--2col,
    .pdv-ods-grid--3col,
    .pdv-ods-grid--4col { grid-template-columns: 1fr; }

    .pdv-ods-modal { padding: 0; }
    .pdv-ods-modal-box { border-radius: 0; }
}
