/**
 * MQS Booking Mobile-Responsive CSS
 * Optimized for tablets and mobile devices
 */

/* Mobile-First Approach - Base styles for mobile */
@media screen and (max-width: 1024px) {
    
    /* ===== GENERAL MOBILE STYLES ===== */
    .mqs-booking-form-container,
    .mqs-search-form {
        margin: 10px;
        padding: 20px 15px;
        border-radius: 8px;
    }
    
    /* Touch-friendly button sizing */
    .mqs-btn {
        min-height: 44px; /* iOS recommended touch target */
        padding: 12px 20px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
        transition: all 0.2s ease;
    }
    
    .mqs-btn:active {
        transform: scale(0.98);
        background-color: rgba(0, 115, 170, 0.9);
    }
    
    /* ===== FORM ELEMENTS ===== */
    .mqs-form-field input,
    .mqs-form-field select,
    .mqs-form-field textarea {
        min-height: 44px;
        padding: 15px;
        font-size: 16px; /* Prevents zoom on iOS */
        border: 2px solid #ddd;
        border-radius: 8px;
        -webkit-appearance: none; /* Remove iOS styling */
        -moz-appearance: none;
        appearance: none;
    }
    
    .mqs-form-field input:focus,
    .mqs-form-field select:focus,
    .mqs-form-field textarea:focus {
        border-color: #0073aa;
        box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
        outline: none;
    }
    
    .mqs-form-field label {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #333;
    }
    
    /* Custom select arrow for mobile */
    .mqs-form-field select {
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 15px center;
        background-size: 20px;
        padding-right: 45px;
    }
    
    /* ===== GRID SYSTEM FOR MOBILE ===== */
    .mqs-form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .mqs-form-field {
        min-width: auto;
        width: 100%;
    }
    
    .mqs-search-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .mqs-search-field {
        min-width: auto;
        width: 100%;
    }
    
    /* ===== BOOKING FORM SPECIFIC ===== */
    .mqs-booking-form {
        max-width: none;
    }
    
    .mqs-form-section {
        margin-bottom: 25px;
        padding: 20px;
        background: #f8f9fa;
        border-radius: 8px;
        border-left: 4px solid #0073aa;
    }
    
    .mqs-form-section h3 {
        margin: 0 0 15px 0;
        font-size: 18px;
        color: #0073aa;
    }
    
    /* Date inputs - enhanced for mobile */
    input[type="date"] {
        position: relative;
        background: white;
        cursor: pointer;
    }
    
    input[type="date"]::-webkit-calendar-picker-indicator {
        background: transparent;
        bottom: 0;
        color: transparent;
        cursor: pointer;
        height: auto;
        left: 0;
        position: absolute;
        right: 0;
        top: 0;
        width: auto;
    }
    
    /* ===== PAYMENT METHODS ===== */
    .mqs-payment-methods {
        gap: 10px;
    }
    
    .mqs-payment-method {
        padding: 20px 15px;
        border-radius: 8px;
        border: 2px solid #e1e1e1;
        background: white;
        transition: all 0.2s ease;
        cursor: pointer;
    }
    
    .mqs-payment-method:active {
        transform: scale(0.98);
    }
    
    .mqs-payment-method input[type="radio"] {
        width: 20px;
        height: 20px;
        margin-right: 15px;
    }
    
    .mqs-payment-method span {
        font-size: 16px;
        font-weight: 500;
    }
    
    /* ===== PRICING BREAKDOWN ===== */
    .mqs-pricing-breakdown {
        background: white;
        border: 1px solid #e1e1e1;
        border-radius: 8px;
        padding: 20px;
        margin: 20px 0;
    }
    
    .mqs-pricing-item {
        padding: 15px 0;
        border-bottom: 1px solid #e1e1e1;
        font-size: 16px;
    }
    
    .mqs-pricing-item:last-child {
        font-weight: bold;
        font-size: 18px;
        color: #0073aa;
        border-bottom: none;
    }
    
    /* ===== PROPERTY CARDS ===== */
    .mqs-properties-grid {
        margin: 10px;
    }
    
    .mqs-properties-grid .mqs-col-3,
    .mqs-properties-grid .mqs-col-4,
    .mqs-properties-grid .mqs-col-6 {
        width: 100%;
        padding: 10px 0;
    }
    
    .mqs-property-card {
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
        overflow: hidden;
        background: white;
    }
    
    .mqs-property-image {
        height: 200px;
        position: relative;
    }
    
    .mqs-property-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .mqs-property-content {
        padding: 20px;
    }
    
    .mqs-property-title {
        font-size: 20px;
        line-height: 1.3;
        margin-bottom: 10px;
    }
    
    .mqs-property-meta {
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 15px;
        font-size: 14px;
    }
    
    .mqs-property-price {
        align-items: center;
        margin-bottom: 20px;
    }
    
    .mqs-price-amount {
        font-size: 28px;
        font-weight: bold;
        color: #0073aa;
    }
    
    .mqs-price-period {
        font-size: 16px;
        margin-left: 5px;
    }
    
    /* ===== SEARCH FORM MOBILE ===== */
    .mqs-search-form {
        background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
        color: white;
        box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    }
    
    .mqs-search-field label {
        color: white;
        font-weight: 500;
    }
    
    .mqs-search-submit {
        margin-top: 10px;
    }
    
    .mqs-search-submit .mqs-btn {
        width: 100%;
        background: #28a745;
        color: white;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .mqs-search-submit .mqs-btn:hover {
        background: #218838;
    }
    
    /* ===== CALENDAR MOBILE ===== */
    .mqs-calendar {
        margin: 10px;
        border-radius: 12px;
        overflow: hidden;
    }
    
    .calendar-header {
        padding: 20px;
        background: #0073aa;
        color: white;
    }
    
    .calendar-header h3 {
        font-size: 18px;
        margin: 0;
        text-align: center;
    }
    
    .prev-month,
    .next-month {
        background: rgba(255,255,255,0.2);
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 6px;
        font-size: 16px;
        min-height: 44px;
    }
    
    .prev-month:active,
    .next-month:active {
        background: rgba(255,255,255,0.3);
        transform: scale(0.95);
    }
    
    .calendar-table th {
        padding: 15px 5px;
        font-size: 14px;
        background: #f8f9fa;
    }
    
    .calendar-table td {
        height: 50px;
        border: 1px solid #e1e1e1;
    }
    
    .calendar-day {
        height: 100%;
        padding: 8px 4px;
        min-height: 44px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    
    .calendar-day:active {
        transform: scale(0.95);
    }
    
    .day-number {
        font-size: 14px;
        font-weight: 500;
    }
    
    .day-price {
        font-size: 10px;
        font-weight: 600;
        color: #0073aa;
        margin-top: 2px;
    }
    
    /* ===== PROPERTY DETAILS MOBILE ===== */
    .mqs-property-details {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 10px;
    }
    
    .mqs-property-gallery {
        margin-bottom: 20px;
    }
    
    .mqs-main-image img {
        height: 250px;
        border-radius: 12px;
    }
    
    .mqs-gallery-thumbnails {
        gap: 8px;
        margin-top: 10px;
        overflow-x: auto;
        padding-bottom: 10px;
    }
    
    .mqs-gallery-thumbnails img {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    .mqs-property-info h1 {
        font-size: 24px;
        line-height: 1.3;
        margin-bottom: 15px;
    }
    
    .mqs-property-summary {
        flex-wrap: wrap;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .mqs-property-summary span {
        background: #f8f9fa;
        padding: 8px 12px;
        border-radius: 20px;
        font-size: 14px;
        color: #666;
    }
    
    .mqs-amenities-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .mqs-amenities-list li {
        padding: 12px 0;
        border-bottom: 1px solid #f1f1f1;
        font-size: 15px;
    }
    
    /* ===== BOOKING WIDGET MOBILE ===== */
    .mqs-booking-widget {
        position: static;
        margin: 20px 0;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    }
    
    .mqs-pricing {
        text-align: center;
        margin-bottom: 20px;
        padding: 20px;
        background: #f8f9fa;
        border-radius: 8px;
    }
    
    .mqs-price {
        font-size: 32px;
        font-weight: bold;
        color: #0073aa;
    }
    
    /* ===== ALERTS AND MESSAGES ===== */
    .mqs-alert {
        margin: 10px;
        padding: 20px;
        border-radius: 8px;
        font-size: 16px;
        line-height: 1.5;
    }
    
    /* ===== LOADING STATES ===== */
    .mqs-loading {
        width: 24px;
        height: 24px;
        border: 3px solid #f3f3f3;
        border-top: 3px solid #0073aa;
    }
    
    /* ===== STICKY BOOKING BUTTON ===== */
    .mqs-sticky-booking {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 15px;
        box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
        border-top: 1px solid #e1e1e1;
        z-index: 1000;
    }
    
    .mqs-sticky-booking .mqs-btn {
        width: 100%;
        background: #28a745;
        color: white;
        font-size: 18px;
        font-weight: 600;
        padding: 18px;
    }
}

/* ===== TABLET STYLES (768px - 1024px) ===== */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    
    .mqs-form-row {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .mqs-form-field {
        flex: 1;
        min-width: 200px;
    }
    
    .mqs-search-row {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .mqs-search-field {
        flex: 1;
        min-width: 150px;
    }
    
    .mqs-properties-grid .mqs-col-3,
    .mqs-properties-grid .mqs-col-4 {
        width: 50%;
    }
    
    .mqs-property-details {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .mqs-amenities-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== LARGE TABLET STYLES (1024px+) ===== */
@media screen and (min-width: 1024px) {
    
    .mqs-properties-grid .mqs-col-3 {
        width: 33.333%;
    }
    
    .mqs-properties-grid .mqs-col-4 {
        width: 25%;
    }
    
    .mqs-property-details {
        grid-template-columns: 2fr 1fr;
        gap: 40px;
    }
    
    .mqs-amenities-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .mqs-booking-widget {
        position: sticky;
        top: 20px;
    }
}

/* ===== ACCESSIBILITY ENHANCEMENTS ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mqs-btn {
        border: 2px solid currentColor;
    }
    
    .mqs-form-field input,
    .mqs-form-field select,
    .mqs-form-field textarea {
        border: 2px solid currentColor;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mqs-booking-form-container,
    .mqs-property-card,
    .mqs-booking-widget {
        background: #2d3748;
        color: white;
    }
    
    .mqs-form-field input,
    .mqs-form-field select,
    .mqs-form-field textarea {
        background: #4a5568;
        color: white;
        border-color: #718096;
    }
    
    .mqs-form-section {
        background: #1a202c;
    }
}