/* ==========================================================
   MOTUS ANIMI FAD — Ultimate Learning Pro Override
   Plugin: Ultimate Learning Pro (ULP)
   Target: Course listing grid ([ulp-list-courses])
   ========================================================== */

/* ── GRID WRAPPER ── */
.ulp-list-courses-wrapp {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
}

/* ── SINGOLA CARD ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp {
    flex: none;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover {
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.14);
    transform: translateY(-4px);
}

/* ── IMMAGINE ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp {
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    position: relative;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp a.ulp-feat-img-single-course {
    display: block;
    width: 100%;
    height: 340px;
    min-width: 0px !important;
    background-size: inherit;
    background-position: center center;
    background-repeat: no-repeat;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp img {
    width: 100%;
    height: 340px;
    object-fit: cover;
    object-position: center;
    display: block;
    image-rendering: -webkit-optimize-contrast;
}

/* Zoom hover sull'immagine */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp:hover img,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp:hover a {
    transform: scale(1.06);
    transition: transform 0.4s ease;
}

/* ── BADGE ECM CREDITI (sopra l'immagine) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp .ulp-course-credit {
    position: absolute;
    top: 12px;
    left: 12px;
    background: #1d9b93;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 8px 18px;
    border-radius: 22px;
    line-height: 1.3;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(29, 155, 147, 0.35);
    margin: 0;
}

/* ── PREZZO (spostato in basso nel contenuto) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp .ulp-course-price {
    position: static;
    display: inline-block;
    background: none;
    color: #1d9b93;
    font-size: 16px;
    font-weight: 700;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
    letter-spacing: 0;
    text-transform: none;
    line-height: 1.4;
}

/* ── CONTENUTO CARD ── riorganizzato */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-wrapp-content {
    padding: 16px 20px 20px;
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Prezzo dentro il contenuto — pillola con bordo */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-wrapp-content .ulp-course-price {
    display: inline-block;
    background-color: rgba(29, 155, 147, 0.08);
    color: #1d9b93;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 8px;
    border: 1px solid rgba(29, 155, 147, 0.25);
    margin-top: 12px;
    align-self: flex-start;
    line-height: 1.4;
}

/* ── BADGE SALE ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp .ulp-sale {
    border-top-color: #c1146e;
}

/* Hover shadow — disabilito quella originale */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .ulp-list-courses-item-wrapp-content {
    box-shadow: none;
}

/* ── TITOLO CORSO ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-title {
    padding: 0;
    margin-bottom: 8px;
    line-height: 1.4;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-title a {
    font-size: 15px;
    font-weight: 600;
    color: #222222;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-title a:hover {
    color: #1d9b93;
}

/* ── SECONDA RIGA (data / moduli) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-wrapp-second-content {
    padding: 0;
    margin-bottom: 10px;
    font-size: 13px;
    color: #888888;
    line-height: 1.4;
}

/* ── EXCERPT ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-wrapp-excerpt {
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #666666;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── TERZA RIGA (teacher / students / category) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-wrapp-third-content {
    display: none; /* nascosta per layout compatto come nello screenshot */
}

/* ── CONTENUTO NASCOSTO (id, totals) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-wrapp-hidden-content {
    display: none;
}

/* ── PROGRESS / ENROLL ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-progress-wrapp {
    border-top: 1px solid #f0f0f0;
    padding: 12px 0 0;
    margin: 0;
    font-size: 13px;
    color: #888888;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-progress-bar {
    background-color: #e8e8e8;
    border-radius: 8px;
    height: 8px;
}

.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-progress-completed {
    background-color: #1d9b93;
    border-radius: 8px;
    height: 8px;
}

/* ── PULSANTE ISCRIVITI (enroll) ── */
.ulp-enroll-course-the-button,
.ulp-enroll-course-the-button-fake {
    background-color: #1d9b93;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
    text-transform: none;
    letter-spacing: 0.2px;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    line-height: 1.4;
}

.ulp-enroll-course-the-button:hover,
.ulp-enroll-course-the-button-fake:hover {
    background-color: #178a83;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(29, 155, 147, 0.3);
}

/* ── PULSANTE ISCRIVITI ORA (bordo inferiore card) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn {
    display: block;
    text-align: center;
    background-color: rgba(29, 155, 147, 0.07);
    color: #1d9b93;
    font-size: 14px;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: 0 0 12px 12px;
    text-decoration: none;
    margin: 14px -20px -20px -20px;
    border-top: 1px solid rgba(29, 155, 147, 0.12);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    transition: background-color 0.3s ease;
}

/* Testo dentro uno span per controllarlo separatamente */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn .mafad-btn-text {
    display: inline-block;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Icona penna — visibile di default, punta in basso */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn::before {
    content: '✎';
    position: absolute;
    top: 50%;
    left: 20px;
    font-size: 18px;
    opacity: 0.5;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* Linea firma */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 15%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #1d9b93 10%, #1d9b93 90%, transparent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── HOVER (pulsante O card) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn:hover,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-enroll-btn {
    background-color: rgba(29, 155, 147, 0.10);
}

/* Testo sparisce */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn:hover .mafad-btn-text,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-enroll-btn .mafad-btn-text {
    opacity: 0;
    transform: translateY(4px);
}

/* Penna appare e firma */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn:hover::before,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-enroll-btn::before {
    opacity: 1;
    animation: penSignAcross 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Linea firma si disegna */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn:hover::after,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-enroll-btn::after {
    animation: lineSign 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Testo riappare dopo la firma */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-enroll-btn:hover .mafad-btn-text,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-enroll-btn .mafad-btn-text {
    animation: textReappear 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* ── ANIMAZIONI ── */

/* Penna: entra da sinistra, attraversa, esce a destra */
@keyframes penSignAcross {
    0% {
        left: 10%;
        opacity: 1;
        transform: translateY(-50%);
    }
    8% {
        opacity: 1;
        transform: translateY(-50%) scaleX(-1);
    }
    15% {
        left: 15%;
        transform: translateY(-40%) scaleX(-1) rotate(25deg);
    }
    75% {
        left: 80%;
        opacity: 1;
        transform: translateY(-40%) scaleX(-1) rotate(25deg);
    }
    85% {
        opacity: 0.5;
        transform: translateY(-45%) scaleX(-1) rotate(15deg);
    }
    92% {
        transform: translateY(-50%) scaleX(-1);
    }
    100% {
        left: 90%;
        opacity: 0;
        transform: translateY(-50%);
    }
}

/* Linea: si disegna seguendo la penna */
@keyframes lineSign {
    0% {
        width: 0;
    }
    15% {
        width: 0;
    }
    75% {
        width: 70%;
    }
    85% {
        width: 70%;
        opacity: 1;
    }
    100% {
        width: 70%;
        opacity: 0;
    }
}

/* Testo: sparisce, poi riappare dopo la firma */
@keyframes textReappear {
    0% {
        opacity: 1;
        transform: translateY(0);
    }
    10% {
        opacity: 0;
        transform: translateY(4px);
    }
    80% {
        opacity: 0;
        transform: translateY(-4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================
   STATO ISCRITTO — Pulsante "Vai al corso" con play
   ========================================================== */

/* ── PULSANTE VAI AL CORSO (bordo inferiore card) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn {
    display: block;
    text-align: center;
    background-color: rgba(29, 155, 147, 0.07);
    color: #1d9b93;
    font-size: 14px;
    font-weight: 600;
    padding: 14px 20px;
    border-radius: 0 0 12px 12px;
    text-decoration: none;
    margin: 14px -20px -20px -20px;
    border-top: 1px solid rgba(29, 155, 147, 0.12);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    transition: background-color 0.3s ease;
}

/* Testo */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn .mafad-btn-text {
    display: inline-block;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Icona play — visibile di default */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn::before {
    content: '▶';
    position: absolute;
    top: 50%;
    left: 20px;
    font-size: 14px;
    opacity: 0.5;
    transform: translateY(-50%);
    transition: opacity 0.2s ease;
    pointer-events: none;
}

/* Linea scorrimento */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 15%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #1d9b93 10%, #1d9b93 90%, transparent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ── HOVER (pulsante O card) ── */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn:hover,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-goto-btn {
    background-color: rgba(29, 155, 147, 0.10);
}

/* Testo sparisce */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn:hover .mafad-btn-text,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-goto-btn .mafad-btn-text {
    animation: textReappear 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Play scorre */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn:hover::before,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-goto-btn::before {
    opacity: 1;
    animation: playSlide 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Linea si disegna */
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .mafad-goto-btn:hover::after,
.ulp-list-courses-wrapp .ulp-list-courses-item-wrapp:hover .mafad-goto-btn::after {
    animation: lineSign 1.2s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
}

/* Play: scorre da sinistra a destra con pulse */
@keyframes playSlide {
    0% {
        left: 10%;
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    10% {
        transform: translateY(-50%) scale(1.3);
        opacity: 1;
    }
    20% {
        left: 15%;
        transform: translateY(-50%) scale(1);
    }
    75% {
        left: 80%;
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
    85% {
        transform: translateY(-50%) scale(1.3);
        opacity: 0.5;
    }
    100% {
        left: 90%;
        opacity: 0;
        transform: translateY(-50%) scale(1);
    }
}

/* ── PAGINAZIONE ── */
.ulp-list-courses-wrapp .ulp-pagination {
    grid-column: 1 / -1;       /* occupa tutta la riga */
    text-align: center;
    padding: 20px 0 0;
    margin: 0;
    height: auto;
}

.ulp-pagination .ulp-pagination-item,
.ulp-pagination .ulp-pagination-item-selected,
.ulp-pagination .ulp-pagination-item-break {
    border-radius: 8px;
    min-width: 38px;
    height: 38px;
    line-height: 38px;
    padding: 0 12px;
    font-size: 14px;
    margin: 0 3px;
    border: 1px solid #e0e0e0;
    background: #ffffff;
    color: #555555;
    transition: all 0.2s ease;
}

.ulp-pagination .ulp-pagination-item-selected,
.ulp-pagination .ulp-pagination-item:hover {
    background-color: #1d9b93;
    border-color: #1d9b93;
    color: #ffffff;
}

.ulp-grid-list-pagination .ulp-grid-list-pagination-item-selected {
    background-color: #1d9b93;
    border-color: #1d9b93;
    color: #ffffff;
}

/* ── TAGS ── */
.ulp-list-tags-wrapp .ulp-course-tag {
    background: #1d9b93;
    font-size: 9px;
    border-radius: 4px;
}

.ulp-list-tags-wrapp .ulp-course-tag:after {
    background: #1d9b93;
}

/* ── SEPARATORE HR ── */
.ulp-list-courses-wrapp ~ hr,
hr + .ulp-list-courses-wrapp {
    border-color: #f0f0f0;
}


/* ==========================================================
   RESPONSIVE
   ========================================================== */

/* Tablet grande */
@media (max-width: 1100px) {
    .ulp-list-courses-wrapp {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

/* Tablet */
@media (min-width: 480px) and (max-width: 768px) {
    .ulp-list-courses-wrapp {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp a.ulp-feat-img-single-course {
        min-width: 0 !important;
        height: 260px !important;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp img {
        height: 260px;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-list-courses-item-title a {
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 479px) {
    .ulp-list-courses-wrapp {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp {
        border-radius: 10px;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp {
        border-radius: 10px 10px 0 0;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp a.ulp-feat-img-single-course {
        min-width: 0 !important;
        height: 300px !important;
    }

    .ulp-list-courses-wrapp .ulp-list-courses-item-wrapp .ulp-feat-img-wrapp img {
        height: 300px;
    }
}


/* ==========================================================
   SINGLE COURSE PAGE — adattamenti colori
   ========================================================== */

/* Sidebar price box */
.ulp-course-wrapp .ulp-main-section .ulp-right-sidebar .price-box {
    background: #1d9b93;
}

/* Curriculum titoli */
.ulp-public-the-modules-wrapper .ulp-h3-title {
    color: #1d9b93;
}

/* Link nel curriculum */
.ulp-public-the-module-content-element a:hover {
    color: #1d9b93;
}

.ulp-module-details {
    color: #1d9b93;
}

/* Progress bar corso singolo */
.ulp-course-enrolled .ulp-course-progress-wrapp h2 {
    color: #1d9b93;
}

.ulp-course-enrolled .ulp-course-progress-wrapp .ulp-progress-completed {
    background-color: #1d9b93;
}

/* Review section */
.ulp-write-course-review-wrapp h2 {
    color: #1d9b93;
}

.ulp-add-new-review-bttn {
    background-color: #1d9b93;
    border-color: #1d9b93;
}

/* Checkout */
.ulp-checkout-main-title {
    color: #1d9b93;
    border-bottom-color: #1d9b93;
}

/* General button override */
.ulp-general-bttn {
    background-color: #1d9b93;
}

/* Lesson/Quiz status badges */
.ulp-lesson-status-completed,
.ulp-quiz-status-passed,
.ulp-lesson-preview {
    background-color: #1d9b93;
}

/* Special column links */
.ulp-special-column,
.ulp-special-column a {
    color: #1d9b93;
}

/* Note course link */
.ulp-course-note-course {
    color: #1d9b93;
}

/* Certificate bottom */
.ulp-certificate-item .ulp-certificate-item-bottom {
    background-color: #1d9b93;
}

.ulp-certificate-item .ulp-certificate-item-content span {
    color: #1d9b93;
}

/* Additional message bar */
.ulp-additional-message {
    border-left-color: #1d9b93;
}

/* Quiz/Lesson button accents */
.ulp-quiz-next-button,
.ulp-quiz-prev-button,
.ulp-hint-button,
.ulp-quiz-submit-via-ajax,
.ulp-quiz-submit-the-button,
.ulp-quiz-retake-the-button,
.ulp-lesson-complete-the-button,
.ulp-become-instructor-the-button,
.ulp-quiz-start-the-button {
    background-color: #1d9b93;
}

/* Pagination accents */
.ulp-pagination .ulp-pagination-item-selected,
.ulp-pagination .ulp-pagination-item:hover {
    background-color: #1d9b93;
    border-color: #1d9b93;
}