/**
 * Humaniti Popup Manager Frontend Styles
 */

 .popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease-out, visibility 0s linear;
    padding: 10px;
}

.popup.popup--fade-out {
    opacity: 0;
}

.popup[hidden] {
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease-out, visibility 0s linear 0.3s;
}

.popup__container {
    position: relative;
    width: 100%;
    max-width: var(--popup-max-width, 600px);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
    /* Default colors when not using minimal styling */
    --popup-close-color: #000000;
    --popup-close-hover-color: #666666;
}

.popup__container.popup__container--minimal {
    background: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.popup:not([hidden]) .popup__container {
    opacity: 1;
    transform: scale(1);
}

.popup__content {
    padding: 2rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.popup__container.popup__container--minimal .popup__content {
    padding: 0;
}

.popup__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
    border: none;
    border-radius: 50%;
    background: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--popup-close-color);
    transition: color 0.2s ease-in-out;
}

.popup__close:focus {
    outline: 2px solid currentColor;
    border-radius: 50%;
    background: none !important;
}

.popup__close:focus:not(:focus-visible) {
    outline: none;
}

.popup__close:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 50%;
}

.popup__close svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
}

/* Default hover state */
.popup__close:hover {
    color: var(--popup-close-hover-color);
}

/* Minimal style with custom colors */
.popup__container--minimal .popup__close {
    top: -3.5rem;
    right: 0;
}

.popup__container--minimal .popup__close,
.popup__container--minimal .popup__close:focus,
.popup__container--minimal .popup__close:focus-visible {
    color: var(--popup-close-color);
}

.popup__container--minimal .popup__close:hover {
    color: var(--popup-close-hover-color);
}

/* High Contrast Mode Support */
@media (forced-colors: active) {
    .popup__container {
        border: 1px solid CanvasText;
    }
    
    .popup__close {
        border: 1px solid CanvasText;
    }
}
