/* =========================================
   HERO FORM LAYOUT AND FUNCTIONALITY CSS
   Layout, positioning, responsive design, and functionality only
   Colors and fonts handled by theme files
   ========================================= */

/* Reset any default margins that might push hero down */
html, body {
    margin: 0 !important;
    padding: 0 !important;
}

/* Hero Form Container - Layout Only */
.hero-inline-form {
    position: relative;
    margin: 0 auto;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    padding: 1.25rem 1.25rem 0 1.25rem;
    border-radius: 12px;
    overflow: visible;
    box-sizing: border-box;
    /* background and colors handled by theme CSS */
}

/* Form wrapper - full width inside container */
.hero-form-wrapper {
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Hero form container positioning */
.hero-form-container {
    position: absolute !important;
    bottom: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 1200px !important;
    z-index: 10 !important;
    overflow: visible !important;
}

/* Remove all bottom spacing for large screen horizontal layout */
@media (min-width: 992px) {
    .hero-form-container .hero-form-wrapper {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    .hero-form-container #hero-form-fields {
        margin-bottom: 0 !important;
    }
    
    .hero-form-container .hero-form-inputs {
        margin-bottom: 0 !important;
    }
    
    .hero-form-container .hero-form-subtitle {
        margin-bottom: 0.25rem !important;
    }
    
    /* Hide close button on large screens - form should always be visible */
    #hero-form-close {
        display: none !important;
    }
    
    /* Hide CTA button on large screens - form is always visible */
    #hero-form-cta {
        display: none !important;
    }
}

/* Show close button only on small/medium screens */
@media (max-width: 991px) {
    #hero-form-close {
        display: flex !important;
        position: absolute;
        top: 8px;
        right: 8px;
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid #ffffff;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        font-weight: 900;
        color: #ffffff;
        cursor: pointer;
        z-index: 50;
        transition: all 0.2s ease;
        box-shadow: 0 2px 4px rgba(0,0,0,0.5);
        user-select: none;
    }
    
    #hero-form-close:hover {
        background: rgba(220, 53, 69, 0.9) !important;
        transform: scale(1.1) !important;
    }
}

/* Hero section layout */
.hero.section {
    position: relative !important;
    height: calc(100vh - 76px) !important;
    overflow: hidden !important;
    max-height: calc(100vh - 76px) !important;
    box-sizing: border-box !important;
}

/* Hero background image */
.hero-bg {
    width: 100% !important;
    height: calc(100vh - 76px) !important;
    object-fit: cover !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1 !important;
}

/* Hero container */
.hero .container {
    position: relative !important;
    z-index: 2 !important;
    height: calc(100vh - 76px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding-top: 80px !important;
    box-sizing: border-box !important;
}

/* Hero Text Positioning and Styling */
.hero .container .row:first-child {
    margin-top: -20px !important; /* Move text up 20px */
    flex-shrink: 0;
}

.hero h1 {
    font-size: 3rem !important;
    font-weight: bold !important;
    color: white !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7) !important;
    margin-bottom: 1rem !important;
}

.hero p {
    font-size: 1.4rem !important; /* Increased from default for better readability */
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7) !important;
    margin-bottom: 0 !important;
}

/* Form inputs layout */
.hero-form-inputs {
    margin: 0;
    display: flex;
    gap: 0.875rem;
    width: 100%;
    align-items: stretch;
    justify-content: space-between;
    flex-wrap: nowrap;
    max-width: 100%;
}

.hero-form-inputs .form-control {
    flex: 1;
    height: 45px;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    box-sizing: border-box;
}

.hero-form-inputs .form-control:nth-child(3) {
    flex: 1.2;
}

.hero-form-inputs .btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 140px;
    max-width: 180px;
    height: 45px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.hero-form-inputs .form-control:focus {
    border-color: var(--brand-accent, #FFD700);
    box-shadow: 0 0 0 0.2rem rgba(255, 215, 0, 0.25);
}

/* Submit button layout and styling */
.hero-form-submit {
    flex: 0 0 auto;
    width: 120px;
    height: 45px;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 800;
    border: 2px solid #000;
    background: linear-gradient(135deg, var(--brand-accent, #FFD700) 0%, #FFA500 100%);
    color: #000;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.3);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

/* Submit button hover effects */
.hero-form-submit:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 15px rgba(0,0,0,0.3) !important;
    background: linear-gradient(135deg, #FFA500 0%, var(--brand-accent, #FFD700) 100%) !important;
}

/* Close Button Positioning and Styling */
#hero-form-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    color: #ffffff;
    cursor: pointer;
    z-index: 50;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    user-select: none;
}

#hero-form-close:hover {
    background: rgba(220, 53, 69, 0.9) !important;
    color: #fff !important;
    border-color: #fff !important;
    transform: scale(1.1) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.5) !important;
}

/* Form phrase styling - Reduced spacing */
.hero-form-subtitle {
    margin-bottom: 0.125rem;
}

.hero-form-subtitle p {
    margin-bottom: 0.25rem;
    font-size: 1.2em; /* Minimum 16px equivalent for accessibility */
}

/* Call to Action Button - Consolidated Styles */
#hero-form-cta {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    width: auto;
    text-align: center;
    display: none; /* Hidden by default, will be shown by JS on small/medium screens */
    background: transparent !important; /* NO background on the container */
    padding: 0 !important; /* NO padding that could create backgrounds */
    border: none !important; /* NO border */
    box-shadow: none !important; /* NO shadow */
}

/* Removed .hero-cta-button styling - now uses same classes as submit button */

/* Hero section layout */
.hero .container {
    position: relative;
    z-index: 2;
    height: calc(100vh - 76px);
    display: flex;
    flex-direction: column;
    padding-top: 80px;
    justify-content: space-between;
    box-sizing: border-box;
}

.hero .row {
    margin-top: 2vh;
    flex-shrink: 0;
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    /* Hero form container - modal positioning for small AND medium screens */
    .hero-form-container {
        position: fixed !important;
        bottom: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: calc(100% - 40px) !important;
        max-width: 600px !important;
        max-height: 70vh !important;
        z-index: 1000 !important;
        overflow: visible !important;
        display: none !important; /* Hidden by default on medium and small screens */
    }
    
    /* Form slides up from bottom */
    .hero-inline-form {
        position: relative !important;
        bottom: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.25rem !important;
        border-radius: 12px 12px 0 0 !important;
        max-height: 70vh !important;
        overflow-y: auto !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3) !important;
        transform: translateY(0) !important;
        transition: transform 0.3s ease-out !important;
    }
    
    /* When form is hidden, slide it down */
    .hero-form-container[style*="display: none"] .hero-inline-form,
    .hero-form-container[style*="visibility: hidden"] .hero-inline-form {
        transform: translateY(100%) !important;
    }
    
    /* Form content adjustments for medium and small */
    .hero-form-inputs {
        flex-direction: column !important;
        gap: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .hero-form-inputs .form-control,
    .hero-form-inputs .btn {
        max-width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
        height: 50px !important;
        font-size: 1rem !important;
    }
    
    /* Close button positioning for modal */
    .hero-form-close {
        position: absolute !important;
        top: 15px !important;
        right: 15px !important;
        z-index: 1001 !important;
        background: rgba(0, 0, 0, 0.5) !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 35px !important;
        height: 35px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1.2rem !important;
        cursor: pointer !important;
        font-weight: bold !important;
    }
    
    .hero-form-close:hover {
        background: rgba(0, 0, 0, 0.7) !important;
    }
    
    /* CTA button styling for medium and small screens - just show it */
    #hero-form-cta {
        display: block !important; /* Show CTA button by default */
    }
    
    /* CTA button now uses .hero-form-submit class - no additional styling needed */
    
    /* Ensure hero section doesn't interfere */
    .hero.section {
        position: relative !important;
        height: calc(100vh - 76px) !important;
        overflow: hidden !important;
        max-height: calc(100vh - 76px) !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    /* Adjust hero text positioning */
    .hero .row {
        margin-top: 5vh !important;
        margin-bottom: 2rem !important;
    }
}

/* Small screens specific adjustments */
@media (max-width: 768px) {
    /* Make sure text is readable on small screens */
    .hero h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1rem !important;
    }
    
    .hero p {
        font-size: 1rem !important;
        line-height: 1.4 !important;
    }
    
    .hero-form-container {
        width: calc(100% - 20px) !important;
        max-width: none !important;
    }
}

/* Medium screens specific adjustments */
@media (min-width: 769px) and (max-width: 991px) {
    /* Adjust text size for medium screens */
    .hero h1 {
        font-size: 2.5rem !important;
    }
    
    .hero p {
        font-size: 1.1rem !important;
    }
    
    .hero-form-container {
        max-width: 500px !important;
    }
}

/* Large screens - show form by default, horizontal layout */
@media (min-width: 992px) {
    /* Form shows by default on large screens */
    .hero-form-container {
        position: absolute !important;
        bottom: 80px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        width: 90% !important;
        max-width: 1200px !important;
        z-index: 10 !important;
        overflow: visible !important;
        display: block !important; /* Show by default on large screens */
    }
    
    /* Hide CTA button on large screens since form is visible */
    #hero-form-cta {
        display: none !important;
    }
    
    /* Horizontal form layout for large screens */
    .hero-form-inputs {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0.875rem !important;
    }
    
    .hero-form-inputs .form-control {
        flex: 1;
        height: 45px;
        font-size: 0.9rem;
    }

    .hero-form-inputs .form-control:nth-child(3) {
        flex: 1.2;
    }

    .hero-form-inputs .btn {
        flex: 0 0 auto;
        width: auto;
        min-width: 140px;
        max-width: 180px;
    }
    
    /* Close button for large screens */
    .hero-form-close {
        position: absolute !important;
        top: 10px !important;
        right: 15px !important;
        z-index: 1001 !important;
        background: rgba(0, 0, 0, 0.3) !important;
        color: white !important;
        border: none !important;
        border-radius: 50% !important;
        width: 30px !important;
        height: 30px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 1rem !important;
        cursor: pointer !important;
        font-weight: bold !important;
    }
    
    .hero-form-close:hover {
        background: rgba(0, 0, 0, 0.5) !important;
    }
}

/* Hero Section Layout */
.hero.section {
  position: relative;
  height: calc(100vh - 76px);
  overflow: hidden;
  max-height: calc(100vh - 76px);
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Hero Background Image */
.hero-bg {
  width: 100%;
  height: calc(100vh - 76px);
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Alert Messages */
.hero-alert-success {
  background: rgba(40, 167, 69, 0.9) !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 0.9rem !important;
  padding: 0.5rem 1rem !important;
}

.hero-alert-danger {
  background: rgba(220, 53, 69, 0.9) !important;
  color: white !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 0.9rem !important;
  padding: 0.5rem 1rem !important;
}

/* Animations for form transitions */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

@keyframes slideUpFromBottom {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideDownToBottom {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(100%);
  }
}

/* Force CTA button visibility on small/medium screens - MAXIMUM specificity */
@media (max-width: 991px) {
  html body #hero-form-cta {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    /* Don't override positioning - let base styles handle it */
  }
  
  html body #hero-form-cta button,
  html body #hero-form-cta .hero-form-submit {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    cursor: pointer !important;
    /* Remove any sizing constraints that might cause overflow */
  }
}

/* Large screens CTA button styling (when form is closed) */
@media (min-width: 992px) {
  body #hero-form-cta {
    position: absolute !important;
    bottom: 40px !important; /* Moved closer to bottom but not covering text */
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 10 !important;
    width: 100% !important;
    text-align: center !important;
    /* Display will be controlled by JavaScript */
  }
  
  body #hero-form-cta button,
  body #hero-form-cta .hero-form-submit {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 1rem 2.5rem !important; /* Slightly larger for large screens */
    font-size: 1.2rem !important;
    border-radius: 8px !important; /* Less rounded for large screens */
  }
}

/* EMERGENCY OVERRIDE - Force show CTA button if everything else fails */
html body div#hero-form-cta[style*="display: none"] {
  display: block !important;
}

html body div#hero-form-cta button[style*="display: none"],
html body div#hero-form-cta .hero-form-submit[style*="display: none"] {
  display: inline-block !important;
}
