/* ======================================================================= */
/*                     GLOBAL CONTACT FORM & FORM STATES                   */
/* ======================================================================= */

/* Background for form sections */
.form-section-bg {
    background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url('/world-planets-500x500.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

@media (max-width: 768px) {
    .form-section-bg {
        background-attachment: scroll;
    }
}

.form-section-bg h2 {
    color: #fff;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.form-section-bg .section-subtitle {
    color: #eee;
}

.global-contact-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    background: #fafbfc;
    border-radius: 9px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.global-contact-form input,
.global-contact-form textarea {
    width: 100%;
    padding: 0.82rem 1.05rem;
    background-color: #f7fcff;
    border: 1px solid #b7e1f7;
    border-radius: 7px;
    color: var(--text-color);
    font-family: inherit;
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: border 0.15s;
    box-sizing: border-box;
    /* iPhone specific optimizations */
    -webkit-appearance: none;
    appearance: none;
    min-height: 44px; /* iOS touch target requirement */
}

.global-contact-form textarea {
    min-height: 90px;
    resize: vertical;
}

.global-contact-form input:focus,
.global-contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.global-contact-form input.error-border,
.global-contact-form textarea.error-border {
    border: 2px solid #dc3545;
}

.form-message {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 5px;
    font-size: clamp(0.85rem, 2vw, 0.95rem);
    text-align: center;
    display: none;
}

.form-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.form-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.cta-button.loading {
    background-color: #e0e0e0;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #e0e0e0;
}

.cta-button.loading:hover {
    background-color: #e0e0e0;
    transform: none;
    color: #6c757d;
}

.cta-button {
    display: inline-block;
    width: 100%;
    background-color: #00aaff;
    color: #fff;
    font-weight: 600;
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    border: none;
    padding: 1rem 0;
    border-radius: 7px;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: background 0.15s, color 0.12s, transform .16s;
    box-sizing: border-box;
}

.cta-button:hover,
.cta-button:focus {
    background-color: #0077b6;
    color: #fff;
    transform: translateY(-2px) scale(1.015);
}

/* Responsive form adjustments */
@media screen and (max-width: 768px) {
    .global-contact-form {
        max-width: 95%;
        margin: 1rem auto;
        padding: 1.5rem 1rem;
    }
    
    .global-contact-form input,
    .global-contact-form textarea {
        padding: 0.75rem 0.9rem;
        font-size: 16px; /* Prevent zoom on iPhone */
    }
    
    .cta-button {
        padding: 0.9rem 0;
        font-size: 16px; /* Prevent zoom on iPhone */
    }
}

/* iPhone optimizations */
@media screen and (max-width: 480px) {
    .global-contact-form {
        max-width: 100%;
        padding: 1.2rem 0.8rem;
        margin: 0.5rem auto;
    }
    
    .global-contact-form input,
    .global-contact-form textarea {
        padding: 1rem 0.8rem;
        font-size: 16px; /* Prevent zoom on iPhone */
        border-radius: 8px;
        min-height: 50px; /* Larger touch target for iPhone */
    }
    
    .global-contact-form textarea {
        min-height: 120px;
        resize: vertical;
    }
    
    .cta-button {
        padding: 1rem 0;
        font-size: 16px;
        min-height: 50px;
        border-radius: 8px;
    }
    
    .form-message {
        font-size: 14px;
        padding: 0.8rem;
    }
}

/* iPhone SE and smaller */
@media screen and (max-width: 375px) {
    .global-contact-form {
        padding: 1rem 0.5rem;
    }
    
    .global-contact-form input,
    .global-contact-form textarea {
        padding: 0.9rem 0.7rem;
    }
    
    .cta-button {
        padding: 0.9rem 0;
    }
}