/* ===== MEDIA WRAPPER ===== */
.media-wrapper {
    width: 320px;
    height: 350px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===== VIDEO & IMAGES ===== */
video, img {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Specific for quizzquestion page */
#quizContainer video,
#quizContainer img {
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== BUTTONS ===== */
.buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    gap: 12px;
}

button {
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: var(--shadow);
    max-width: 380px;
    width: 300px;
    margin: auto;
}

button:hover {
    transform: translateY(-2px);
}

button.secondary {
    background: #e8ecf5;
    color: #333;
}

button.secondary:hover {
    background: #d9e0ee;
}

button.hidden {
    display: none !important;
}

button.pulse {
    animation: pulse 2s infinite;
}

/* ===== PULSE ANIMATION ===== */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(108, 100, 223, 0.7);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(245, 87, 108, 0);
    }
}

/* ===== LOADING RING ===== */
.ring {
    background: #262626;
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 220px;
    border: 3px solid #3c3c3c;
    border-radius: 50%;
    text-align: center;
    line-height: 150px;
    font-family: sans-serif;
    font-size: 20px;
    color: #fff000;
    letter-spacing: 4px;
    text-shadow: 0 0 10px #fff000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.ring:before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-top: 3px solid #fff000;
    border-right: 3px solid #fff000;
    border-radius: 50%;
    animation: animateC 2s linear infinite;
}

.waitring {
    display: block;
    position: absolute;
    top: calc(50% - 2px);
    left: 50%;
    width: 50%;
    height: 4px;
    background: transparent;
    transform-origin: left;
    animation: animate 2s linear infinite;
}

.waitring:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff000;
    top: -6px;
    right: -8px;
    box-shadow: 0 0 20px #fff000;
}

@keyframes animateC {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes animate {
    0% {
        transform: rotate(45deg);
    }
    100% {
        transform: rotate(405deg);
    }
}

/* ===== QUIZ CONTAINER ===== */
#quizContainer {
    width: 100%;
    max-width: 380px;
    padding: 25px;
    border-radius: var(--radius);
    margin-top: 20px;
}

.question {
    font-size: 20px;
    margin-bottom: 20px;
    font-weight: 600;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choices button:hover {
    background: #d9e0ee;
    transform: translateY(-2px);
}

.choices button.correct {
    background: #4CAF50 !important;
    color: white;
}

.choices button.wrong {
    background: #E53935 !important;
    color: white;
}

.feedback {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 700;
    min-height: 24px;
    text-align: center;
}

/* ===== NEXT BUTTON ===== */
#nextBtn {
    margin-top: 25px;
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    display: none;
    box-shadow: var(--shadow);
    transition: 0.2s;
}

#nextBtn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

/* ===== HOME BUTTON ===== */
#homeBtn {
    margin-top: 30px;
    margin-bottom: 10px;
    padding: 14px 20px;
    width: 100%;
    max-width: 380px;
    text-align: center;
    background: #e8ecf5;
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: 0.2s;
}

#homeBtn:hover {
    background: #d9e0ee;
    transform: translateY(-2px);
}

/* ===== SHARE BUTTON ===== */
#shareBtn {
    margin-top: 15px;
    width: 100%;
    max-width: 380px;
    padding: 14px;
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: 0.2s ease-in-out;
}

#shareBtn:hover {
    transform: translateY(-2px);
}

/* ===== POPUP ===== */
.popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.popup-content {
    width: 100%;
    max-width: 340px;
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.popup-content h3 {
    margin-top: 0;
    color: var(--primary);
}

.popup-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.popup-buttons button,
.closePopup {
    padding: 12px;
    background: #e8ecf5;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: 0.15s ease-in-out;
}

.popup-buttons button:hover,
.closePopup:hover {
    background: #d9e0ee;
    transform: translateY(-2px);
}

.closePopup {
    margin-top: 15px;
}

/* ===== CATEGORIES ===== */
.categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 10px 15px 0;
}

.category {
    background: #eee;
    padding: 4px 8px;
    font-size: 0.78rem;
    border-radius: 6px;
    color: #333;
}

/* ===== NUMBER OF QUESTIONS ===== */
.nbquestion {
    padding: 14px;
}

/* ===== SPLIT TEXT ANIMATION ===== */
.split-text-container {
    display: flex;
    padding: 5px;
    font-size: 15px;
    font-weight: bold;
    text-transform: uppercase;
    color: #000;
    overflow: hidden;
}

.text-part {
    display: inline-block;
    position: relative;
    transform: translateX(0);
    animation-duration: 2s;
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
}

.text-part.left {
    transform: translateX(-200%);
    animation-name: slide-in-left;
}

.text-part.right {
    transform: translateX(200%);
    animation-name: slide-in-right;
}

@keyframes slide-in-left {
    0% {
        transform: translateX(-200%);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes slide-in-right {
    0% {
        transform: translateX(200%);
    }
    100% {
        transform: translateX(0);
    }
}

/* ===== GALLERY (from getQuizzList) ===== */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    padding: 20px;
}

.item-link {
    text-decoration: none !important;
    color: inherit;
}

a.item-link {
    text-decoration: none !important;
}

.item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    padding-bottom: 15px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.item img {
    width: 100%;
    height: auto;
    display: block;
}

.item h3 {
    font-size: 1.1rem;
    padding: 15px;
    margin: 0;
}

.item .date {
    font-size: 0.8rem;
    color: #777;
    padding: 10px 15px;
}

.item button {
    margin: 10px 15px 0;
    padding: 10px 15px;
    background: #007BFF;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.item button:hover {
    background: #005fcc;
}



        /* Overlay de la popup */
        .popup-overlay {
            display: none;
            position: fixed;
            top: 0;
            width: 90%;
            height: 100%;
            z-index: 1000;
            justify-content: center;
            align-items: center;
        }
        
        .popup-overlay.active {
            display: flex;
        }
        
        /* Contenu de la popup */
        .popup-content {
            background: white;
            padding: 40px;
            border-radius: 16px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
            text-align: center;
            position: relative;
            max-width: 400px;
            animation: slideIn 0.3s ease-out;
        }
        
        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .close-button {
            position: absolute;
            top: 15px;
            right: 15px;
            background: none;
            border: none;
            font-size: 24px;
            color: #999;
            cursor: pointer;
            width: 30px;
            height: 30px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: background 0.2s, color 0.2s;
        }
        
        .close-button:hover {
            background: #f0f0f0;
            color: #333;
        }
        
        .rating-title {
            font-size: 22px;
            color: #333;
            margin-bottom: 25px;
            font-weight: 500;
        }
        
        .stars {
            display: flex;
            gap: 10px;
            justify-content: center;
        }
        
        .star {
            font-size: 45px;
            cursor: pointer;
            color: #ddd;
            transition: color 0.2s, transform 0.2s;
            user-select: none;
        }
        
        .star:hover {
            transform: scale(1.15);
        }
        
        .star.active {
            color: #ffc107;
        }
        
        .star.hover {
            color: #ffc107;
        }