/* ========================================
   POPUP OPTIMIZATION - RESPONSIVE DESIGN
   ======================================== */

/* Base popup overlay styles */
.popup-overlay-base {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    overflow-y: auto;
}

.popup-overlay-base.active {
    display: flex;
}

/* Responsive popup container */
.popup-container-base {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 0;
    width: 100%;
    max-width: min(95vw, 800px);
    max-height: min(95vh, 800px);
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    color: white;
    display: flex;
    flex-direction: column;
}

/* Popup header */
.popup-header-base {
    padding: 1.5rem 2rem 1rem 2rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.popup-header-base h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: white;
    line-height: 1.2;
}

.popup-header-base p {
    color: rgba(255, 255, 255, 0.9);
    font-size: clamp(1rem, 3vw, 1.1rem);
    margin: 0;
    line-height: 1.4;
}

/* Popup content area */
.popup-content-base {
    padding: 1.5rem 2rem 2rem 2rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Important for flexbox scrolling */
}

/* Close button */
.popup-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.popup-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Large screens (1200px+) */
@media (min-width: 1200px) {
    .popup-container-base {
        max-width: 900px;
        max-height: 85vh;
    }
    
    .popup-header-base {
        padding: 2rem 2.5rem 1.5rem 2.5rem;
    }
    
    .popup-content-base {
        padding: 2rem 2.5rem 2.5rem 2.5rem;
    }
}

/* Medium screens (768px - 1199px) */
@media (min-width: 768px) and (max-width: 1199px) {
    .popup-overlay-base {
        padding: 1.5rem;
    }
    
    .popup-container-base {
        max-width: 90vw;
        max-height: 90vh;
    }
    
    .popup-header-base {
        padding: 1.5rem 2rem 1rem 2rem;
    }
    
    .popup-content-base {
        padding: 1.5rem 2rem 2rem 2rem;
    }
}

/* Small screens (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .popup-overlay-base {
        padding: 1rem;
    }
    
    .popup-container-base {
        max-width: 95vw;
        max-height: 95vh;
        border-radius: 15px;
    }
    
    .popup-header-base {
        padding: 1.25rem 1.5rem 0.75rem 1.5rem;
    }
    
    .popup-header-base h2 {
        font-size: 1.5rem;
    }
    
    .popup-content-base {
        padding: 1.25rem 1.5rem 1.5rem 1.5rem;
    }
    
    .popup-close-btn {
        width: 35px;
        height: 35px;
        font-size: 1.25rem;
        top: 0.75rem;
        right: 0.75rem;
    }
}

/* Extra small screens (below 480px) */
@media (max-width: 479px) {
    .popup-overlay-base {
        padding: 0.5rem;
    }
    
    .popup-container-base {
        max-width: 98vw;
        max-height: 98vh;
        border-radius: 12px;
    }
    
    .popup-header-base {
        padding: 1rem 1.25rem 0.5rem 1.25rem;
    }
    
    .popup-header-base h2 {
        font-size: 1.25rem;
    }
    
    .popup-header-base p {
        font-size: 0.9rem;
    }
    
    .popup-content-base {
        padding: 1rem 1.25rem 1.25rem 1.25rem;
    }
    
    .popup-close-btn {
        width: 30px;
        height: 30px;
        font-size: 1rem;
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* ========================================
   WIZARD-SPECIFIC OPTIMIZATIONS
   ======================================== */

.wizard-popup-container {
    max-width: min(95vw, 900px);
    max-height: min(95vh, 900px);
}

.wizard-popup-content {
    max-height: calc(95vh - 200px);
    overflow-y: auto;
}

/* Wizard steps */
.wizard-step-content {
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1rem;
    margin: 1rem 0;
}

/* Wizard navigation */
.wizard-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    gap: 1rem;
}

.wizard-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    min-width: 120px;
    white-space: nowrap;
}

.wizard-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e6edf3;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.wizard-btn.primary {
    background: linear-gradient(135deg, #4c8dff, #7aa2ff);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 141, 255, 0.3);
}

/* Mobile wizard navigation */
@media (max-width: 767px) {
    .wizard-navigation {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .wizard-btn {
        width: 100%;
        min-width: auto;
    }
}

/* ========================================
   FORM ELEMENTS OPTIMIZATION
   ======================================== */

.popup-form-group {
    margin-bottom: 1.5rem;
}

.popup-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #e6edf3;
    font-size: 1rem;
}

.popup-input, .popup-textarea, .popup-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #e6edf3;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.popup-textarea {
    resize: vertical;
    min-height: 100px;
    max-height: 200px;
    font-family: inherit;
}

/* Mobile form adjustments */
@media (max-width: 767px) {
    .popup-form-group {
        margin-bottom: 1.25rem;
    }
    
    .popup-input, .popup-textarea, .popup-select {
        padding: 0.625rem;
        font-size: 0.9rem;
    }
    
    .popup-textarea {
        min-height: 80px;
        max-height: 150px;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

.popup-content-base::-webkit-scrollbar,
.wizard-popup-content::-webkit-scrollbar,
.wizard-step-content::-webkit-scrollbar {
    width: 8px;
}

.popup-content-base::-webkit-scrollbar-track,
.wizard-popup-content::-webkit-scrollbar-track,
.wizard-step-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.popup-content-base::-webkit-scrollbar-thumb,
.wizard-popup-content::-webkit-scrollbar-thumb,
.wizard-step-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.popup-content-base::-webkit-scrollbar-thumb:hover,
.wizard-popup-content::-webkit-scrollbar-thumb:hover,
.wizard-step-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */

.popup-overlay-base:focus-within {
    outline: none;
}

.popup-close-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.wizard-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* ========================================
   ANIMATION IMPROVEMENTS
   ======================================== */

.popup-overlay-base {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.popup-overlay-base.active {
    opacity: 1;
}

.popup-container-base {
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.popup-overlay-base.active .popup-container-base {
    transform: scale(1) translateY(0);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.popup-scrollable {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.popup-no-scroll {
    overflow: hidden;
}

.popup-center-content {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.popup-full-height {
    height: 100%;
    max-height: none;
}

.popup-auto-height {
    height: auto;
    max-height: none;
}
