/* ============================================
   MOBILE STYLES (< 768px)
   ============================================ */

/* Trigger Button - Fixed top right */
.header-contact-trigger {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    
    width: 44px;
    height: 44px;
    
    background: #F5F5F5;
    border: 1px solid #C0C0C0;
    border-radius: 12px;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    cursor: pointer;
    
    /* Subtle pulse animation */
    animation: gentle-pulse 3s ease-in-out infinite;
    
    /* Touch optimization */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    
    /* Smooth transitions */
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.header-contact-trigger:hover,
.header-contact-trigger:focus {
    background: #FAFAFA;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-contact-trigger:active {
    transform: scale(0.95);
}

.header-contact-trigger svg {
    color: #424242;
}

/* Pulse animation for trigger */
@keyframes gentle-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(192, 192, 192, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(192, 192, 192, 0);
    }
}

/* Modal Overlay - Full screen blur */
.header-contact-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1001;
    
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    
    /* Smooth transitions */
    transition: opacity 0.3s ease-in-out;
}

.header-contact-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Modal Container - Slides from right */
.header-contact-modal {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    
    width: 90%;
    max-width: 380px;
    
    background: #FFFFFF;
    
    /* Rounded left corners only */
    border-radius: 24px 0 0 24px;
    
    padding: 32px 24px;
    
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    
    /* Slide animation */
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    
    /* Scrollable if content overflows */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.header-contact-modal-overlay.active .header-contact-modal {
    transform: translateX(0);
}

/* Modal Intro Text */
.modal-intro-text {
    font-size: 14px;
    line-height: 1.6;
    color: #666666;
    margin: 0 0 24px 0;
    text-align: left;
}

/* Form Fields - Mobile */
.form-field {
    margin-bottom: 16px;
}

/* Mobile Input Styling */
.mobile-input,
.mobile-textarea {
    width: 100%;
    
    font-family: inherit;
    font-size: 16px; /* Prevents iOS zoom on focus */
    line-height: 1.5;
    color: #333333;
    
    background: #FAFAFA;
    border: 1px solid #D3D3D3;
    border-radius: 12px;
    
    padding: 14px 16px;
    
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    
    /* Remove default appearance */
    appearance: none;
    -webkit-appearance: none;
}

.mobile-input {
    height: 48px;
}

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

/* Focus states */
.mobile-input:focus,
.mobile-textarea:focus {
    outline: none;
    background: #FFFFFF;
    border-color: #999999;
    box-shadow: 0 0 0 3px rgba(153, 153, 153, 0.1);
}

/* Placeholder styling */
.mobile-input::placeholder,
.mobile-textarea::placeholder {
    color: #999999;
    opacity: 0.6;
}

/* Send Button - Mobile */
.mobile-button {
    width: 100%;
    height: 52px;
    
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    
    background: #F5F5F5;
    border: 1px solid #C0C0C0;
    border-radius: 12px;
    
    cursor: pointer;
    
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    
    /* Touch optimization */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mobile-button:hover,
.mobile-button:focus {
    background: #FAFAFA;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-button:active {
    transform: scale(0.98);
}

.mobile-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Success state */
.mobile-button.success,
.desktop-button.success {
    background: #4CAF50;
    color: #FFFFFF;
    border-color: #4CAF50;
}

/* Hide desktop form on mobile */
.desktop-inline-form {
    display: none;
}


/* ============================================
   TABLET & DESKTOP STYLES (>= 768px)
   ============================================ */

@media (min-width: 768px) {
    
    /* Hide mobile trigger button */
    .header-contact-trigger {
        display: none;
    }
    
    /* Hide mobile modal */
    .header-contact-modal-overlay {
        display: none;
    }
    
    /* Show desktop inline form */
    .desktop-inline-form {
        display: flex;
        align-items: center;
        gap: 12px;
        
        padding: 0;
        margin: 0;
    }

    /* NEW: Locked state for the form */
    .desktop-inline-form.locked .desktop-input {
        opacity: 0.5;
        pointer-events: none;
    }
    
    /* Desktop Input Fields */
    .desktop-input {
        height: 32px; /* Make inputs even smaller vertically */
        
        font-family: inherit;
        font-size: 12px; /* Base font size for inputs */
        line-height: 1.5;
        color: #333333;
        
        background: #FAFAFA; /* Light gray background */
        border: 1.5px solid #D3D3D3; /* Thicker border */
        border-radius: 50px; /* Complete corner rounding */
        
        padding: 6px 14px; /* Reduce vertical padding */
        
        transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
        
        /* Remove default appearance */
        appearance: none;
        -webkit-appearance: none;
    }
    
    /* Phone field width */
    .desktop-input[name="phone"] {
        width: 120px; /* Narrow enough for numbers, e.g., (760) 815-9972 */
        flex-shrink: 0;
    }
    
    /* Message field - horizontal scroll behavior */
    .desktop-input[name="message"] {
        max-width: 15ch; /* Set width to roughly 15 characters */
        flex-grow: 1; /* Allow it to take available space up to max-width */
        font-size: 13px; /* Slightly larger text for message content */
        
        /* Horizontal scroll setup */
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        
        /* Hide scrollbar */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }
    
    .desktop-input[name="message"]::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    
    /* Focus states */
    .desktop-input:focus {
        outline: none;
        background: #FFFFFF;
        border-color: #007bff46;
        box-shadow: 0 0 0 3px rgba(153, 153, 153, 0.1);
    }
    
    /* Placeholder styling */
    .desktop-input::placeholder {
        color: #999999;
        opacity: 0.7;
    }
    
    /* Send Button - Desktop */
    .desktop-button {
        /* NEW: Variables for arrow sizing */
        --arrow-stroke-width: 5px; /* Based on user's --arm-thickness and --shaft-width */
        --arrow-size-percentage: 60%; /* How much of the button the arrow takes up */

        /* NEW: iOS-style button */
        --ios-blue: #007bff46;
        height: 32px; /* Match new input height */
        width: 30px; /* Match new input height for perfect circle */
        flex-shrink: 0;
        padding: 0;
        border-radius: 50%;
        background-color: #69a5ee4a; /* Cornflower Blue */
        color: var(--ios-blue); /* Arrow color matches border */
        border: none;
        background: transparent;
        border: 2.5px solid var(--ios-blue); /* Thicker border as requested */
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        
        outline: none;
        /* Hidden by default - appears when fields filled */
        opacity: 0;
        pointer-events: none;
        transform: scale(0.95);
        transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    }

    /* SVG Arrow Icon inside the button */
    .desktop-button::before { /* Use ::before for the SVG arrow */
        content: ""; /* No text content */
        background-image: url("data:image/svg+xml,%3Csvg xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22 fill%3D%22none%22 viewBox%3D%220 0 24 24%22 stroke%3D%22currentColor%22 stroke-linecap%3D%22round%22 stroke-linejoin%3D%22round%22%3E%3Cpath stroke-width%3D%22var(--arrow-stroke-width)%22 d%3D%22M12 20V4M6 10L12 4L18 10%22 %2F%3E%3C%2Fsvg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: var(--arrow-size-percentage); /* Scale the SVG to fit within the button */
        display: block; /* Make it a block to take up space */
        width: 100%;
        height: 100%;
        transition: opacity 0.2s ease;
    }

    /* "Sent" text, hidden by default */
    .desktop-button::after {
        content: 'Sent';
        position: absolute;
        opacity: 0;
        font-size: 12px;
        font-weight: bold;
        white-space: nowrap;
    }
    
    /* Visible state when fields are filled */
    .desktop-button.visible {
        opacity: 1;
        pointer-events: auto;
        transform: scale(1);
    }

    /* NEW: "Sent" state styles */
    .desktop-button.sent {
        width: 80px; /* Expand width */
        border-radius: 50px; /* Keep pill shape */
        background-color: var(--color-silver-500); /* Dull grey-blue */
        cursor: default;
    }

    .desktop-button.sent::before {
        opacity: 0; /* Hide arrow */
    }

    .desktop-button.sent::after {
        opacity: 1; /* Show "Sent" text */
        transition: opacity 0.2s ease 0.2s; /* Delay text appearance */
    }
    
    .desktop-button:hover,
    .desktop-button:focus {
        background: var(--ios-blue);
        color: #fff;
        box-shadow: 0 0 12px 2px rgba(0, 122, 255, 0.3);
        transform: translateY(-2px);
    }
    
    .desktop-button:active { /* Keep the iOS active state */
        transform: scale(0.96);
        box-shadow: 0 0 6px rgba(0, 122, 255, 0.4);
    }

    /* The SVG arrow size is controlled by background-size, not font-size */
}

/* ============================================
   LARGER DESKTOP (>= 1024px)
   ============================================ */

@media (min-width: 1024px) {
    
    .desktop-input {
        font-size: 13px; /* Slightly larger base font for inputs on larger screens */
        height: 36px; /* Slightly taller inputs on larger screens */
    }
    
    .desktop-button {
        height: 36px; /* Match new input height */
        width: 36px; /* Match new input height for perfect circle */
        /* The SVG arrow will automatically scale with the button size */
    }
    
}

/* ============================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================ */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .header-contact-trigger,
    .mobile-input,
    .mobile-textarea,
    .mobile-button,
    .desktop-input,
    .desktop-button {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .header-contact-trigger,
    .header-contact-modal-overlay,
    .header-contact-modal,
    .mobile-button,
    .desktop-button {
        animation: none;
        transition: none;
    }
}

/* Focus visible for keyboard navigation */
.header-contact-trigger:focus-visible,
.mobile-input:focus-visible,
.mobile-textarea:focus-visible,
.mobile-button:focus-visible,
.desktop-input:focus-visible,
.desktop-button:focus-visible {
    outline: 2px solid #333333;
    outline-offset: 2px;
}