/**
 * Mobile Responsive Fixes
 * Optimized for 60% of users who are mobile-first
 */

/* Base Mobile-First Approach */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px; /* Prevent zoom on iOS */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  touch-action: manipulation; /* Faster touch response */
}

/* Mobile Navigation */
@media (max-width: 768px) {
  /* Header Mobile Optimization */
  .header, .navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }

  .navbar-brand {
    font-size: 20px;
  }

  /* Hamburger Menu */
  .mobile-menu-toggle {
    display: block;
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 24px;
    cursor: pointer;
    z-index: 1001;
  }

  .mobile-menu-toggle span {
    display: block;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
  }

  /* Mobile Menu Overlay */
  .mobile-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    transform: translateX(100%);
    transition: transform 0.3s;
    overflow-y: auto;
    z-index: 999;
  }

  .mobile-menu.active {
    transform: translateX(0);
  }

  .mobile-menu-items {
    padding: 20px;
  }

  .mobile-menu-items a {
    display: block;
    padding: 16px 0;
    font-size: 18px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #e0e0e0;
  }

  /* Main Content Spacing */
  .main-content {
    padding-top: 70px; /* Account for fixed header */
    padding-left: 16px;
    padding-right: 16px;
  }

  /* Search Bar Mobile */
  .search-container {
    padding: 12px;
    background: white;
    position: sticky;
    top: 60px;
    z-index: 100;
  }

  .search-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .search-input,
  .date-input,
  .guest-input {
    width: 100%;
    padding: 14px;
    font-size: 16px; /* Prevent zoom on iOS */
    border: 1px solid #ddd;
    border-radius: 8px;
    -webkit-appearance: none;
  }

  .search-button {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
  }

  /* Date Picker Mobile */
  .date-picker-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    padding: 20px;
    transform: translateY(100%);
    transition: transform 0.3s;
    z-index: 2000;
  }

  .date-picker-mobile.active {
    transform: translateY(0);
  }

  /* Room Cards Mobile */
  .room-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .room-card {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  }

  .room-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
  }

  .room-details {
    padding: 16px;
  }

  .room-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
  }

  .room-amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
  }

  .amenity-tag {
    background: #f0f0f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
  }

  .room-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
  }

  .price-amount {
    font-size: 24px;
    font-weight: 700;
    color: #1a73e8;
  }

  .book-now-btn {
    padding: 10px 20px;
    background: #1a73e8;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
  }

  /* Booking Form Mobile */
  .booking-form {
    padding: 16px;
  }

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

  .form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
  }

  .form-input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    -webkit-appearance: none;
  }

  /* Guest Checkout Mobile */
  .checkout-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 20px 0;
  }

  .guest-checkout-btn,
  .login-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
  }

  .guest-checkout-btn {
    background: #16a34a;
    color: white;
  }

  .login-btn {
    background: white;
    color: #333;
    border: 1px solid #ddd;
  }

  /* Payment Form Mobile */
  .payment-form {
    padding: 16px;
  }

  .card-input {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 12px;
  }

  .pay-button {
    width: 100%;
    padding: 18px;
    font-size: 18px;
    font-weight: 700;
    background: #16a34a;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
  }

  /* Confirmation Page Mobile */
  .confirmation-container {
    padding: 20px;
    text-align: center;
  }

  .confirmation-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: #16a34a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .confirmation-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px;
  }

  .confirmation-number {
    font-size: 20px;
    font-weight: 600;
    color: #1a73e8;
    background: #f0f7ff;
    padding: 12px;
    border-radius: 8px;
    margin: 20px 0;
  }

  /* Mobile-Specific Touch Interactions */
  .swipeable {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }

  .swipeable-item {
    scroll-snap-align: start;
  }

  /* Bottom Navigation for Mobile */
  .bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1000;
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px;
    text-decoration: none;
    color: #666;
    font-size: 12px;
  }

  .bottom-nav-item.active {
    color: #1a73e8;
  }

  .bottom-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
  }

  /* Floating Action Button */
  .fab-book-now {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #1a73e8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(26, 115, 232, 0.4);
    z-index: 900;
    font-size: 24px;
    cursor: pointer;
  }

  /* Modal Mobile */
  .modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: flex-end;
    z-index: 3000;
  }

  .modal-content {
    width: 100%;
    background: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
  }

  /* Loading States */
  .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
  }

  @keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }

  /* Touch-Friendly Buttons */
  button, 
  .btn,
  a.button {
    min-height: 44px; /* Apple's minimum touch target */
    min-width: 44px;
  }

  /* Disable hover effects on mobile */
  @media (hover: none) {
    button:hover,
    a:hover {
      opacity: 1;
    }
  }

  /* Safe areas for iPhone X+ */
  .safe-area-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .safe-area-top {
    padding-top: env(safe-area-inset-top);
  }
}

/* Tablet Specific (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .room-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .search-form {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .search-input {
    flex: 2;
  }

  .date-input,
  .guest-input {
    flex: 1;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .header {
    padding: 8px 16px;
  }

  .main-content {
    padding-top: 50px;
  }

  .room-card {
    flex-direction: row;
  }

  .room-image {
    width: 40%;
    height: auto;
  }
}

/* Performance Optimizations */
@media (max-width: 768px) {
  /* Reduce animations on mobile */
  * {
    animation-duration: 0.2s !important;
    transition-duration: 0.2s !important;
  }

  /* Optimize images */
  img {
    content-visibility: auto;
  }

  /* Hardware acceleration for smooth scrolling */
  .scrollable {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform;
  }
}