/* Mobile Responsive Fixes for Hope Acres Glamping Website */
/* Focus on date pickers and form elements */

/* Base mobile styles */
@media (max-width: 768px) {
    /* Fix viewport and prevent horizontal scroll */
    body {
        overflow-x: hidden;
        -webkit-text-size-adjust: 100%;
    }
    
    /* Fix date inputs on mobile */
    input[type="date"],
    input[type="text"]#checkIn,
    input[type="text"]#checkOut,
    .flatpickr-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        height: 48px !important;
        padding: 0 16px !important;
        border: 2px solid #e0e0e0 !important;
        border-radius: 8px !important;
        width: 100% !important;
        -webkit-appearance: none;
        appearance: none;
        background-color: white !important;
        display: block !important;
        box-sizing: border-box !important;
    }
    
    /* Flatpickr mobile fixes */
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 320px !important;
        margin: 0 auto;
        font-size: 14px;
    }
    
    .flatpickr-calendar.static {
        position: absolute !important;
        top: auto !important;
        left: 50% !important;
        transform: translateX(-50%);
        z-index: 999;
    }
    
    .flatpickr-day {
        height: 40px !important;
        line-height: 40px !important;
        font-size: 14px !important;
    }
    
    .flatpickr-months {
        height: 45px !important;
    }
    
    .flatpickr-current-month {
        font-size: 115% !important;
    }
    
    /* Search form mobile layout */
    .search-refinement {
        padding: 1.5rem !important;
        margin: -1rem 1rem 2rem !important;
    }
    
    .search-inputs {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .search-inputs .form-group {
        margin-bottom: 0;
    }
    
    .search-inputs label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #333;
    }
    
    .search-button,
    .refine-button,
    button[type="submit"] {
        width: 100%;
        height: 48px !important;
        font-size: 16px !important;
        font-weight: 600;
        margin-top: 8px;
    }
    
    /* Availability search form specific */
    .availability-search-form {
        width: 100%;
    }
    
    /* Fix select dropdowns */
    select {
        font-size: 16px !important;
        height: 48px !important;
        padding: 0 16px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 16px center;
        background-size: 12px;
        padding-right: 40px;
        -webkit-appearance: none;
        appearance: none;
    }
    
    /* Search summary mobile */
    .search-summary {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        margin: 1rem;
    }
    
    .summary-item {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
    
    /* Site cards mobile */
    .available-sites-grid {
        padding: 0 1rem;
    }
    
    .available-site-card {
        margin-bottom: 1rem;
    }
    
    /* Header fixes */
    header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: white;
    }
    
    .mobile-menu-toggle {
        font-size: 24px;
        padding: 8px 12px;
    }
    
    /* Navigation mobile */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: white;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        padding: 60px 20px 20px;
        overflow-y: auto;
        transition: right 0.3s ease;
        z-index: 1001;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        margin: 0;
        padding: 15px 0;
        border-bottom: 1px solid #eee;
    }
    
    .nav-links a {
        font-size: 16px;
        display: block;
        padding: 5px 0;
    }
    
    /* Form elements */
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea {
        font-size: 16px !important;
        padding: 12px 16px;
        border-radius: 8px;
        border: 2px solid #e0e0e0;
    }
    
    /* Booking form mobile */
    .booking-form {
        padding: 1rem;
    }
    
    .booking-form .form-row {
        flex-direction: column;
    }
    
    .booking-form .form-group {
        width: 100%;
    }
    
    /* Payment page mobile */
    .checkout-container {
        padding: 1rem;
    }
    
    .checkout-options {
        flex-direction: column;
    }
    
    .checkout-option {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Hero section mobile */
    .hero-content h1 {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    /* CTA buttons mobile */
    .cta-button,
    .nav-button {
        padding: 12px 24px;
        font-size: 14px;
    }
    
    /* Footer mobile */
    footer {
        padding: 2rem 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 2rem;
    }
}

/* Smaller phones */
@media (max-width: 375px) {
    .flatpickr-calendar {
        max-width: 290px !important;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
    }
    
    .availability-hero h1 {
        font-size: 1.5rem;
    }
    
    .search-refinement {
        padding: 1rem !important;
        margin: -0.5rem 0.5rem 1.5rem !important;
    }
}

/* Landscape orientation fixes */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 2rem 0;
    }
    
    .flatpickr-calendar {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS input fixes */
    input[type="text"],
    input[type="date"],
    select,
    textarea {
        -webkit-appearance: none;
        border-radius: 0;
    }
    
    /* Fix iOS zoom on input focus */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: .001dpcm) {
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23333' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
        background-position: right 12px center;
    }
}

/* Touch-friendly adjustments */
@media (pointer: coarse) {
    /* Make clickable elements larger for touch */
    button,
    .btn,
    a.nav-button,
    a.cta-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Increase tap target size */
    .nav-links a {
        padding: 10px 0;
    }
    
    /* Flatpickr touch improvements */
    .flatpickr-day {
        height: 44px !important;
        line-height: 44px !important;
    }
    
    .flatpickr-prev-month,
    .flatpickr-next-month {
        padding: 10px;
    }
}

/* Ensure modals and overlays work on mobile */
.modal,
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Accessibility improvements for mobile */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles to prevent mobile print issues */
@media print {
    .mobile-menu-toggle,
    .mobile-menu-close,
    .nav-links {
        display: none !important;
    }
}