/* ========= Base ========= */
html {
  font-size: 14px;
}
@media (min-width: 768px) {
  html { font-size: 15px; }
}

/* Site-wide 66% width container */
@media (min-width: 1200px) {
  .container-xxl {
    max-width: 66%;
  }
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

html {
  position: relative;
  min-height: 100%;
}
body {
  background: #f1f3f5;
  margin: 0;
  color: #212529;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

/* ========= Top bar ========= */
.topbar {
  background: #fafafa;
  font-size: 0.8rem;
}
.lang-btn {
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ========= Header ========= */
.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #e53935;
  color: #fff;
  border-radius: 8px;
  font-size: 1.2rem;
}
.site-brand {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e53935;
  letter-spacing: -0.5px;
}
.header-link {
  color: #495057;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.header-link:hover {
  color: #e53935;
}

/* ========= Filter bar ========= */
.filter-bar .form-control,
.filter-bar .form-select {
  font-size: 0.85rem;
  border-radius: 6px;
  border-color: #dee2e6;
}
.filter-bar .form-control:focus,
.filter-bar .form-select:focus {
  border-color: #e53935;
  box-shadow: 0 0 0 2px rgba(229,57,53,.1);
}
.filter-bar .input-group-text {
  border-color: #dee2e6;
  border-radius: 6px 0 0 6px;
}
.filter-bar .btn-primary {
  background: #e53935;
  border-color: #e53935;
  font-size: 0.85rem;
  border-radius: 6px;
  white-space: nowrap;
}
.filter-bar .btn-primary:hover {
  background: #c62828;
  border-color: #c62828;
}
.btn-filter-clear {
  padding: 0.375rem 0.5rem;
  font-size: 0.78rem;
  line-height: 1;
  border-radius: 6px;
}

/* ========= Custom searchable dropdown ========= */
.custom-dropdown {
  position: relative;
}
.custom-dropdown-toggle {
  width: 100%;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.85rem;
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  appearance: none;
  line-height: 1.5;
}
.custom-dropdown-toggle:hover {
  border-color: #adb5bd;
}
.custom-dropdown-toggle:focus {
  border-color: #e53935;
  box-shadow: 0 0 0 2px rgba(229,57,53,.1);
  outline: none;
}
.custom-dropdown-label {
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.custom-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 280px;
  overflow: hidden;
  animation: ddFadeIn .15s ease;
}
.custom-dropdown-menu.show {
  display: block;
}
@keyframes ddFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.custom-dropdown-search-wrap {
  padding: 8px 8px 4px;
  border-bottom: 1px solid #f1f3f5;
}
.custom-dropdown-search {
  font-size: 0.82rem !important;
  border-radius: 6px !important;
}
.custom-dropdown-items {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.custom-dropdown-item {
  padding: 6px 12px;
  font-size: 0.84rem;
  cursor: pointer;
  transition: background .1s;
  display: flex;
  align-items: center;
}
.custom-dropdown-item:hover {
  background: #f8f9fa;
}
.custom-dropdown-item.selected {
  background: #fff5f5;
  color: #e53935;
  font-weight: 500;
}
.multi-item .form-check-input {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}
.multi-item .form-check-input:checked {
  background-color: #e53935;
  border-color: #e53935;
}

/* Condition toggle buttons (turbo.az style) */
.turbo-condition-btns {
  display: flex;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.turbo-condition-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: #495057;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0.375rem 10px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  white-space: nowrap;
  line-height: 1.5;
  text-align: center;
}
.turbo-condition-btn:not(:last-child) {
  border-right: 1px solid #dee2e6;
}
.turbo-condition-btn:hover {
  background: #f8f9fa;
  color: #212529;
}
.turbo-condition-btn.active {
  background: #e53935;
  color: #fff;
  font-weight: 600;
}

/* Disabled dropdown */
.custom-dropdown.disabled {
  opacity: 0.5;
  pointer-events: none;
}
.custom-dropdown.disabled .custom-dropdown-toggle {
  background: #f5f5f5;
  cursor: not-allowed;
}

/* ========= Listing Card ========= */
.listing-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e9ecef;
  transition: box-shadow .2s, transform .15s;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.listing-card:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,.07);
  transform: translateY(-1px);
}

.listing-img {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f8f9fa;
}
.listing-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s;
}
.listing-card:hover .listing-img img {
  transform: scale(1.03);
}
.listing-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: #ced4da;
}

.listing-store-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(229,57,53,.9);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.3;
}

/* Premium badge */
.listing-premium-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffd600 0%, #ff6f00 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  box-shadow: 0 2px 8px rgba(255,111,0,.4);
  animation: premiumPulse 2s ease-in-out infinite;
  z-index: 2;
}
@keyframes premiumPulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(255,111,0,.4); }
  50% { box-shadow: 0 2px 16px rgba(255,111,0,.7); }
}

/* Premium card highlight */
.listing-card-premium {
  border-color: #ffd600 !important;
  box-shadow: 0 0 0 1px #ffd600, 0 2px 8px rgba(255,214,0,.2);
}
.listing-card-premium:hover {
  box-shadow: 0 0 0 1px #ffd600, 0 4px 16px rgba(255,214,0,.3);
}

.listing-condition {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.3;
}
.condition-new { background: rgba(56,142,60,.9); color: #fff; }
.condition-used { background: rgba(255,160,0,.9); color: #212529; }
.condition-refurb { background: rgba(66,66,66,.85); color: #fff; }

.listing-fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s ease;
  z-index: 2;
  padding: 0;
  font-size: 0.9rem;
  color: #adb5bd;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
.listing-fav-btn:hover {
  background: rgba(255,255,255,1);
  transform: scale(1.1);
  color: #e53935;
}
.listing-fav-btn.favorited {
  color: #e53935;
}
.listing-fav-btn.favorited i::before {
  content: "\F415";
}

.detail-fav-btn {
  position: static;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.listing-body {
  padding: 8px 10px 9px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.listing-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1a1a1a;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.listing-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #343a40;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 5px;
}

.listing-meta {
  font-size: 0.75rem;
  color: #868e96;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.listing-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  color: #adb5bd;
  border-top: 1px solid #f1f3f5;
  padding-top: 5px;
  margin-top: auto;
}
.listing-footer i {
  font-size: 0.65rem;
}

/* ========= Pagination ========= */
.pagination .page-link {
  font-size: 0.85rem;
  color: #495057;
  border-color: #e9ecef;
  padding: 6px 12px;
}
.pagination .page-item.active .page-link {
  background: #e53935;
  border-color: #e53935;
  color: #fff;
}
.pagination .page-link:hover {
  color: #e53935;
  background: #fff5f5;
}

/* ========= Footer ========= */
.site-footer {
  background: #fafafa;
}

/* ========= Responsive ========= */
@media (max-width: 575.98px) {
  .listing-card {
    border-radius: 6px;
  }
  .listing-body {
    padding: 6px 8px 7px;
  }
  .listing-price {
    font-size: 1rem;
  }
  .listing-title {
    font-size: 0.82rem;
  }
  .listing-meta {
    font-size: 0.65rem;
    margin-bottom: 3px;
  }
  .listing-footer {
    font-size: 0.6rem;
    padding-top: 3px;
  }
  .listing-store-badge,
  .listing-condition {
    font-size: 0.55rem;
    padding: 1px 5px;
  }
  .listing-fav-btn {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
  }
  .filter-bar .row > [class*="col-"] {
    flex: 1 1 calc(50% - 0.5rem);
  }
}

/* ========= Active filter badges ========= */
.badge.bg-white {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 10px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ========= Store Card ========= */
.store-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e9ecef;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: box-shadow .2s, transform .15s;
}
.store-card:hover {
  box-shadow: 0 6px 24px rgba(0,0,0,.09);
  transform: translateY(-2px);
}
.store-card-logo {
  width: 100%;
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-bottom: 1px solid #f1f3f5;
  overflow: hidden;
}
.store-card-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.store-card:hover .store-card-logo img {
  transform: scale(1.04);
}
.store-card-logo i {
  font-size: 3rem;
  color: #ced4da;
}
.store-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.store-card-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #212529;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-card-desc {
  font-size: 0.78rem;
  color: #868e96;
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.store-card-info {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid #f1f3f5;
}
.store-card-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #495057;
}
.store-card-info-row i {
  font-size: 0.78rem;
  color: #e53935;
  flex-shrink: 0;
}
.store-card-info-row span,
.store-card-info-row a {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.store-card-info-row a {
  position: relative;
  z-index: 1;
}

/* ========= Store Detail Header ========= */
.store-detail-logo {
  width: 100px;
  height: 100px;
  border-radius: 14px;
  border: 1px solid #e9ecef;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.store-detail-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.store-detail-logo i {
  font-size: 2.8rem;
  color: #ced4da;
}

/* ========= Margin Sidebar Ads ========= */
/* Margin Sidebar Ads - wider for more ad space */
.margin-ad {
  position: fixed;
  top: 120px;
  width: 20vw;
  max-width: 240px;
  display: none;
  justify-content: center;
  align-items: flex-start;
  z-index: 100;
  pointer-events: none;
}
.margin-ad > * {
  pointer-events: auto;
}
.margin-ad-left {
  left: 0;
}
.margin-ad-right {
  right: 0;
}
@media (min-width: 1400px) {
  .margin-ad {
    display: flex;
    /* Ensure a usable ad column on large screens */
    min-width: 160px;
    min-height: 160px;
    width: 20vw;
    max-width: 240px;
  }
}
.sidebar-ad-wrapper {
  background: transparent;
  padding: 0;
  max-width: 240px;
  width: 100%;
}

/* ========= Hide unfilled Google AdSense auto ads ========= */
/*.google-auto-placed ins.adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
}*/

/* Part Request CTA */
.part-request-cta {
    background: linear-gradient(135deg, #fff5f5, #fff0e6);
    border: 2px solid #ffe0cc;
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    transition: all 0.3s ease;
}
.part-request-cta:hover {
    border-color: #e53935;
    box-shadow: 0 4px 15px rgba(229,57,53,0.1);
}
.cta-icon-wrap {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.btn-cta-request {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: #fff;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}
.btn-cta-request:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(229,57,53,0.3);
    color: #fff;
}

/* ========= Mobile Bottom Nav ========= */
@media (max-width: 768px) {
    .topbar {
        display: none !important;
    }

    body {
        padding-bottom: 70px !important;
    }

    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #ffffff;
        border-top: 1px solid #eeeeee;
        z-index: 9999;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    }

    .mobile-bottom-nav .nav-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: #999999;
        width: 20%;
        height: 100%;
        transition: color 0.15s ease;
    }

    .mobile-bottom-nav .nav-item.active {
        color: #e53935;
    }

    .mobile-bottom-nav .nav-item svg {
        margin-bottom: 12px;
        flex-shrink: 0;
    }

    .mobile-bottom-nav .nav-item-center {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 20%;
        height: 100%;
        text-decoration: none;
    }

    .mobile-bottom-nav .nav-item span,
    .mobile-bottom-nav .nav-item-center span {
        position: absolute;
        bottom: 8px;
        font-size: 8px;
        text-align: center;
        font-weight: 600;
        color: inherit; /* nav-item will provide color, nav-item-center defaults to #999999 via active selector below */
        white-space: nowrap;
        text-transform: uppercase;
        letter-spacing: 0px;
        width: 100%;
        transition: color 0.15s ease;
    }
    
    /* Ensure the center item handles color inheriting cleanly */
    .mobile-bottom-nav .nav-item-center span {
        color: #999999;
    }

    .mobile-bottom-nav .nav-item-center.active span,
    .mobile-bottom-nav .nav-item.active .nav-item-center-text {
        color: #e53935;
    }

    .mobile-bottom-nav .center-btn {
        width: 52px;
        height: 52px;
        background-color: #e53935;
        color: #ffffff;
        border-radius: 50%;
        display: flex;
        justify-content: center;
        align-items: center;
        transform: translateY(-20px);
        box-shadow: 0 4px 10px rgba(229, 57, 53, 0.3);
        transition: background-color 0.15s ease;
        z-index: 10000;
    }

    .mobile-bottom-nav .center-btn svg {
        margin-bottom: 0px;
    }
    
    .mobile-bottom-nav .center-btn:hover,
    .mobile-bottom-nav .center-btn:active {
        background-color: #d32f2f;
        color: #ffffff;
    }
}
