/**
 * Modal Popup Block - Frontend Styles
 */

/* Trigger Button */
.do-modal-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    line-height: 1;
}

.do-modal-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.do-modal-trigger:active {
    transform: translateY(0);
}

.do-modal-trigger.style-outline {
    background: transparent !important;
    border: 2px solid currentColor;
}

.do-modal-trigger.style-minimal {
    background: transparent !important;
    padding: 8px 16px;
    text-decoration: underline;
}

.do-modal-trigger svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
}

/* Overlay */
.do-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 20px;
    z-index: 999999;
}

.do-modal-overlay.active {
    display: flex;
    opacity: 1;
}

/* Modal Container */
.do-modal {
    position: relative;
    background: #fff;
    width: 100%;
    max-height: 90vh;
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
    margin: auto;
}

.do-modal.active {
    opacity: 1;
    transform: scale(1);
}

/* Size Variants */
.do-modal.size-small {
    max-width: 400px;
    width: 100%;
}

.do-modal.size-medium {
    max-width: 600px;
    width: 100%;
}

.do-modal.size-large {
    max-width: 800px;
    width: 100%;
}

.do-modal.size-extra-large {
    max-width: 1000px;
    width: 100%;
}

.do-modal.size-full {
    max-width: 1200px;
    width: 95%;
}

/* Position Variants */
.do-modal-overlay.position-top {
    align-items: flex-start;
    padding-top: 60px;
}

.do-modal-overlay.position-bottom {
    align-items: flex-end;
    padding-bottom: 60px;
}

/* Animation: Fade */
.do-modal.animation-fade {
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Animation: Slide Up */
.do-modal.animation-slide-up {
    animation: modalSlideUp 0.4s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation: Slide Down */
.do-modal.animation-slide-down {
    animation: modalSlideDown 0.4s ease;
}

@keyframes modalSlideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Animation: Zoom */
.do-modal.animation-zoom {
    animation: modalZoom 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modalZoom {
    from {
        opacity: 0;
        transform: scale(0.7);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation: Flip */
.do-modal.animation-flip {
    animation: modalFlip 0.6s ease;
}

@keyframes modalFlip {
    from {
        opacity: 0;
        transform: rotateX(-90deg);
    }
    to {
        opacity: 1;
        transform: rotateX(0);
    }
}

/* Close Button */
.do-modal-close {
    position: absolute;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.do-modal-close:hover {
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.do-modal-close:active {
    transform: rotate(90deg) scale(0.95);
}

.do-modal-close.top-right {
    top: -16px;
    right: -16px;
}

.do-modal-close.top-left {
    top: -16px;
    left: -16px;
}

.do-modal-close.inside-top-right {
    top: 16px;
    right: 16px;
}

.do-modal-close.inside-top-left {
    top: 16px;
    left: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .do-modal-overlay {
        padding: 10px;
    }

    .do-modal {
        max-width: 100% !important;
        max-height: 95vh !important;
        margin: 0 !important;
    }

    .do-modal.size-small,
    .do-modal.size-medium,
    .do-modal.size-large,
    .do-modal.size-extra-large {
        max-width: 100% !important;
    }

    .do-modal-close {
        width: 36px !important;
        height: 36px !important;
    }

    .do-modal-close.top-right,
    .do-modal-close.top-left {
        top: -12px;
    }

    .do-modal-close.top-right {
        right: -12px;
    }

    .do-modal-close.top-left {
        left: -12px;
    }
}

@media (max-width: 480px) {
    .do-modal {
        border-radius: 12px !important;
        padding: 20px !important;
    }

    .do-modal-trigger {
        font-size: 14px !important;
        padding: 10px 20px !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .do-modal-overlay,
    .do-modal,
    .do-modal-close,
    .do-modal-trigger {
        transition: none !important;
        animation: none !important;
    }

    .do-modal.active {
        transform: none;
    }
}

/* Hidden Content */
.do-modal-content {
    display: none;
}

/* Accessibility */
.do-modal:focus {
    outline: 2px solid #2563eb;
    outline-offset: 4px;
}

/* Scrollbar styling for modal */
.do-modal::-webkit-scrollbar {
    width: 8px;
}

.do-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.do-modal::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.do-modal::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}
