/**
 * Popup Contact Form Styles
 * Secure contact form styling with validation states
 */

/* Popup Body Container */
.popup-body {
    padding: 20px;
}

/* Form Groups */
.popup-body .form-group {
    margin-bottom: 1rem;
}

.popup-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
    font-size: 0.95rem;
}

.popup-body .required {
    color: #dc3545;
}

/* Form Controls */
.popup-body .form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.popup-body .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Success State */
.popup-body .form-control.success {
    border-color: #28a745;
}

.popup-body .form-control.success:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Error State */
.popup-body .form-control.error {
    border-color: #dc3545;
}

.popup-body .form-control.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

/* Error Messages */
.popup-body .error-message {
    display: none;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 0.375rem;
}

.popup-body .error-message-box {
    display: none;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 0.75rem;
    color: #721c24;
    margin-bottom: 1rem;
}

/* Character Counter */
.popup-body .char-counter {
    text-align: right;
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* reCAPTCHA Container */
.popup-body .g-recaptcha {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

/* Submit Button */
.popup-body .btn-submit {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-body .btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.popup-body .btn-submit:active {
    transform: translateY(0);
}

.popup-body .btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Success Message */
.popup-body .success-message {
    text-align: center;
    padding: 2rem 1rem;
}

.popup-body .success-icon {
    width: 64px;
    height: 64px;
    background-color: #28a745;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-body .success-message p {
    font-size: 1.1rem;
    color: #333;
    margin: 0;
}

/* Textarea Specific */
.popup-body textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Placeholder Styling */
.popup-body .form-control::placeholder {
    color: #999;
}

/* Focus Visible for Accessibility */
.popup-body .form-control:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Base Responsive Container */
.popup-container {
    overflow-y: auto;
    width: 90%;
    max-width: 500px;
}

.popup-body {
    max-height: calc(90vh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Ensure overlay is always full screen */
.popup-overlay {
    padding: 10px;
}

/* Tablet Devices (768px and below) */
@media (max-width: 768px) {
    .popup-container {
        width: 95%;
        max-width: 480px;
    }

    .popup-body {
        padding: 16px;
        max-height: calc(85vh - 55px);
    }

    .popup-body label {
        font-size: 0.9rem;
    }

    .popup-body .form-control {
        padding: 0.65rem;
        font-size: 0.9rem;
    }

    .popup-body .btn-submit {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .popup-body .success-icon {
        width: 56px;
        height: 56px;
        font-size: 2rem;
    }

    .popup-body .success-message p {
        font-size: 1rem;
    }

    .popup-body .error-message {
        font-size: 0.8rem;
    }

    .popup-body .char-counter {
        font-size: 0.8rem;
    }
}

/* Mobile Devices (576px and below) */
@media (max-width: 576px) {
    .popup-overlay {
        padding: 5px;
    }

    .popup-container {
        width: 98%;
        max-width: 100%;
        border-radius: 12px;
    }

    .popup-body {
        padding: 12px;
        max-height: calc(88vh - 50px);
    }

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

    .popup-body label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    .popup-body .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.6rem;
    }

    .popup-body textarea.form-control {
        min-height: 80px;
    }

    .popup-body .btn-submit {
        padding: 0.9rem;
        font-size: 0.95rem;
    }

    .popup-body .g-recaptcha {
        transform: scale(0.85);
        transform-origin: center;
    }

    .popup-body .success-message {
        padding: 1.5rem 0.5rem;
    }

    .popup-body .success-icon {
        width: 48px;
        height: 48px;
        font-size: 1.75rem;
    }

    .popup-body .success-message p {
        font-size: 0.95rem;
    }

    .popup-body .error-message-box {
        padding: 0.6rem;
        font-size: 0.85rem;
    }
}

/* Extra Small Mobile (480px and below) */
@media (max-width: 480px) {
    .popup-overlay {
        padding: 3px;
    }

    .popup-container {
        width: 100%;
        border-radius: 8px;
    }

    .popup-body {
        padding: 10px;
        max-height: calc(90vh - 48px);
    }

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

    .popup-body label {
        font-size: 0.8rem;
    }

    .popup-body .form-control {
        padding: 0.55rem;
        border-width: 1.5px;
    }

    .popup-body .btn-submit {
        padding: 0.85rem;
        font-size: 0.9rem;
    }

    .popup-body .g-recaptcha {
        transform: scale(0.77);
        transform-origin: center;
    }

    .popup-body .success-icon {
        width: 42px;
        height: 42px;
        font-size: 1.5rem;
    }

    .popup-body .success-message p {
        font-size: 0.9rem;
    }
}

/* Landscape Mode for Small Devices */
@media (max-height: 600px) and (orientation: landscape) {
    .popup-container {
        max-height: 95vh;
    }

    .popup-body {
        max-height: calc(95vh - 50px);
        padding: 10px 15px;
    }

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

    .popup-body label {
        margin-bottom: 0.3rem;
    }

    .popup-body textarea.form-control {
        min-height: 60px;
    }

    .popup-body .success-message {
        padding: 1rem 0.5rem;
    }

    .popup-body .success-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .popup-body .form-control {
        min-height: 44px; /* iOS touch target minimum */
    }

    .popup-body .btn-submit {
        min-height: 44px;
    }

    .popup-close {
        min-width: 44px;
        min-height: 44px;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .popup-body .form-control {
        border-width: 1.5px;
    }
}

/* Loading State Animation */
@keyframes buttonLoading {
    0% {
        opacity: 0.6;
    }
    50% {
        opacity: 1;
    }
    100% {
        opacity: 0.6;
    }
}

.popup-body .btn-submit:disabled {
    animation: buttonLoading 1.5s ease-in-out infinite;
}
