/**
 * Mobile Responsive Styles for eAgents Easy Reservations
 *
 * @package EAgents_Easy_Reservations
 * @since 1.0.0
 */

/* ========================================
   MOBILE BREAKPOINTS
   ======================================== */

/* Mobile Small (320px and up) */
@media (max-width: 479px) {
    
    /* General Mobile Styles */
    .eagents-calendar-container,
    .eagents-registration-container,
    .eagents-items-container,
    .eagents-dashboard-container,
    .eagents-availability-container {
        margin: 10px 0;
        padding: 0 10px;
    }
    
    /* Form Adjustments */
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px;
        min-height: 44px;
    }
    
    .btn {
        width: 100%;
        min-height: 44px;
        font-size: 16px;
        padding: 14px 20px;
        margin-bottom: 10px;
    }
    
    /* Calendar Mobile Optimizations */
    .calendar-controls {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .item-selector,
    .view-selector {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    
    .calendar-item-select {
        width: 100%;
        min-width: auto;
        font-size: 16px;
        padding: 12px;
    }
    
    .view-selector {
        display: none; /* Hide view selector on small mobile */
    }
    
    /* Calendar Grid - Mobile Week View */
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 1px;
        font-size: 12px;
    }
    
    .calendar-header {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .calendar-day {
        min-height: 60px;
        padding: 4px;
        font-size: 12px;
    }
    
    .day-number {
        font-size: 12px;
        margin-bottom: 2px;
    }
    
    .time-slots {
        gap: 1px;
    }
    
    .time-slot {
        font-size: 9px;
        padding: 1px 2px;
    }
    
    /* Items Grid - Single Column */
    .items-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .item-card {
        padding: 15px;
    }
    
    /* Dashboard Mobile */
    .nav-tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .nav-tabs li {
        margin-right: 0;
        margin-bottom: 2px;
    }
    
    .nav-tab {
        border-radius: 4px;
        border: 1px solid #ddd;
        margin-bottom: 0;
    }
    
    .nav-tab.active {
        border-bottom: 1px solid #ddd;
    }
    
    .reservation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .detail-item {
        flex-direction: column;
        gap: 2px;
    }
    
    .reservation-actions {
        text-align: center;
    }
    
    /* Language Switcher Mobile */
    .language-list {
        justify-content: center;
    }
    
    .language-item a {
        padding: 12px 16px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Modal Adjustments */
    .booking-modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .booking-modal-header,
    .booking-modal-body {
        padding: 15px;
    }
    
    .booking-modal-close {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* Mobile Large (480px to 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    
    /* Calendar Adjustments */
    .calendar-controls {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .view-selector {
        display: flex; /* Show view selector on larger mobile */
    }
    
    .view-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .calendar-day {
        min-height: 80px;
        padding: 6px;
    }
    
    /* Items Grid - Two Columns */
    .items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* Dashboard Improvements */
    .nav-tabs {
        flex-direction: row;
        border-bottom: 2px solid #ddd;
    }
    
    .nav-tabs li {
        margin-right: 5px;
        margin-bottom: 0;
    }
    
    .nav-tab {
        border-radius: 4px 4px 0 0;
        border-bottom: none;
    }
    
    .nav-tab.active {
        border-bottom: 2px solid white;
        margin-bottom: -2px;
    }
}

/* ========================================
   TOUCH-SPECIFIC STYLES
   ======================================== */

.touch-device .calendar-day {
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0, 115, 170, 0.2);
}

.touch-device .time-slot {
    min-height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.touch-device .btn {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Touch Gestures Support */
.touch-gestures .calendar-grid {
    touch-action: pan-x;
    overflow-x: hidden;
}

.touch-gestures .calendar-day {
    touch-action: manipulation;
}

/* ========================================
   MOBILE NAVIGATION
   ======================================== */

.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #ddd;
    padding: 10px;
    z-index: 1000;
    display: none;
}

.device-mobile .mobile-nav {
    display: flex;
    justify-content: space-around;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #666;
    font-size: 12px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    min-width: 60px;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: #0073aa;
    background: #f0f8ff;
}

.mobile-nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

/* ========================================
   MOBILE CALENDAR SPECIFIC
   ======================================== */

.mobile-optimized .calendar-container {
    position: relative;
    overflow: hidden;
}

.mobile-optimized .calendar-swipe-area {
    position: relative;
    touch-action: pan-x;
}

.mobile-optimized .calendar-month-indicator {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    color: #0073aa;
    position: relative;
}

.mobile-optimized .calendar-nav-arrows {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    color: #0073aa;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-optimized .calendar-nav-arrows:hover {
    background: rgba(0, 115, 170, 0.1);
}

.mobile-optimized .calendar-nav-prev {
    left: 10px;
}

.mobile-optimized .calendar-nav-next {
    right: 10px;
}

/* Mobile Week View */
.mobile-optimized .calendar-week-view {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #ddd;
}

.mobile-optimized .calendar-week-day {
    background: white;
    min-height: 100px;
    padding: 8px 4px;
    display: flex;
    flex-direction: column;
    font-size: 12px;
}

.mobile-optimized .week-day-header {
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
    color: #0073aa;
}

.mobile-optimized .week-day-number {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
}

.mobile-optimized .week-day-slots {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mobile-optimized .week-time-slot {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 4px 2px;
    border-radius: 2px;
    text-align: center;
    font-size: 10px;
    cursor: pointer;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-optimized .week-time-slot.booked {
    background: #ffebee;
    color: #d32f2f;
    cursor: not-allowed;
}

.mobile-optimized .week-time-slot.unavailable {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* ========================================
   MOBILE FORMS
   ======================================== */

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

.mobile-optimized .form-control {
    font-size: 16px; /* Prevents zoom */
    padding: 16px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.mobile-optimized .form-control:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.mobile-optimized .checkbox-label {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f8f9fa;
}

.mobile-optimized .checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

/* ========================================
   MOBILE MODALS
   ======================================== */

.mobile-optimized .booking-modal {
    align-items: flex-end;
}

.mobile-optimized .booking-modal-content {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    margin: 0;
}

.mobile-optimized .booking-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.mobile-optimized .booking-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: #f0f0f0;
    border-radius: 50%;
}

/* ========================================
   MOBILE LOADING STATES
   ======================================== */

.mobile-optimized .loading-spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

.mobile-optimized .calendar-loading {
    padding: 40px 20px;
}

/* ========================================
   MOBILE ACCESSIBILITY
   ======================================== */

@media (max-width: 767px) {
    /* Larger touch targets for mobile */
    .btn,
    .form-control,
    .calendar-day,
    .time-slot,
    .nav-tab {
        min-height: 44px;
    }
    
    /* Better spacing for mobile */
    .form-group {
        margin-bottom: 24px;
    }
    
    /* Improved readability */
    body {
        font-size: 16px;
        line-height: 1.6;
    }
    
    /* Better contrast for mobile */
    .calendar-day.available {
        border: 2px solid #4caf50;
    }
    
    .calendar-day.booked {
        border: 2px solid #f44336;
    }
    
    .calendar-day.unavailable {
        border: 2px solid #999;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */

@media (max-width: 767px) and (orientation: landscape) {
    .mobile-optimized .calendar-day {
        min-height: 50px;
        font-size: 11px;
    }
    
    .mobile-optimized .booking-modal-content {
        max-height: 95vh;
    }
    
    .mobile-nav {
        padding: 5px;
    }
    
    .mobile-nav-item {
        padding: 4px;
        font-size: 11px;
    }
    
    .mobile-nav-icon {
        font-size: 16px;
        margin-bottom: 2px;
    }
}

/* ========================================
   HIGH DPI DISPLAYS
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .loading-spinner {
        border-width: 2px;
    }
    
    .calendar-day,
    .item-card,
    .reservation-card {
        border-width: 1px;
    }
}

/* ========================================
   DARK MODE SUPPORT (Mobile)
   ======================================== */

@media (prefers-color-scheme: dark) and (max-width: 767px) {
    .eagents-calendar-container,
    .eagents-registration-container,
    .eagents-items-container,
    .eagents-dashboard-container {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .calendar-day,
    .item-card,
    .reservation-card {
        background: #2d2d2d;
        border-color: #444;
        color: #ffffff;
    }
    
    .form-control {
        background: #2d2d2d;
        border-color: #444;
        color: #ffffff;
    }
    
    .btn-primary {
        background: #0084c7;
    }
    
    .mobile-nav {
        background: #2d2d2d;
        border-color: #444;
    }
}