/*
 * RESPONSIVE.CSS
 * ==============
 * Media queries and responsive styles for different screen sizes
 * Contains breakpoints and responsive design patterns for mobile, tablet, and desktop views
 */

/* ==========================================================================
   Base Responsive Styles
   ========================================================================== */

/* Basic responsive media query from original file */
@media only screen and (min-width: 35em) {
  /* Style adjustments for viewports that meet the condition */
}

/* High resolution devices */
@media print,
  (min-resolution: 1.25dppx),
  (min-resolution: 120dpi) {
  /* Style adjustments for high resolution devices */
}

/* ==========================================================================
   Mobile First Approach - Additional Responsive Breakpoints
   ========================================================================== */

/* Extra Small devices (phones, less than 576px) */
@media (max-width: 575.98px) {
  /* NOTE: the mobile header (navbar + search) layout is owned entirely by
     header.html's injected <style>. Don't add .navbar/.search-bar rules here —
     they conflict with the two-row header (a stray justify-content:space-between
     here once broke it). */
  .container-align-middle,
  .container-large-middle {
    padding: 10px;
  }
  
  .cart-container,
  .checkout-container {
    flex-direction: column;
  }
  
  .product-page-container {
    flex-direction: column;
  }
  
  .commerce-container {
    flex-direction: column;
  }
  
  .side-menu {
    width: 100%;
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .flash-sales-carousel {
    grid-template-columns: repeat(1, 1fr);
  }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
  .navbar {
    flex-wrap: wrap;
  }
  
  .product-row {
    flex-direction: column;
  }
  
  .home-page-category-display {
    flex-direction: column;
  }
  
  .category-container {
    width: 100%;
    margin-bottom: 20px;
  }
  
  .flash-sales-carousel {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
  .sidebar {
    width: 180px;
  }
  
  .content {
    margin-left: 200px;
  }
  
  .product-page-container {
    flex-wrap: wrap;
  }
  
  .product-page-details,
  .product-page-options {
    flex: 1;
    min-width: 300px;
  }
  
  .flash-sales-carousel {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .main-container {
    min-width: 992px;
  }
  
  .commerce-container {
    max-width: 1200px;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .main-container {
    min-width: 1200px;
  }
  
  .commerce-container {
    max-width: 1500px;
  }
}

/* ==========================================================================
   Container Responsive Styles
   ========================================================================== */

/* Responsive containers with max-widths */
.settings-container {
  max-width: 1000px;
}

.cart-container {
  max-width: 1200px;
}

.checkout-container {
  max-width: 1100px;
}

.container-align-middle {
  max-width: 1000px;
}

.container-large-middle {
  max-width: 1500px;
}

/* ==========================================================================
   Navigation Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
  /* NOTE: .navbar / .nav-logo / .search-bar mobile layout is owned by
     header.html's injected <style> (the two-row header). The old
     flex-direction:column rule here used to stack every header element
     vertically and fought the new layout — removed on purpose. */
  .cart-and-user {
    justify-content: center;
    margin-top: 10px;
  }

  .user-nav-dropdown {
    margin-right: 15px;
  }

  .navbar-secondary-list {
    flex-wrap: wrap;
  }

  .navbar-secondary-list li {
    margin-bottom: 5px;
  }
}

/* ==========================================================================
   Sidebar Responsive Styles
   ========================================================================== */

@media (max-width: 991.98px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid #e6e6e6;
  }
  
  .content {
    margin-left: 0;
  }
  
  .content-container {
    margin-left: 0;
  }
}

/* ==========================================================================
   Product Grid Responsive Styles
   ========================================================================== */

/* Mobile First - Base styles for mobile (< 576px) */
@media (max-width: 575.98px) {
  /* Favorites Page Mobile Styles */
  body {
    font-size: 14px;
  }

  .container-large-middle {
    padding: 12px;
    padding-bottom: 80px; /* Extra space at bottom for mobile navigation */
  }

  .container-large-middle h1 {
    font-size: 24px;
    margin-bottom: 16px;
    padding: 0 4px;
    font-weight: 700;
  }

  /* Product Row - Stack vertically on mobile */
  .product-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
  }

  .product-group {
    flex-direction: column;
    width: 100%;
    margin-right: 0;
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
  }

  .product-card {
    width: 100%;
    display: flex;
    flex-direction: column;
  }

  /* Product Card Header (Tags) */
  .product-card-header {
    padding: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .product-card-header .tag {
    font-size: 10px;
    padding: 4px 8px;
  }

  /* Product Image - Better mobile sizing */
  .product-card-image {
    width: 100%;
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f8f8f8;
  }

  .product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Product Card Container */
  .product-card-container {
    padding: 12px;
  }

  /* Store name and like button row */
  .product-card-store {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
  }

  .product-card-store h5 {
    font-size: 13px;
    margin: 0;
  }

  .product-page-like {
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
  }

  .product-page-like i {
    font-size: 18px;
  }

  /* Product Name */
  .product-card-name {
    margin-bottom: 8px;
  }

  .product-card-name h4 {
    font-size: 15px;
    line-height: 1.3;
    margin: 0;
    font-weight: 600;
  }

  /* Price */
  .product-card-price {
    margin-bottom: 8px;
  }

  .product-card-price h3 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
  }

  /* Rating */
  .rating.cart-item {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
  }

  .rating .star {
    font-size: 14px;
  }

  .review-count-text {
    font-size: 12px;
    margin: 0;
  }

  /* Delivery info */
  .product-card-delivery {
    margin-bottom: 8px;
  }

  .product-card-delivery p {
    font-size: 12px;
    margin: 0;
    color: #666;
  }

  /* Source/Origin */
  .product-card-source {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
  }

  .product-card-source label {
    font-size: 12px;
    margin: 0;
  }

  .product-card-source .fi {
    font-size: 16px;
  }

  /* Add to Cart Button - Full width on mobile */
  .cart-button {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 6px;
    min-height: 44px; /* iOS recommended touch target */
  }

  /* Product Links - Better touch targets */
  .product-card-name a,
  .product-card-store a {
    display: block;
    padding: 4px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Tag styling for mobile */
  .tag {
    white-space: nowrap;
  }

  /* Improve tap targets for better mobile UX */
  a, button {
    -webkit-tap-highlight-color: rgba(255, 107, 53, 0.1);
  }

  /* Empty State */
  .empty-favorites {
    padding: 40px 16px !important;
  }

  .empty-favorites i {
    font-size: 60px !important;
    margin-bottom: 16px !important;
  }

  .empty-favorites h2 {
    font-size: 20px !important;
    margin-bottom: 8px !important;
  }

  .empty-favorites p {
    font-size: 14px !important;
    margin-bottom: 24px !important;
  }

  .empty-favorites a {
    padding: 12px 24px !important;
    font-size: 14px !important;
  }

  .main-image-container {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    max-width: 100%;
  }

  /* Similar Products - Mobile */
  .similar-products-container {
    flex-direction: column;
    gap: 16px;
  }

  /* More From This Shop - Mobile */
  .product-more-products .product-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Tablet / Large Mobile (576px to 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  /* Favorites Page - 2 columns on tablet */
  .container-large-middle {
    padding: 16px;
  }

  .container-large-middle h1 {
    font-size: 28px;
    margin-bottom: 20px;
  }

  .product-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
  }

  .product-group {
    width: calc(50% - 8px);
    margin-right: 0;
    margin-bottom: 0;
    border-radius: 8px;
    overflow: hidden;
  }

  .product-card {
    width: 100%;
  }

  /* Image sizing for 2-column layout */
  .product-card-image {
    height: 220px;
  }

  /* Text adjustments */
  .product-card-name h4 {
    font-size: 14px;
  }

  .product-card-price h3 {
    font-size: 18px;
  }

  .cart-button {
    width: 100%;
    padding: 10px;
    font-size: 13px;
  }

  /* Similar Products - Tablet */
  .similar-products-container {
    flex-direction: row;
    gap: 20px;
  }

  /* More From This Shop - Tablet */
  .product-more-products .product-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* Medium Devices - Tablets/Small Desktop (768px to 1200px) */
@media (min-width: 768px) and (max-width: 1199.98px) {
  /* Favorites Page - 3 columns */
  .container-large-middle {
    padding: 20px;
  }

  .product-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }

  .product-group {
    width: calc(33.333% - 14px);
    margin-right: 0;
    margin-bottom: 0;
    border-radius: 8px;
  }

  .product-card-image {
    height: 200px;
  }

  /* More From This Shop - Medium Devices */
  .product-more-products .product-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large Devices - Desktop (1200px and up) */
@media (min-width: 1200px) {
  /* Favorites Page - 4 columns */
  .product-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }

  .product-group {
    width: calc(25% - 15px);
    margin-right: 0;
    margin-bottom: 0;
    border-radius: 8px;
  }

  .product-card-image {
    height: 220px;
  }

  /* More From This Shop - Large Devices */
  .product-more-products .product-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Form Responsive Styles
   ========================================================================== */

@media (max-width: 767.98px) {
  .appcontainer {
    width: 100%;
    max-width: 400px;
  }
  
  .app-input-row {
    flex-direction: column;
  }
  
  .app-input-group {
    flex: 1;
    margin-right: 0;
    margin-bottom: 15px;
  }
  
  .formgroupcontainer {
    width: 100%;
    max-width: 350px;
  }
  
  .seller-app-container {
    width: 100%;
    max-width: 400px;
  }
}

/* ==========================================================================
   Modal Responsive Styles
   ========================================================================== */

@media (max-width: 767.98px) {
  .modal-content {
    width: 95%;
    height: 90%;
    margin: 2.5% auto;
  }
  
  .modal-main-container {
    flex-direction: column;
  }
  
  .modal-image-container {
    width: 100%;
    height: 60%;
  }
  
  .modal-thumbnail-container {
    width: 100%;
    margin-top: 10px;
  }
  
  .add-address-modal-content,
  .delete-payment-method-modal {
    width: 95%;
    max-width: none;
  }
}

/* ==========================================================================
   Settings & User Profile Responsive Styles
   ========================================================================== */

@media (max-width: 991.98px) {
  .settings-row {
    flex-direction: column;
  }
  
  .settings-group {
    width: 100%;
    margin-bottom: 20px;
  }
  
  .settings-card {
    width: 100%;
  }
}

@media (max-width: 767.98px) {
  .payment-method {
    flex-direction: column;
  }
  
  .payment-method-row {
    flex: 1;
    margin-bottom: 15px;
  }
  
  input[type="password"],
  input[type="email"] {
    width: 100%;
    max-width: 300px;
  }
}

/* ==========================================================================
   Category & Flash Sales Responsive Styles
   ========================================================================== */

@media (max-width: 575.98px) {
  .flash-sales-header {
    flex-direction: column;
    gap: 20px;
  }
  
  .flash-sales-timer {
    align-items: center;
  }
  
  .timer-digits span {
    font-size: 24px;
  }
}

@media (max-width: 767.98px) {
  .category-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
  }
  
  .category-item img {
    width: 60px;
    height: 60px;
  }
}

/* ==========================================================================
   Review & Rating Responsive Styles
   ========================================================================== */

@media (max-width: 991.98px) {
  .customer-reviews {
    flex-direction: column;
  }
  
  .review-summary {
    min-width: auto;
    padding: 15px;
  }
  
  .review-list {
    padding: 15px;
  }
}

/* ==========================================================================
   Utility Responsive Classes
   ========================================================================== */

@media (max-width: 575.98px) {
  .hidden-xs {
    display: none !important;
  }
}

@media (max-width: 767.98px) {
  .hidden-sm {
    display: none !important;
  }
}

@media (max-width: 991.98px) {
  .hidden-md {
    display: none !important;
  }
}

@media (max-width: 1199.98px) {
  .hidden-lg {
    display: none !important;
  }
}

/* Responsive text alignment */
@media (max-width: 767.98px) {
  .text-center-mobile {
    text-align: center !important;
  }
  
  .text-left-mobile {
    text-align: left !important;
  }
}