/**
 * PB Popup Builder - Frontend Styles
 */

/* Popup Overlay */
.pb-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.pb-popup-overlay.pb-popup-show {
    opacity: 1;
    visibility: visible;
}

/* Popup Container */
.pb-popup-container {
    border-radius: 8px;
    max-width: 600px;
    max-height: 80vh;
    width: 100%;
    position: relative;
    transform: scale(0.8) translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.pb-popup-show .pb-popup-container {
    transform: scale(1) translateY(0);
}

/* Close Button */
.pb-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.pb-popup-close:hover {
    background: #f0f0f0;
    color: #333;
}

.pb-popup-close:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Popup Content */
.pb-popup-content {
    padding: 0;
    max-height: calc(80vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Content Styling */
.pb-popup-content h1,
.pb-popup-content h2,
.pb-popup-content h3,
.pb-popup-content h4,
.pb-popup-content h5,
.pb-popup-content h6 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.pb-popup-content p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.pb-popup-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.pb-popup-content .wp-block-image {
    margin-bottom: 1rem;
}

.pb-popup-content .wp-block-button {
    margin-bottom: 1rem;
}


/* Form Styling */
.pb-popup-content form {
    margin-bottom: 0;
}

.pb-popup-content input[type="text"],
.pb-popup-content input[type="email"],
.pb-popup-content input[type="tel"],
.pb-popup-content textarea,
.pb-popup-content select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 10px;
    box-sizing: border-box;
}


/* Body Lock */
body.pb-popup-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .pb-popup-overlay {
        padding: 15px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .pb-popup-container {
        max-height: calc(100vh - 80px);
        margin: 0 auto;
    }
    
    .pb-popup-content {
        padding: 0;
        max-height: calc(100vh - 140px);
    }
    
    .pb-popup-close {
        top: 10px;
        right: 15px;
        font-size: 20px;
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 480px) {
    .pb-popup-overlay {
        padding: 10px;
        padding-top: 20px;
    }
    
    .pb-popup-container {
        max-height: calc(100vh - 40px);
        border-radius: 6px;
    }
    
    .pb-popup-content {
        padding: 0;
        max-height: calc(100vh - 80px);
    }
}

/* Animation for content elements */
.pb-popup-show .pb-popup-content > * {
    animation: pb-popup-fade-in-up 0.4s ease 0.2s both;
}

@keyframes pb-popup-fade-in-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom scrollbar for webkit browsers */
.pb-popup-content::-webkit-scrollbar {
    width: 6px;
}

.pb-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.pb-popup-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.pb-popup-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pb-popup-overlay {
        background: rgba(0, 0, 0, 0.95);
    }
    
    .pb-popup-container {
        border: 2px solid #000;
    }
    
    .pb-popup-close {
        border: 1px solid #666;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pb-popup-overlay,
    .pb-popup-container,
    .pb-popup-close,
    .pb-popup-content > * {
        transition: none;
        animation: none;
    }
    
    .pb-popup-container {
        transform: none;
    }
}