/**
 * ARX Popup - Frontend Styles
 * Version: 1.0.0
 * RGAA compliant styles
 */

/* CSS Variables */
:root {
    --arx-popup-primary-color: #2271b1;
    --arx-popup-button-bg: #2271b1;
    --arx-popup-button-bg-hover: #135e96;
    --arx-popup-button-text: #ffffff;
    --arx-popup-text-color: #1d2327;
    --arx-popup-overlay-opacity: 0.7;
    --arx-popup-animation-duration: 300ms;
}

/* Screen reader only class */
.arx-popup-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Popup Overlay */
.arx-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, var(--arx-popup-overlay-opacity));
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--arx-popup-animation-duration) ease-in-out, 
                visibility var(--arx-popup-animation-duration) ease-in-out;
}

.arx-popup-overlay.arx-popup-active {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.arx-popup-container {
    position: relative;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.7);
    transition: transform var(--arx-popup-animation-duration) ease-in-out;
}

.arx-popup-overlay.arx-popup-active .arx-popup-container {
    transform: scale(1);
}

/* Popup Content */
.arx-popup-content {
    background: #ffffff;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Close Button */
.arx-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #646970;
    transition: color 0.2s ease, transform 0.2s ease;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arx-popup-close:hover,
.arx-popup-close:focus {
    color: #000000;
    transform: scale(1.1);
}

.arx-popup-close svg {
    width: 24px;
    height: 24px;
    display: block;
}

/* Popup Image */
.arx-popup-image {
    margin-bottom: 20px;
    text-align: center;
}

.arx-popup-image img {
    height: auto;
    display: inline-block;
}

/* Popup Text */
.arx-popup-text {
    margin-bottom: 20px;
    line-height: 1.6;
    color: var(--arx-popup-text-color);
}

.arx-popup-text p:first-child {
    margin-top: 0;
}

.arx-popup-text p:last-child {
    margin-bottom: 0;
}

/* Popup Link/Button */
.arx-popup-link {
    text-align: center;
    margin-top: 20px;
}

.arx-popup-button {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--arx-popup-button-bg);
    color: var(--arx-popup-button-text);
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.arx-popup-button:hover {
    background-color: var(--arx-popup-button-bg-hover);
    color: var(--arx-popup-button-text);
    transform: translateY(-2px);
}

.arx-popup-button:focus {
    background-color: var(--arx-popup-button-bg-hover);
    color: var(--arx-popup-button-text);
}

.arx-popup-button:active {
    transform: translateY(0);
}

/* Shortcode Display */
.arx-popup-shortcode {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

.arx-popup-shortcode.arx-popup-shortcode-hidden {
    display: none;
}

/* Shortcode Close Button */
.arx-popup-shortcode-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.arx-popup-shortcode-close img {
    display: block;
}

.arx-popup-shortcode-image {
    text-align: center;
}

.arx-popup-shortcode-image img {
    height: auto;
    display: inline-block;
}

.arx-popup-shortcode-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.arx-popup-shortcode-text {
    line-height: 1.6;
    color: var(--arx-popup-text-color);
}

.arx-popup-shortcode-text p:first-child {
    margin-top: 0;
}

.arx-popup-shortcode-text p:last-child {
    margin-bottom: 0;
}

.arx-popup-shortcode-link {
    text-align: center;
}

.arx-popup-shortcode-link a {
    display: inline-block;
    padding: 12px 24px;
    background-color: var(--arx-popup-button-bg);
    color: var(--arx-popup-button-text);
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.arx-popup-shortcode-link a:hover {
    background-color: var(--arx-popup-button-bg-hover);
    color: var(--arx-popup-button-text);
    transform: translateY(-2px);
}

.arx-popup-shortcode-link a:focus {
    background-color: var(--arx-popup-button-bg-hover);
    color: var(--arx-popup-button-text);
}

/* Error message */
.arx-popup-error {
    color: #dc3232;
    background: #fef7f1;
    border-left: 4px solid #dc3232;
    padding: 12px;
    margin: 20px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .arx-popup-container {
        width: 95%;
        max-width: none;
    }
    
    .arx-popup-content {
        padding: 20px;
    }
    
    .arx-popup-shortcode {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .arx-popup-content {
        padding: 15px;
    }
    
    .arx-popup-close {
        top: 10px;
        right: 10px;
    }
    
    .arx-popup-button,
    .arx-popup-shortcode-link a {
        padding: 10px 20px;
    }
}

/* Print styles */
@media print {
    .arx-popup-overlay {
        display: none;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .arx-popup-overlay,
    .arx-popup-container,
    .arx-popup-close,
    .arx-popup-button,
    .arx-popup-shortcode-link a {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .arx-popup-content {
        border: 2px solid #000000;
    }
    
    .arx-popup-close:focus,
    .arx-popup-button:focus,
    .arx-popup-shortcode-link a:focus {
        outline-width: 3px;
    }
}

/* Style popup de contenu */
.arx-is-popup {
    position: relative !important;
}
.arx-popup-close{
    background-image: url("../img/arx-close.svg");
    background-size: contain;
    background-repeat: no-repeat;
}