/* Mobile Responsiveness Fixes for Hemline Market */

/* ============================================================ */
/* BASE MOBILE FIXES */
/* ============================================================ */

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

/* Form inputs - prevent zoom on iOS */
input, select, textarea {
  font-size: 16px !important;
}

/* ============================================================ */
/* HEADER - MOBILE */
/* ============================================================ */
@media (max-width: 768px) {
  .hm-header {
    padding: 8px 12px;
  }
  
  .hm-header-logo {
    font-size: 18px;
  }
  
  .hm-header-icons {
    gap: 4px;
  }
  
  .hm-header-icon {
    padding: 8px;
  }
}

/* Mobile header - hide search bar, show search icon */
@media (max-width: 640px) {
  /* Hide search bar on mobile */
  .hm-header-search {
    display: none !important;
  }
  
  /* Show search icon on mobile */
  .hm-search-link {
    display: flex !important;
  }
  
  .right {
    gap: 6px;
  }
  
  .hm-icon svg {
    width: 24px;
    height: 24px;
  }
  
  .hm-menu-icon svg {
    width: 24px;
    height: 24px;
  }
  
  .hm-btn-primary {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Hero banner on mobile */
  .hero-banner-desc {
    font-size: 11px;
    margin-bottom: 10px;
  }
  
  .hero-banner-cta {
    gap: 6px;
  }
  
  .hero-banner-btn {
    padding: 8px 10px;
    font-size: 10px;
    text-align: center;
    line-height: 1.3;
  }
}

/* ============================================================ */
/* BROWSE / CATALOG - MOBILE */
/* ============================================================ */
@media (max-width: 640px) {
  /* Filters */
  .filters-bar {
    flex-direction: column;
    gap: 8px;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-group select {
    width: 100%;
  }
  
  /* Grid - DO NOT override listing card styles */
  .listings-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .listings-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================================ */
/* LISTING DETAIL - MOBILE */
/* ============================================================ */
@media (max-width: 768px) {
  .listing-detail {
    flex-direction: column;
  }
  
  .listing-images {
    width: 100%;
  }
  
  .listing-info {
    width: 100%;
    padding: 16px;
  }
  
  .listing-main-image {
    aspect-ratio: 1 / 1;
  }
  
  .listing-thumbs {
    gap: 6px;
  }
  
  /* These are the small thumbnail previews on listing detail page */
  .listing-thumbs .listing-thumb {
    width: 60px;
    height: 60px;
  }
  
  /* Fix listing CARD images on mobile grids - portrait ratio */
  .listing-card .listing-thumb {
    aspect-ratio: 3 / 4;
  }
  
  .listing-card .listing-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ============================================================ */
/* CART / CHECKOUT - MOBILE */
/* ============================================================ */
@media (max-width: 640px) {
  .cart-item {
    flex-direction: column;
    gap: 12px;
  }
  
  .cart-item-image {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  
  .cart-summary {
    position: static;
    width: 100%;
  }
  
  .checkout-form {
    padding: 12px;
  }
  
  .checkout-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }
}

/* ============================================================ */
/* ORDERS / SALES - MOBILE */
/* ============================================================ */
@media (max-width: 768px) {
  .order-card {
    flex-direction: column;
  }
  
  .order-image {
    width: 100%;
    aspect-ratio: 16 / 9;
  }
  
  .order-details {
    width: 100%;
  }
  
  /* Order detail page */
  .grid {
    grid-template-columns: 1fr !important;
  }
  
  .pageHeader {
    flex-direction: column;
    gap: 8px;
  }
}

/* ============================================================ */
/* ACCOUNT / PROFILE - MOBILE */
/* ============================================================ */
@media (max-width: 640px) {
  .account-grid {
    grid-template-columns: 1fr !important;
  }
  
  .profile-header {
    flex-direction: column;
    text-align: center;
  }
  
  .profile-avatar {
    margin: 0 auto;
  }
  
  .account-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  
  .account-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

/* ============================================================ */
/* MESSAGES - MOBILE */
/* ============================================================ */
@media (max-width: 768px) {
  .messages-layout {
    flex-direction: column;
  }
  
  .messages-sidebar {
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
  }
  
  .messages-main {
    width: 100%;
    height: calc(100vh - 300px);
  }
  
  .message-input-row {
    padding: 8px;
  }
  
  .message-input {
    font-size: 16px;
  }
}

/* ============================================================ */
/* THREADTALK - MOBILE */
/* ============================================================ */
@media (max-width: 640px) {
  .tt-wrap {
    padding: 0 8px;
    margin: 12px auto;
  }
  
  .tt-hero {
    padding: 12px;
    border-radius: 12px;
  }
  
  .tt-hero h1 {
    font-size: 24px;
  }
  
  .composer {
    padding: 12px;
  }
  
  .composer .row {
    flex-direction: column;
    gap: 8px;
  }
  
  #composeCategory,
  #composeText {
    width: 100% !important;
  }
  
  .card {
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
  }
  
  .topics-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }
  
  .topic {
    padding: 12px;
  }
  
  /* YouTube embeds full width on mobile */
  .tt-youtube-embed {
    margin-left: -12px;
    margin-right: -12px;
    border-radius: 0;
  }
}

/* ============================================================ */
/* NOTIFICATIONS - MOBILE */
/* ============================================================ */
@media (max-width: 640px) {
  .notification-item {
    padding: 12px;
  }
  
  .notification-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .notification-content {
    font-size: 14px;
  }
}

/* ============================================================ */
/* FOOTER - MOBILE */
/* ============================================================ */
@media (max-width: 640px) {
  .hm-footer {
    padding: 16px 12px;
  }
  
  .hm-footer-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 16px;
  }
  
  .hm-footer-link {
    font-size: 13px;
  }
}

/* ============================================================ */
/* UTILITY CLASSES */
/* ============================================================ */
.hide-mobile {
  display: block;
}
.show-mobile {
  display: none;
}

@media (max-width: 640px) {
  .hide-mobile {
    display: none !important;
  }
  .show-mobile {
    display: block !important;
  }
}

/* Safe area padding for notched phones */
@supports (padding-top: env(safe-area-inset-top)) {
  .hm-header {
    padding-top: max(8px, env(safe-area-inset-top));
  }
  
  .hm-footer {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}
