/* =========================
   CONTACT FORM STYLING
   ========================= */

/* Prevent horizontal overflow */
html, body {
    overflow-x: hidden;
}

/* Contact Trigger Button */
.contact-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.contact-btn {
    background: #434343;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.contact-btn:hover {
    background: #555;
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
}

.contact-btn:active {
    transform: translateY(0);
}

.contact-arrow {
    width: 12px;
    height: 12px;
    transition: transform 0.3s ease;
}

.contact-btn:hover .contact-arrow {
    transform: translateX(3px);
}

/* Contact Form Overlay */
.contact-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.contact-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Contact Form Container */
.contact-form-container {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: calc(100vw - 20px);
    max-width: 600px;
    max-height: 90vh;
    background: white;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}

.contact-overlay.active .contact-form-container {
    transform: translateX(-50%) translateY(0);
}

/* Form Arrow */
.contact-form-arrow {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
    display: none;
}

/* Close Button */
.contact-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
    z-index: 2;
}

.contact-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Form Styling */
.contact-form {
    padding: 80px 30px 30px;
}

.form-header h2 {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 2em;
    margin: 0 0 30px;
    text-align: center;
    color: #434343;
    font-weight: 600;
}

.form-section {
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
    width: 100%;
    box-sizing: border-box;
}

.form-row .form-group {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
}

.section-label {
    display: block;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #434343;
    margin-bottom: 15px;
}

label {
    display: block;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #434343;
    margin-bottom: 8px;
}

.required {
    color: #e74c3c;
}

/* Input Styling */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
    max-width: 100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #434343;
    box-shadow: 0 0 0 3px rgba(67, 67, 67, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Email Verification */
.email-verification {
    margin-top: 5px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.email-verification.valid {
    color: #27ae60;
    opacity: 1;
}

.email-verification.invalid {
    color: #e74c3c;
    opacity: 1;
}

/* Services Pills */
.services-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}

.pill-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 14px;
    color: #666;
    box-sizing: border-box;
    flex-shrink: 0;
}

.pill-button:hover {
    background: #e9ecef;
    border-color: #cbd6e0;
}

.pill-button.selected {
    background: #434343;
    border-color: #434343;
    color: white;
}

.pill-check {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    transition: all 0.3s ease;
    opacity: 0;
}

.pill-button.selected .pill-check {
    background: white;
    border-color: white;
    color: #434343;
    opacity: 1;
}

/* File Upload */
.file-upload-container {
    position: relative;
}

input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 20px;
    border: 2px dashed #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
}

.file-upload-label:hover {
    border-color: #434343;
    background: #f5f6f7;
}

.file-icon {
    margin-bottom: 10px;
    opacity: 0.7;
}

.file-text {
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 14px;
    color: #666;
}

.file-list {
    margin-top: 15px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.file-remove {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-weight: bold;
    padding: 0 5px;
}

.file-remove:hover {
    color: #c0392b;
}

/* Industry Other Field */
#industryOther {
    margin-top: 10px;
    display: none;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    background: #434343;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 15px 20px;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.submit-btn:hover:not(:disabled) {
    background: #555;
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.submit-loader {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
}

.submit-btn.loading .submit-loader {
    display: block;
}

.submit-btn.loading span {
    opacity: 0.7;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Form Messages */
.form-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    font-size: 14px;
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.form-message.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    opacity: 1;
    transform: translateY(0);
}

.form-message.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    opacity: 1;
    transform: translateY(0);
}

/* =========================
   MOBILE RESPONSIVE
   ========================= */
@media screen and (max-width: 768px) {
    .contact-trigger {
        bottom: 20px;
        right: 20px;
    }

    .contact-btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .contact-form-container {
        width: calc(100vw - 10px);
        max-width: none;
        border-radius: 15px 15px 0 0;
        left: 50%;
        right: auto;
    }

    .contact-form {
        padding: 80px 20px 20px;
    }

    .form-header h2 {
        font-size: 1.6em;
        margin-bottom: 25px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .services-pills {
        gap: 8px;
    }

    .pill-button {
        padding: 8px 15px;
        font-size: 13px;
    }

    .file-upload-label {
        padding: 25px 15px;
    }

    /* Make form more touch-friendly */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea {
        padding: 15px;
        font-size: 16px; /* Prevent zoom on iOS */
        box-sizing: border-box;
        width: 100%;
    }

    .submit-btn {
        padding: 18px 20px;
        font-size: 16px;
    }
}

/* =========================
   DESKTOP ENHANCEMENTS
   ========================= */
@media screen and (min-width: 769px) {
    .contact-form-container {
        border-radius: 20px;
        bottom: 20px;
        max-height: 85vh;
    }

    .contact-overlay.active .contact-form-container {
        transform: translateX(-50%) translateY(0);
    }

    /* Enhanced hover effects for desktop */
    .pill-button:hover:not(.selected) {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .file-upload-label:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* =========================
   ACCESSIBILITY
   ========================= */
@media (prefers-reduced-motion: reduce) {
    .contact-overlay,
    .contact-form-container,
    .pill-button,
    .submit-btn,
    .file-upload-label {
        transition: none;
    }

    .submit-loader {
        animation: none;
    }
}

/* Focus indicators for accessibility */
.contact-btn:focus,
.contact-close:focus,
.pill-button:focus,
.submit-btn:focus,
.file-upload-label:focus-within {
    outline: 2px solid #434343;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pill-button {
        border-width: 3px;
    }
    
    .pill-button.selected {
        border-color: #000;
        background: #000;
    }
}