/**
 * PopupDisplayz - Styles
 * Design moderne et responsive avec bords arrondis
 */

/* Overlay (fond sombre) */
.popupdisplayz-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.popupdisplayz-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.popupdisplayz-overlay.show {
    opacity: 1;
}

/* Container du popup */
.popupdisplayz-container {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    overflow: hidden;
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: popupSlideIn 0.4s ease-out forwards;
}

@keyframes popupSlideIn {
    0% {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.popupdisplayz-overlay.closing .popupdisplayz-container {
    animation: popupSlideOut 0.3s ease-in forwards;
}

@keyframes popupSlideOut {
    0% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
    100% {
        transform: scale(0.7) translateY(-50px);
        opacity: 0;
    }
}

/* Bouton de fermeture */
.popupdisplayz-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.popupdisplayz-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: rotate(90deg);
}

.popupdisplayz-close:active {
    transform: scale(0.9) rotate(90deg);
}

/* Wrapper de l'image (ratio 16:9) */
.popupdisplayz-image-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* Ratio 16:9 (9/16 * 100) */
    overflow: hidden;
    background: #f0f0f0;
}

.popupdisplayz-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lien de l'image */
.popupdisplayz-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

.popupdisplayz-image-link:hover .popupdisplayz-image {
    opacity: 0.95;
    transition: opacity 0.2s ease;
}

/* Contenu texte */
.popupdisplayz-content {
    padding: 24px 28px 28px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333333;
}

.popupdisplayz-content h1,
.popupdisplayz-content h2,
.popupdisplayz-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: #1a1a1a;
    font-weight: 600;
}

.popupdisplayz-content h1 {
    font-size: 28px;
    line-height: 1.3;
}

.popupdisplayz-content h2 {
    font-size: 24px;
    line-height: 1.3;
}

.popupdisplayz-content h3 {
    font-size: 20px;
    line-height: 1.4;
}

.popupdisplayz-content p {
    margin: 0 0 12px 0;
}

.popupdisplayz-content p:last-child {
    margin-bottom: 0;
}

.popupdisplayz-content a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.popupdisplayz-content a:hover {
    color: #0056b3;
    text-decoration: underline;
}

.popupdisplayz-content strong,
.popupdisplayz-content b {
    font-weight: 600;
    color: #1a1a1a;
}

/* Boutons dans le contenu */
.popupdisplayz-content .btn,
.popupdisplayz-content button {
    display: inline-block;
    padding: 12px 24px;
    margin-top: 12px;
    background: #007bff;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.popupdisplayz-content .btn:hover,
.popupdisplayz-content button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.popupdisplayz-content .btn:active,
.popupdisplayz-content button:active {
    transform: translateY(0);
}

/* Checkbox "Ne plus afficher" */
.popupdisplayz-checkbox-wrapper {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.popupdisplayz-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: #666666;
}

.popupdisplayz-checkbox {
    margin: 0 8px 0 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #007bff;
}

.popupdisplayz-checkbox-label:hover {
    color: #333333;
}

/* Checkbox positionnée sur l'image (en bas à gauche) */
.popupdisplayz-checkbox-on-image {
    position: absolute;
    bottom: 12px;
    left: 12px;
    margin: 0;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 5;
    backdrop-filter: blur(4px);
}

.popupdisplayz-checkbox-on-image .popupdisplayz-checkbox-label {
    margin: 0;
    color: #333333;
    font-size: 12px;
    font-weight: 500;
}

.popupdisplayz-checkbox-on-image .popupdisplayz-checkbox-label:hover {
    color: #000000;
}

.popupdisplayz-checkbox-on-image .popupdisplayz-checkbox {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    margin: 0 6px 0 0;
}

/* === RESPONSIVE === */

/* Tablettes */
@media (max-width: 768px) {
    .popupdisplayz-overlay {
        padding: 15px;
    }

    .popupdisplayz-container {
        max-width: 500px;
        border-radius: 12px;
    }

    .popupdisplayz-content {
        padding: 20px 24px 24px;
        font-size: 15px;
    }

    .popupdisplayz-content h1 {
        font-size: 24px;
    }

    .popupdisplayz-content h2 {
        font-size: 21px;
    }

    .popupdisplayz-content h3 {
        font-size: 18px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    .popupdisplayz-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .popupdisplayz-container {
        max-width: 100%;
        border-radius: 12px;
        margin: 0 auto;
    }

    .popupdisplayz-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
        top: 10px;
        right: 10px;
    }

    .popupdisplayz-content {
        padding: 18px 20px 22px;
        font-size: 14px;
    }

    .popupdisplayz-content h1 {
        font-size: 22px;
    }

    .popupdisplayz-content h2 {
        font-size: 19px;
    }

    .popupdisplayz-content h3 {
        font-size: 17px;
    }

    .popupdisplayz-content .btn,
    .popupdisplayz-content button {
        display: block;
        width: 100%;
        text-align: center;
        padding: 14px 20px;
    }

    /* Checkbox sur image - version mobile */
    .popupdisplayz-checkbox-on-image {
        bottom: 8px;
        left: 8px;
        padding: 8px 12px;
        border-radius: 16px;
    }

    .popupdisplayz-checkbox-on-image .popupdisplayz-checkbox-label {
        font-size: 12px;
    }

    .popupdisplayz-checkbox-on-image .popupdisplayz-checkbox {
        width: 16px;
        height: 16px;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .popupdisplayz-overlay {
        padding: 8px;
        padding-top: 30px;
    }

    .popupdisplayz-container {
        border-radius: 10px;
    }

    .popupdisplayz-content {
        padding: 16px 18px 20px;
        font-size: 14px;
    }
}

/* Mode paysage mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .popupdisplayz-overlay {
        align-items: flex-start;
        padding-top: 20px;
    }

    .popupdisplayz-container {
        margin: 0 auto 20px;
    }
}

/* Accessibilité - Préférence de mouvement réduit */
@media (prefers-reduced-motion: reduce) {
    .popupdisplayz-overlay,
    .popupdisplayz-container,
    .popupdisplayz-close,
    .popupdisplayz-content .btn,
    .popupdisplayz-content button {
        transition: none;
        animation: none;
    }

    .popupdisplayz-container {
        transform: none;
        opacity: 1;
    }
}

/* Mode sombre (si supporté par le navigateur) */
@media (prefers-color-scheme: dark) {
    .popupdisplayz-container {
        background: #1e1e1e;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    }

    .popupdisplayz-content {
        color: #e0e0e0;
    }

    .popupdisplayz-content h1,
    .popupdisplayz-content h2,
    .popupdisplayz-content h3,
    .popupdisplayz-content strong,
    .popupdisplayz-content b {
        color: #ffffff;
    }

    .popupdisplayz-image-wrapper {
        background: #2a2a2a;
    }
}

