/* ===== MOBILE OPTIMIZATION & FIXES ===== */

/* Prevent horizontal scrolling */
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Fix viewport issues */
* {
  box-sizing: border-box;
}

/* Ensure all containers respect viewport width */
.container,
.hero__container,
.nav,
.section {
  max-width: 100vw;
  overflow-x: hidden;
}

/* ===== TOUCH OPTIMIZATION ===== */
/* Increase touch targets for mobile */
@media (max-width: 768px) {
  .nav__link,
  .hero__button,
  .btn,
  .contact__form-button,
  .theme-toggle,
  .nav__toggle,
  .nav__close {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Improve button spacing */
  .hero__actions {
    gap: 1rem;
  }
  
  .nav__actions {
    gap: 0.75rem;
  }
}

/* ===== TYPOGRAPHY OPTIMIZATION ===== */
@media (max-width: 768px) {
  /* Improve readability on small screens */
  body {
    font-size: 14px;
    line-height: 1.5;
  }
  
  .hero__title {
    font-size: 2rem;
    line-height: 1.2;
    word-break: break-word;
    hyphens: auto;
  }
  
  .hero__subtitle {
    font-size: 1rem;
    line-height: 1.4;
  }
  
  .section__title {
    font-size: 1.75rem;
    line-height: 1.3;
  }
  
  .section__subtitle {
    font-size: 0.95rem;
    line-height: 1.4;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
  
  .hero__title {
    font-size: 1.75rem;
  }
  
  .hero__subtitle {
    font-size: 0.9rem;
  }
  
  .section__title {
    font-size: 1.5rem;
  }
  
  .section__subtitle {
    font-size: 0.85rem;
  }
}

/* ===== LAYOUT FIXES ===== */
@media (max-width: 1024px) {
  /* Tablet layout adjustments */
  .hero__container {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
    padding: 2rem 1rem;
  }
  
  .hero__visual {
    order: -1;
  }
  
  .features__container {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .cities__grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .hours__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  /* Mobile layout adjustments */
  .hero {
    padding: 5rem 0 3rem;
    min-height: 85vh;
  }
  
  .hero__container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
  }
  
  .features__container,
  .cities__grid,
  .hours__grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .contact__container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .footer__container {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  /* Small mobile adjustments */
  .hero {
    padding: 4rem 0 2rem;
    min-height: 80vh;
  }
  
  .hero__container {
    padding: 0.75rem;
  }
  
  .section {
    padding: 2.5rem 0;
  }
  
  .container {
    padding: 0 0.75rem;
  }
}

/* ===== NAVIGATION FIXES ===== */
@media (max-width: 768px) {
  .header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
  }
  
  [data-theme="dark"] .header {
    background: rgba(17, 24, 39, 0.98);
  }
  
  .nav {
    padding: 0.75rem 0;
  }
  
  .nav__menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--bg-color);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 4rem 2rem 2rem;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    overflow-y: auto;
  }
  
  .nav__menu.show-menu {
    right: 0;
  }
  
  .nav__list {
    flex-direction: column;
    gap: 2rem;
    width: 100%;
    text-align: center;
    margin-top: 2rem;
  }
  
  .nav__link {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
    width: 100%;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
  }
  
  .nav__link:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
  }
  
  .nav__close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
  }
  
  .nav__close:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
  }
  
  .nav__toggle {
    display: flex !important;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
  }
  
  .nav__toggle:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
  }
}

/* ===== FORM OPTIMIZATION ===== */
@media (max-width: 768px) {
  .contact__form {
    padding: 1.5rem;
    border-radius: 1rem;
  }
  
  .contact__form-input,
  .contact__form-textarea {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.875rem;
    border-radius: 0.5rem;
  }
  
  .contact__form-button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    border-radius: 0.5rem;
  }
  
  .cities__search-input {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
  }
}

/* ===== CARD OPTIMIZATION ===== */
@media (max-width: 768px) {
  .feature__card,
  .city__card,
  .hours__card,
  .contact__info-card {
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 0.5rem;
  }
  
  .feature__icon,
  .city__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
  }
  
  .feature__title,
  .city__name {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  .feature__description,
  .city__info {
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

@media (max-width: 480px) {
  .feature__card,
  .city__card,
  .hours__card,
  .contact__info-card {
    padding: 1rem;
    border-radius: 0.5rem;
  }
  
  .feature__icon,
  .city__icon {
    font-size: 1.75rem;
  }
  
  .feature__title,
  .city__name {
    font-size: 1rem;
  }
  
  .feature__description,
  .city__info {
    font-size: 0.85rem;
  }
}

/* ===== HERO VISUAL OPTIMIZATION ===== */
@media (max-width: 768px) {
  .hero__image-container {
    width: 280px;
    height: 280px;
    margin: 0 auto 1rem;
  }
  
  .hero__main-visual {
    width: 120px;
    height: 120px;
    font-size: 2.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  }
  
  .floating-pill {
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
  }
  
  .hero__floating-elements {
    display: none; /* Hide on mobile for cleaner look */
  }
}

@media (max-width: 480px) {
  .hero__image-container {
    width: 220px;
    height: 220px;
  }
  
  .hero__main-visual {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 768px) {
  /* Improve focus indicators */
  .nav__link:focus,
  .hero__button:focus,
  .btn:focus,
  .contact__form-input:focus,
  .contact__form-textarea:focus,
  .theme-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
  }
  
  /* Improve contrast for better readability */
  .hero__subtitle,
  .section__subtitle {
    color: var(--text-color);
    opacity: 0.8;
  }
  
  /* Ensure minimum contrast ratios */
  .nav__link {
    color: var(--text-color);
  }
  
  .footer__link {
    color: var(--text-light);
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Reduce animations on mobile for better performance */
@media (max-width: 768px) {
  .hero__shape,
  .floating-pill {
    animation: none;
  }
  
  .hero__background {
    display: none;
  }
  
  /* Simplify hover effects */
  .feature__card:hover,
  .city__card:hover,
  .hours__card:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }
}

/* ===== LANDSCAPE ORIENTATION FIXES ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: 70vh;
    padding: 3rem 0 2rem;
  }
  
  .hero__container {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
  }
  
  .hero__visual {
    order: 1;
  }
  
  .hero__content {
    text-align: left;
  }
  
  .hero__title {
    font-size: 1.8rem;
  }
  
  .hero__features {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* ===== VERY SMALL SCREENS ===== */
@media (max-width: 320px) {
  .container {
    padding: 0 0.5rem;
  }
  
  .hero__title {
    font-size: 1.5rem;
  }
  
  .hero__subtitle {
    font-size: 0.8rem;
  }
  
  .hero__button {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
  }
  
  .section__title {
    font-size: 1.25rem;
  }
  
  .nav__menu {
    width: 95%;
    padding: 3rem 1rem 1rem;
  }
}
