/* ===================================================================
   UNIFIED POPUP/MODAL SYSTEM
   Single source of truth for ALL popup forms across the entire site
   =================================================================== */

/* Full Page Overlay - BLOCKS ALL BACKGROUND CONTENT */
.popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    background: #0f172a !important;
    /* 100% OPAQUE - NO background visibility */
    z-index: 999999 !important;
    /* Above everything */
    display: none;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.popup-overlay.active {
    display: flex !important;
    opacity: 1;
}

/* Popup Container */
.popup-container {
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
    z-index: 1;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: popupAppear 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: 20px 0;
}

@keyframes popupAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Header */
.popup-header {
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.popup-header h2 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    color: #111827;
}

.popup-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    padding: 8px;
    line-height: 1;
    transition: color 0.2s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.popup-close:hover {
    color: #111827;
    background: #f3f4f6;
}

/* Progress Bar (for multi-step forms) */
.popup-progress-bar {
    height: 3px;
    background: #e5e7eb;
    width: 100%;
}

.popup-progress-fill {
    height: 100%;
    background: #3b82f6;
    width: 0%;
    transition: width 0.3s ease;
}

/* Content Area */
.popup-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px;
    background: white;
    -webkit-overflow-scrolling: touch;
}

.popup-content-inner {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

/* Icon (for simple modals) */
.popup-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.popup-icon svg {
    width: 32px;
    height: 32px;
}

/* Text Content */
.popup-text-header {
    text-align: center;
    margin-bottom: 32px;
}

.popup-text-header h3 {
    font-size: 24px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.popup-text-header p {
    font-size: 16px;
    color: #64748b;
    margin: 0;
    line-height: 1.6;
}

/* Form Elements */
.popup-form-group {
    margin-bottom: 24px;
    text-align: left;
}

.popup-form-label {
    display: block;
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.popup-form-input,
.popup-form-select,
.popup-form-textarea {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    background: white;
}

.popup-form-input:focus,
.popup-form-select:focus,
.popup-form-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.popup-form-input::placeholder {
    color: #9ca3af;
}

.popup-form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* Buttons */
.popup-btn-primary {
    width: 100%;
    padding: 16px 32px;
    background: #3b82f6;
    color: white;
    border: none;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.popup-btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.popup-btn-secondary {
    width: 100%;
    padding: 16px 32px;
    background: white;
    color: #374151;
    border: 2px solid #e5e7eb;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
}

.popup-btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

/* Footer (for multi-step forms) */
.popup-footer {
    padding: 20px 32px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    flex-shrink: 0;
}

.popup-btn-back {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    padding: 12px 24px;
    border-radius: 8px;
    transition: all 0.2s;
}

.popup-btn-back:hover {
    background: #f3f4f6;
    color: #111827;
}

.popup-btn-back.hidden {
    visibility: hidden;
}

.popup-btn-next {
    background: #3b82f6;
    color: white;
    border: none;
    font-size: 16px;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.popup-btn-next:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.popup-btn-next:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

/* Multi-Step Form Specific */
.popup-step {
    display: none;
}

.popup-step.active {
    display: block;
    animation: stepSlideIn 0.3s ease;
}

@keyframes stepSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-step-label {
    font-size: 14px;
    font-weight: 600;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

.popup-step-title {
    font-size: 32px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
    line-height: 1.2;
}

.popup-step-desc {
    font-size: 18px;
    color: #6b7280;
    margin-bottom: 40px;
    line-height: 1.6;
}

/* Success State */
.popup-success {
    text-align: center;
    padding: 60px 20px;
}

.popup-success-icon {
    width: 80px;
    height: 80px;
    background: #10b981;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.popup-success-icon svg {
    width: 48px;
    height: 48px;
    stroke: white;
    stroke-width: 3;
}

.popup-success h3 {
    font-size: 28px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.popup-success p {
    font-size: 18px;
    color: #6b7280;
    margin: 0 0 32px 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .popup-container {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .popup-header,
    .popup-footer {
        padding: 16px 20px;
    }

    .popup-content {
        padding: 24px 20px;
    }

    .popup-step-title {
        font-size: 24px;
    }

    .popup-step-desc {
        font-size: 16px;
        margin-bottom: 24px;
    }

    .popup-form-input,
    .popup-form-select,
    .popup-form-textarea {
        padding: 14px 16px;
        font-size: 16px;
        /* Prevent iOS zoom */
    }

    .popup-success {
        padding: 40px 16px;
    }

    .popup-success h3 {
        font-size: 24px;
    }

    .popup-success p {
        font-size: 16px;
    }
}

/* Utility Classes */
.popup-hidden {
    display: none !important;
}

.popup-text-center {
    text-align: center;
}

.popup-text-left {
    text-align: left;
}

/* Google Maps Autocomplete Override (for location inputs) */
.pac-container {
    position: fixed !important;
    z-index: 9999999 !important;
    /* Above popup */
    border-radius: 16px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    margin-top: 8px !important;
    padding: 8px !important;
    font-family: 'Poppins', sans-serif !important;
}

.pac-item {
    padding: 12px 16px !important;
    cursor: pointer !important;
    border-top: none !important;
    display: flex !important;
    align-items: center !important;
    transition: background 0.2s ease !important;
    border-radius: 8px !important;
}

.pac-item:hover {
    background-color: #f8fafc !important;
}

.pac-item-query {
    font-size: 15px !important;
    color: #1e293b !important;
    font-weight: 500 !important;
}

.pac-matched {
    color: #3b82f6 !important;
    font-weight: 600 !important;
}

.pac-icon {
    margin-right: 12px !important;
    filter: grayscale(1) opacity(0.5) !important;
}