/*
 * MotoMarket BiH — mobilni prikaz pojedinačnog oglasa V1
 * Aktivno samo do 760 px.
 */

@media (max-width: 760px) {
  body:has(.mm-listing-page) {
    overflow-x: hidden;
  }

  .mm-listing-page,
  .mm-listing-page *,
  .mm-listing-page *::before,
  .mm-listing-page *::after {
    box-sizing: border-box;
  }

  .mm-listing-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding-inline: 14px;
    overflow-x: clip;
  }

  .mm-detail-breadcrumb {
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }

  .mm-detail-breadcrumb::-webkit-scrollbar {
    display: none;
  }

  /*
   * Na desktopu su glavni sadržaj i bočna kolona dvije kolone.
   * Na mobilnom se njihovi sadržaji slažu u jedan uredan tok:
   * galerija, sažetak, opis, specifikacije, prodavač, slični oglasi.
   */
  .mm-listing-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 16px !important;
    align-items: stretch !important;
  }

  .mm-listing-main,
  .mm-listing-sidebar,
  .mm-sticky-stack {
    display: contents !important;
  }

  .mm-gallery {
    order: 1;
  }

  .mm-summary-card {
    order: 2;
  }

  .mm-description-card {
    order: 3;
  }

  .mm-listing-main > .mm-detail-card:not(.mm-description-card) {
    order: 4;
  }

  .mm-seller-card {
    order: 5;
  }

  .mm-related-section {
    order: 6;
  }

  .mm-gallery,
  .mm-gallery-stage,
  .mm-gallery-main,
  .mm-summary-card,
  .mm-detail-card,
  .mm-seller-card,
  .mm-related-section {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
    position: relative;
    inset: auto !important;
    transform: none !important;
  }

  .mm-gallery-stage {
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 4 / 3;
    overflow: hidden;
  }

  .mm-gallery-main {
    display: block;
    height: 100% !important;
    padding: 0;
  }

  .mm-gallery-main img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  .mm-gallery-arrow {
    width: 42px;
    height: 42px;
  }

  .mm-gallery-expand {
    max-width: calc(100% - 92px);
  }

  .mm-gallery-thumbs {
    display: flex !important;
    width: 100%;
    max-width: 100%;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  .mm-gallery-thumb {
    flex: 0 0 82px;
    width: 82px;
    min-width: 82px;
    scroll-snap-align: start;
  }

  .mm-summary-card,
  .mm-detail-card,
  .mm-seller-card {
    padding: 20px 16px !important;
  }

  .mm-summary-card h1,
  .mm-card-heading h2,
  .mm-related-heading h2 {
    overflow-wrap: anywhere;
  }

  .mm-summary-card h1 {
    font-size: clamp(28px, 9vw, 38px) !important;
    line-height: 1.08;
  }

  .mm-price {
    display: block;
    font-size: clamp(34px, 11vw, 48px) !important;
    line-height: 1;
    overflow-wrap: anywhere;
  }

  .mm-listing-status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
  }

  .mm-summary-specs,
  .mm-spec-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .mm-summary-spec,
  .mm-spec-item {
    min-width: 0;
  }

  .mm-summary-spec b,
  .mm-spec-item strong,
  .mm-description-text {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .mm-contact-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .mm-contact-grid > *,
  .mm-contact-grid .mm-action-wide,
  .mm-owner-panel {
    min-width: 0;
    max-width: 100%;
  }

  .mm-contact-grid .mm-action-wide,
  .mm-owner-panel {
    grid-column: 1 / -1;
    width: 100%;
  }

  .mm-owner-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 9px !important;
  }

  .mm-owner-actions > *,
  .mm-owner-actions form,
  .mm-owner-actions button,
  .mm-owner-actions a {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .mm-trust-strip {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .mm-card-heading,
  .mm-related-heading {
    align-items: flex-start !important;
    gap: 12px;
  }

  .mm-listing-meta {
    text-align: right;
    white-space: normal;
  }

  .mm-seller-head {
    align-items: center;
    min-width: 0;
  }

  .mm-seller-head > div:last-child {
    min-width: 0;
  }

  .mm-seller-head h3,
  .mm-seller-head a {
    overflow-wrap: anywhere;
  }

  .mm-seller-verification {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .mm-seller-trust {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .mm-seller-trust span {
    min-width: 0;
  }

  .mm-seller-trust small {
    overflow-wrap: anywhere;
  }

  .mm-related-heading {
    display: flex;
    flex-wrap: wrap;
  }

  .mm-related-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    max-width: 100%;
    gap: 14px !important;
  }

  .mm-related-card,
  .mm-related-card > a,
  .mm-related-photo,
  .mm-related-body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .mm-related-photo {
    aspect-ratio: 16 / 10;
  }

  .mm-related-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .mm-lightbox {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    z-index: 10000 !important;
  }

  .mm-lightbox-dialog {
    width: min(100% - 24px, 720px) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
  }

  .mm-lightbox-dialog img {
    max-width: 100%;
    max-height: calc(100dvh - 100px);
    object-fit: contain;
  }
}

@media (max-width: 430px) {
  .mm-listing-page {
    padding-inline: 10px;
  }

  .mm-summary-specs,
  .mm-spec-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .mm-card-heading {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .mm-listing-meta {
    text-align: left;
  }

  .mm-seller-trust {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 760px) {

    /* Mobile: spriječi širenje summary kartice zbog naslova */
    .mm-summary-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden !important;
    }

    .mm-summary-card h1 {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;
    }

    .mm-listing-main,
    .mm-listing-sidebar,
    .mm-sticky-stack {
        min-width: 0 !important;
        max-width: 100% !important;
    }
}