/* responsive.css
   Loaded AFTER style.css. Only overrides what is needed for responsiveness. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

/* Prevent common horizontal overflow on small screens */
.header-bottom .nav {
  flex-wrap: nowrap;
  gap: 4px;
}

.header-bottom .nav-link {
  white-space: nowrap;
}

.section .section-header {
  flex-wrap: wrap;
  gap: 10px;
}

.section .section-header > * {
  min-width: 0;
}

/* Leaderboard tabs: allow wrap by default, scroll on mobile */
.leaderboard-nav {
  flex-wrap: wrap;
  gap: 8px;
}

.leaderboard-nav .nav-link {
  white-space: nowrap;
}

/* ---------------------------
   XL ≤ 1400px
   --------------------------- */
@media (max-width: 1399.98px) {
  /* Keep things fluid; no hard overrides needed yet */
}

/* ---------------------------
   LG ≤ 1200px
   --------------------------- */
@media (max-width: 1199.98px) {
  .section-hero-banners .hero-banner-carousel,
  .section-hero-banners .hero-banner,
  .section-hero-banners .hero-side-ad {
    height: auto;
  }
}

/* ---------------------------
   LG desktop 992–1199px
   Make header nav more compact so all items fit
   --------------------------- */
@media (min-width: 992px) and (max-width: 1199.98px) {
  .header-bottom .nav-link {
    padding: 6px 10px;
    font-size: var(--font-size-caption);
  }

  .header-bottom .nav-link i {
    width: 28px;
    height: 28px;
  }
}

/* ---------------------------
   MD ≤ 992px (tablets)
   --------------------------- */
@media (max-width: 991.98px) {
  /* Navbar: allow logo + actions to wrap */
  .navbar .container {
    flex-wrap: wrap;
    gap: 10px;
  }

  .header-action-buttons {
    margin-left: auto;
  }

  /* Header bottom: add comfortable side padding on touch devices */
  .header-bottom .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .section-hero-banners .hero-banner-carousel,
  .section-hero-banners .hero-banner,
  .section-hero-banners .hero-side-ad {
    height: auto;
  }

  .card-user-car-image {
    height: 170px;
  }
}

/* ---------------------------
   SM ≤ 768px (phones / small tablets)
   --------------------------- */
@media (max-width: 767.98px) {
  .navbar {
    padding: 12px 0 !important;
  }

  /* Keep logo left and action buttons on the same row */
  .navbar .container {
    flex-wrap: nowrap;
  }

  .navbar-brand img {
    width: auto !important;
    max-height: 22px;
    height: auto !important;
  }

  .header-action-buttons {
    justify-content: flex-end;
  }

  .header-bottom {
    padding-top: 10px !important;
    padding-bottom: 10px !important;
  }

  .header-bottom .nav-link {
    padding: 6px 8px;
    font-size: var(--font-size-caption);
  }

  .header-bottom .nav-link i {
    width: 28px;
    height: 28px;
  }

  .section .section-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
  }

  .section-hero-banners .hero-banner-carousel,
  .section-hero-banners .hero-banner,
  .section-hero-banners .hero-side-ad {
    height: auto;
  }

  .card-user-car-image {
    height: 160px;
  }

  .card-user-car .card-body {
    padding: 10px 12px 10px;
  }


  /* Cars filter: stack fields on small tablets/phones */
  .cars-filter {
    width: 100%;
    justify-content: flex-start;
  }

  .cars-filter-field {
    min-width: 140px;
  }

  /* Forum detail: emoji picker behaves nicely on tablets/phones */
  .forum-comment-toolbar {
    gap: 4px;
  }

  .forum-comment-emoji-picker {
    border-radius: 12px;
    padding: 4px 6px;
  }

  /* Car detail: fix right column on tablets/phones */
  .section-car-detail .row {
    align-items: flex-start;
  }

  .car-detail-right {
    height: auto;
    min-height: 0;
  }

  .car-detail-like-rating {
    width: 100%;
    justify-content: flex-start;
    align-items: flex-start;
  }

  .card-user-car-leaderboard-place-label-mobile,
  .car-detail-leaderboard-place-label-mobile {
    display: inline;
  }

  .card-user-car-leaderboard-place-label-desktop,
  .car-detail-leaderboard-place-label-desktop {
    display: none;
  }

  .car-detail-share-label {
    flex-shrink: 0;
  }

  /* Forums section: stack middle + right under title on small tablets/phones */
  .section-forums .forum-item {
    align-items: flex-start !important;
    flex-direction: column;
    gap: 6px;
  }

  .section-forums .forum-right {
    width: 100%;
    margin-left: 0 !important;
  }

  .section-forums .forum-join-btn {
    width: 100%;
  }
}

/* ---------------------------
   XS ≤ 576px (small phones)
   --------------------------- */
@media (max-width: 575.98px) {
  .navbar-brand img {
    width: min(120px, 48vw) !important;
    max-width: min(120px, 48vw);
    height: auto !important;
    max-height: 44px;
  }

  /* News lent: hide social icons on mobile */
  .section-news-lent .news-lent-social {
    display: none !important;
  }

  /* Keep the bar compact when socials are hidden */
  .section-news-lent .news-lent-bar {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .section-news-lent .news-lent-left {
    gap: 10px;
  }

  .section-news-lent .news-ticker-text {
    max-width: 260px;
  }


  /* Slightly smaller WhatsApp FAB on small phones */
  .whatsapp-channel-fab {
    right: 14px;
    bottom: 14px;
    padding: 6px 10px 6px 6px;
  }

  .whatsapp-channel-fab-icon {
    width: 36px;
    height: 36px;
  }

  .whatsapp-channel-fab-label {
    font-size: var(--font-size-small);
  }

  /* Dropdowns: avoid exceeding viewport width on edge cases */
  .header-dropdown-menu {
    width: min(360px, calc(100vw - 24px));
    max-width: min(360px, calc(100vw - 24px));
  }

  /* Leaderboard tabs: single-line scroll instead of wrapping */
  .leaderboard-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .leaderboard-nav .nav-item {
    flex: 0 0 auto;
  }

  /* Car plate: reduce risk of overflow */
  .card-user-car-plate {
    padding: 3px 8px;
  }

  .card-user-car-plate-number {
    font-size: var(--font-size-small);
    letter-spacing: 1px;
  }

  .card-user-car-favorite-btn,
  .card-user-car-badge {
    top: 8px;
  }

  .card-user-car-favorite-btn {
    right: 8px;
  }

  .card-user-car-badge {
    left: 8px;
  }

  /* Forums section: tighter paddings on phones */
  .section-forums .forum-item {
    padding: 8px 10px;
  }

  .section-forums .forum-title {
    font-size: var(--font-size-body);
  }

  /* Modal paddings on small screens */
  .site-stats-modal .modal-body {
    padding: 14px 14px 10px;
  }

  .site-stats-modal .modal-footer {
    padding: 10px 14px 14px;
  }

  /* Cars filter: full-width on small phones */
  .cars-filter {
    flex-direction: column;
    align-items: stretch !important;
  }

  .cars-filter-field,
  .cars-filter-plate {
    width: 100%;
  }

  /* Forum detail: emoji picker full-width on small phones */
  .forum-comment-toolbar {
    width: 100%;
  }

  .forum-comment-emoji-picker {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 4px;
  }

  /* Car detail: tighter layout on small phones */
  .car-detail-left,
  .car-detail-right {
    padding: 10px 12px;
  }

  .car-detail-title {
    font-size: var(--font-size-body-lg);
  }

  .car-detail-gallery-thumb {
    width: 64px;
    height: 48px;
  }

  .car-detail-like-rating {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  .car-detail-rating {
    flex-wrap: wrap;
  }

  .car-detail-share {
    flex-wrap: wrap;
  }
}

/* ---------------------------
   Very small phones ≤ 480px
   --------------------------- */
@media (max-width: 479.98px) {
  .car-detail-right {
    padding: 8px 10px;
  }

  .car-detail-like-rating {
    gap: 6px;
  }

  .section-hero-banners .hero-banner-carousel,
  .section-hero-banners .hero-banner,
  .section-hero-banners .hero-side-ad {
    height: auto;
  }

  .navbar-brand img {
    width: min(110px, 50vw) !important;
    max-width: min(110px, 50vw);
    height: auto !important;
    max-height: 40px;
  }

  .section-news-lent .news-ticker-text {
    max-width: 210px;
  }

  .card-user-car-image {
    height: 150px;
  }

  .card-user-car-title {
    font-size: var(--font-size-body);
  }
}

/* ---------------------------
   Extra small phones ≤ 360px
   --------------------------- */
@media (max-width: 359.98px) {
  .header-action-button {
    width: 36px;
    height: 36px;
    padding: 8px;
  }

  .navbar-brand img {
    width: min(100px, 52vw) !important;
    max-width: min(100px, 52vw);
    height: auto !important;
    max-height: 38px;
  }

  .section-news-lent .news-ticker-text {
    max-width: 170px;
  }

  .card-user-car-image {
    height: 140px;
  }
}

  /* Cars filter: larger padding on tablet+ */
@media (min-width: 768px) {
  .section-cars .cars-filter-card {
    padding: 16px;
  }
}

/* Login split: compact on small screens */
@media (max-width: 575.98px) {
  .login-split-wrapper {
    min-height: 0;
  }

  .login-split-left,
  .login-split-right {
    padding: 20px 16px 16px;
  }
}

