/* Popup Overlay */
        .popup-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 9999;
            justify-content: center;
            align-items: center;
            padding: 20px;
            box-sizing: border-box;
        }

        .popup-overlay.active {
            display: flex;
        }

        /* Popup Container */
        .popup-container {
            background: white;
            border-radius: 12px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
            width: 100%;
            max-width: 500px;
            max-height: 90vh;
            overflow-y: auto;
            animation: popupSlideIn 0.3s ease-out;
            position: relative;
        }

        @keyframes popupSlideIn {
            from {
                opacity: 0;
                transform: translateY(-50px) scale(0.9);
            }

            to {
                opacity: 1;
                transform: translateY(0) scale(1);
            }
        }

        /* Popup Header */
        .popup-header {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            padding: 24px 24px 0;
            padding-top: 48px; /* prevent overlap with top-right close button */
            border-bottom: 1px solid #e5e7eb;
            margin-bottom: 24px;
            gap: 4px;
        }

        .popup-header h2 {
            margin: 0;
            font-size: 1.5rem;
            font-weight: 600;
            color: #1f2937;
        }

        .popup-close {
            position: absolute;
            top: 12px;
            right: 12px;
            background: none;
            border: none;
            font-size: 24px;
            line-height: 1;
            cursor: pointer;
            color: #6b7280;
            padding: 6px;
            border-radius: 6px;
            transition: all 0.2s;
            z-index: 1;
        }

        .popup-close:hover {
            background: #f3f4f6;
            color: #374151;
        }

        /* Contact Form */
        .contact-form {
            padding: 0 24px 24px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 6px;
            font-weight: 500;
            color: #374151;
            font-size: 14px;
        }

        .form-group input:not([type=range]),
        .form-group textarea {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e5e7eb;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.2s, box-shadow 0.2s;
            box-sizing: border-box;
            font-family: inherit;
        }

        /* Range slider ensures the thumb can reach both ends */
        .form-group input[type=range] {
            -webkit-appearance: none;
            appearance: none;
            width: 100%;
            background: transparent;
            padding: 0; /* avoid extra offset on some browsers */
            border: none;
            outline: none;
        }

        .form-group input[type=range]::-webkit-slider-runnable-track {
            height: 6px;
            border-radius: 999px;
            background: linear-gradient(#1977cc, #1977cc) 0/var(--progress, 0%) 100% no-repeat, #e5e7eb;
        }
        .form-group input[type=range]::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #1977cc;
            border: 2px solid white;
            margin-top: -6px; /* align thumb center with 6px track on WebKit */
            box-shadow: 0 0 0 1px #e5e7eb;
        }
        .form-group input[type=range]::-moz-range-track {
            height: 6px;
            background: #e5e7eb;
            border-radius: 999px;
        }
        .form-group input[type=range]::-moz-range-progress {
            height: 6px;
            background: #1977cc;
            border-radius: 999px;
        }
        .form-group input[type=range]::-moz-range-thumb {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #1977cc;
            border: 2px solid white;
            box-shadow: 0 0 0 1px #e5e7eb;
        }
        .form-group input[type=range]::-ms-track {
            height: 6px;
            background: transparent;
            border-color: transparent;
            color: transparent;
        }
        .form-group input[type=range]::-ms-fill-lower {
            background: #1977cc;
            border-radius: 999px;
        }
        .form-group input[type=range]::-ms-fill-upper {
            background: #e5e7eb;
            border-radius: 999px;
        }
        .form-group input[type=range]::-ms-thumb {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: #1977cc;
            border: 2px solid white;
        }

        .form-group input:focus,
        .form-group textarea:focus {
            outline: none;
            border-color: #1977cc;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-group textarea {
            resize: vertical;
            min-height: 100px;
        }

        .send-btn {
            width: 100%;
            background: #1977cc;
            color: white;
            border: none;
            padding: 14px 24px;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: background-color 0.2s, transform 0.1s;
        }

        .send-btn:hover {
            background: #1977cca6;
        }

        .send-btn:active {
            transform: translateY(1px);
        }

        .send-btn:disabled {
            background: #9ca3af;
            cursor: not-allowed;
            transform: none;
        }

        /* Mobile Responsiveness */
        @media (max-width: 640px) {
            .popup-container {
                margin: 10px;
                max-height: 95vh;
            }

            .popup-header {
                padding: 20px 20px 0;
                margin-bottom: 20px;
            }

            .popup-header h2 {
                font-size: 1.25rem;
            }

            .contact-form {
                padding: 0 20px 20px;
            }

            .form-group input,
            .form-group textarea {
                padding: 10px 14px;
                font-size: 16px;
            }

            .send-btn {
                padding: 12px 20px;
            }
        }

        /* Tablet Responsiveness */
        @media (min-width: 641px) and (max-width: 1024px) {
            .popup-container {
                max-width: 600px;
            }
        }

        /* Large Screen Responsiveness */
        @media (min-width: 1025px) {
            .popup-container {
                max-width: 550px;
            }
        }

        /* High DPI Displays */
        @media (-webkit-min-device-pixel-ratio: 2),
        (min-resolution: 192dpi) {
            .popup-container {
                box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
            }
        }
        
        /* Mobile responsive reCAPTCHA */
        @media (max-width: 480px) {
            .g-recaptcha {
                transform: scale(0.85);
                transform-origin: center;
                margin: 10px -15px;
            }
        }
        
        /* Disabled button state */
        .send-btn:disabled {
            background-color: #6c757d;
            cursor: not-allowed;
            opacity: 0.6;
        }
        
        .send-btn:disabled:hover {
            background-color: #6c757d;
            transform: none;
        }