/*
 * AutoXpress Ultra-Compact CSS
 * Aggressive optimization for smaller laptop screens (13" and below)
 */

/* Global size reduction - but not too small for 1080p */
html,
body {
  font-size: 14px !important;
}

/* Container adjustments - remove excess padding */
.container {
  max-width: 90% !important;
  padding-left: 0.5rem !important;
  padding-right: 0.5rem !important;
}

/* Reduce all grid gutters */
.row {
  margin-left: -0.4rem !important;
  margin-right: -0.4rem !important;
}

.col,
.col-1,
.col-2,
.col-3,
.col-4,
.col-5,
.col-6,
.col-7,
.col-8,
.col-9,
.col-10,
.col-11,
.col-12,
.col-auto,
.col-lg,
.col-lg-1,
.col-lg-2,
.col-lg-3,
.col-lg-4,
.col-lg-5,
.col-lg-6,
.col-lg-7,
.col-lg-8,
.col-lg-9,
.col-lg-10,
.col-lg-11,
.col-lg-12,
.col-lg-auto,
.col-md,
.col-md-1,
.col-md-2,
.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-md-8,
.col-md-9,
.col-md-10,
.col-md-11,
.col-md-12,
.col-md-auto,
.col-sm,
.col-sm-1,
.col-sm-2,
.col-sm-3,
.col-sm-4,
.col-sm-5,
.col-sm-6,
.col-sm-7,
.col-sm-8,
.col-sm-9,
.col-sm-10,
.col-sm-11,
.col-sm-12,
.col-sm-auto,
.col-xl,
.col-xl-1,
.col-xl-2,
.col-xl-3,
.col-xl-4,
.col-xl-5,
.col-xl-6,
.col-xl-7,
.col-xl-8,
.col-xl-9,
.col-xl-10,
.col-xl-11,
.col-xl-12,
.col-xl-auto {
  padding-left: 0.4rem !important;
  padding-right: 0.4rem !important;
}

/* More compact spacing */
.mt-4,
.my-4 {
  margin-top: 1rem !important;
}

.mb-4,
.my-4 {
  margin-bottom: 1rem !important;
}

.mt-3,
.my-3 {
  margin-top: 0.6rem !important;
}

.mb-3,
.my-3 {
  margin-bottom: 0.6rem !important;
}

.p-3 {
  padding: 0.6rem !important;
}

.g-3,
.gx-3 {
  --bs-gutter-x: 0.6rem !important;
}

.g-3,
.gy-3 {
  --bs-gutter-y: 0.6rem !important;
}

/* Navbar - more compact */
.navbar {
  padding: 0.4rem 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.navbar-brand {
  font-size: 1.3rem !important;
  padding: 0.15rem 0 !important;
  letter-spacing: -0.5px !important;
}

.nav-item {
  margin: 0 0.15rem !important;
}

.nav-link {
  font-size: 0.85rem !important;
  padding: 0.4rem 0.6rem !important;
}

.nav-btn {
  padding: 0.3rem 0.7rem !important;
  font-size: 0.8rem !important;
}

/* Hero section extremely compact */
.hero-section {
  padding: 1rem 0 !important;
  margin-bottom: 1rem !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) !important;
}

.hero-section h1 {
  font-size: 1.6rem !important;
  margin-bottom: 0.5rem !important;
}

.hero-section h1::after {
  bottom: -8px !important;
  width: 60px !important;
  height: 3px !important;
}

.hero-section .lead {
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
}

.hero-section .fa-car {
  font-size: 2.5rem !important;
}

/* Card styling */
.card {
  border-radius: 8px !important;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.06) !important;
  margin-bottom: 0.7rem !important;
}

.card-header {
  padding: 0.5rem 0.75rem !important;
}

.card-body {
  padding: 0.75rem !important;
}

/* Forms and inputs */
.form-label {
  margin-bottom: 0.3rem !important;
  font-size: 0.85rem !important;
}

.form-control {
  height: auto !important;
  padding: 0.4rem 0.6rem !important;
  font-size: 0.85rem !important;
  border-radius: 6px !important;
}

.form-text {
  font-size: 0.75rem !important;
  margin-top: 0.3rem !important;
}

/* Button styling */
.btn {
  padding: 0.5rem 0.9rem !important;
  font-size: 0.9rem !important;
  border-radius: 6px !important;
}

.btn-sm {
  padding: 0.3rem 0.6rem !important;
  font-size: 0.8rem !important;
}

/* Tabs */
.nav-tabs .nav-link {
  padding: 0.4rem 0.6rem !important;
  font-size: 0.85rem !important;
}

/* Tabs scroll horizontally on overflow */
.nav-tabs {
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: thin !important;
  -ms-overflow-style: none !important;
}

.nav-tabs::-webkit-scrollbar {
  height: 3px !important;
}

.nav-tabs::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2) !important;
  border-radius: 3px !important;
}

/* Multi-field search styling */
.multi-field-search {
  gap: 0.4rem !important;
}

.multi-field-search .form-group {
  min-width: 70px !important;
}

.multi-field-search .form-control {
  height: 34px !important;
}

.multi-field-search #year-field {
  min-width: 70px !important;
  flex: 0.4 !important;
}

.search-button-container .btn {
  height: 34px !important;
  min-width: 90px !important;
  font-size: 0.8rem !important;
}

/* Autocomplete styling */
.autocomplete-suggestions {
  max-height: 160px !important;
}

.autocomplete-item {
  padding: 5px 8px !important;
  font-size: 12px !important;
}

/* Product cards */
.product-card {
  border-radius: 8px !important;
}

.product-image-container {
  height: 140px !important;
}

.product-details {
  padding: 0.8rem !important;
}

.product-title {
  font-size: 0.9rem !important;
  margin-bottom: 0.5rem !important;
  height: 3.6em !important;
}

.product-meta,
.product-details .d-flex {
  font-size: 0.85rem !important;
  margin-bottom: 0.4rem !important;
}

.product-price,
.price {
  font-size: 1.15rem !important;
}

/* Even more compact view */
.compact-view .product-image-container {
  height: 110px !important;
}

.compact-view .product-title {
  font-size: 0.85rem !important;
  height: 3em !important;
  margin-bottom: 0.4rem !important;
}

.compact-view .product-details {
  padding: 0.65rem !important;
}

.compact-view .product-meta {
  font-size: 0.8rem !important;
}

.compact-view .product-price {
  font-size: 1rem !important;
}

/* List view */
.list-view .product-card {
  max-height: 150px !important;
}

.list-view .product-image-container {
  width: 150px !important;
}

.list-view .product-title {
  max-height: 2.6em !important;
  margin-bottom: 0.3rem !important;
}

/* Favorites button */
.favorite-btn {
  top: 6px !important;
  right: 6px !important;
  width: 26px !important;
  height: 26px !important;
}

.favorite-btn i {
  font-size: 0.85rem !important;
}

/* Badges and tags */
.product-badge {
  padding: 2px 5px !important;
  font-size: 10px !important;
  border-radius: 8px !important;
}

.badge-top-right {
  top: 6px !important;
  right: 6px !important;
}

.badge-top-left {
  top: 6px !important;
  left: 6px !important;
}

.product-source {
  padding: 0.15rem 0.3rem !important;
  font-size: 0.65rem !important;
}

.product-tag {
  font-size: 0.75rem !important;
  padding: 0.15rem 0.4rem !important;
  margin-right: 0.3rem !important;
  margin-bottom: 0.3rem !important;
  border-radius: 3px !important;
}

/* Filter dropdown */
.filter-dropdown-menu.dropdown-menu.show {
  padding: 0.6rem !important;
  max-height: 75vh !important;
}

.filter-section {
  margin-bottom: 8px !important;
}

.filter-group-title {
  font-size: 0.75rem !important;
  margin-bottom: 3px !important;
  padding-bottom: 2px !important;
}

.filter-section .form-check {
  margin-bottom: 2px !important;
  padding-left: 1.5rem !important;
}

.filter-section .form-check-label {
  font-size: 0.7rem !important;
}

/* Active filters */
.active-filters {
  gap: 4px !important;
  margin: 8px 0 !important;
}

.active-filter-tag {
  padding: 2px 6px !important;
  font-size: 0.65rem !important;
  border-radius: 10px !important;
}

.active-filter-tag .filter-remove {
  margin-left: 4px !important;
  font-size: 0.6rem !important;
}

/* Loading indicators */
#search-loading,
#products-loading,
#vin-loading {
  padding: 1rem !important;
}

.spinner-border {
  width: 1.5rem !important;
  height: 1.5rem !important;
}

.loader-dots div {
  width: 4px !important;
  height: 4px !important;
  margin: 0 2px !important;
}

/* Footer */
footer {
  margin-top: 1rem !important;
  padding: 0.75rem 0 !important;
}

footer h5 {
  font-size: 0.95rem !important; 
  margin-bottom: 0.3rem !important;
}

footer p.small {
  font-size: 0.7rem !important;
  margin-bottom: 0 !important;
  line-height: 1.3 !important;
}

footer .row {
  align-items: center !important;
}

/* Make full width on small screens */
@media (max-width: 767.98px) {
  .container {
    max-width: 100% !important;
  }

  .list-view .product-card {
    flex-direction: column !important;
    max-height: none !important;
  }

  .list-view .product-image-container {
    width: 100% !important;
  }
}

/* Extra aggressive for very small screens */
@media (max-width: 1024px) {

  html,
  body {
    font-size: 12px !important;
  }

  /* Optimize scrollable tabs */
  .nav-tabs .nav-link {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.8rem !important;
  }

  /* Make product grids denser */
  .row-cols-md-3>* {
    flex: 0 0 auto !important;
    width: 33.333333% !important;
  }

  .row-cols-md-4>* {
    flex: 0 0 auto !important;
    width: 25% !important;
  }

  /* Tiny buttons on filters and sort controls */
  .dropdown .btn-sm {
    padding: 0.2rem 0.4rem !important;
    font-size: 0.7rem !important;
  }

  /* Super tiny product cards */
  .product-image-container {
    height: 90px !important;
  }

  .product-details {
    padding: 0.4rem !important;
  }

  .compact-view .product-image-container {
    height: 80px !important;
  }
}

/* Critical elements that might get too small - maintain minimum sizes */
input[type="checkbox"],
input[type="radio"] {
  min-width: 14px !important;
  min-height: 14px !important;
}

button {
  min-height: 28px !important;
}

/* Remove non-essential whitespace */
h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin-bottom: 0.5rem !important;
}

#result-container,
#vin-result-container {
  margin-top: 1rem !important;
}

/* Icon size reductions */
.fas,
.far,
.fab {
  font-size: 90% !important;
}

.fa-2x {
  font-size: 1.75em !important;
}

.fa-3x {
  font-size: 2.5em !important;
}

/* Force scrollable areas to be more compact */
.dropdown-menu {
  font-size: 0.85rem !important;
  padding: 0.25rem !important;
}

.dropdown-item {
  padding: 0.35rem 0.75rem !important;
  font-size: 0.8rem !important;
}

/* Image modal more compact */
.close-modal {
  top: 10px !important;
  right: 20px !important;
  font-size: 30px !important;
}

.modal-controls {
  bottom: 15px !important;
  right: 15px !important;
  gap: 8px !important;
}

.modal-zoom-btn {
  width: 30px !important;
  height: 30px !important;
}

.modal-instructions {
  font-size: 11px !important;
  margin-top: 12px !important;
}

/* Text truncation for long content */
.product-title {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Add scroll capability to any potentially overflowing elements */
.card {
  overflow: auto !important;
}

/* Ensures images scale properly */
img {
  max-width: 100% !important;
  height: auto !important;
}

/* Make grid denser by default */
.row.g-4 {
  --bs-gutter-x: 0.75rem !important;
  --bs-gutter-y: 0.75rem !important;
}

/* Location styling */
.location-icon {
  width: 36px !important;
  height: 36px !important;
}

.shipping-notice {
  border-left: 2px solid #28a745 !important;
}

/* Favorites notes styling */
.favorite-notes-container {
  margin-top: 0.5rem !important;
  padding-top: 0.5rem !important;
}

.favorite-notes-label {
  font-size: 0.75rem !important;
  margin-bottom: 0.2rem !important;
}

.favorite-notes {
  min-height: 50px !important;
  padding: 0.3rem !important;
  font-size: 0.75rem !important;
  border-radius: 6px !important;
}

/* Table styling */
.table th,
.table td {
  padding: 0.4rem !important;
  font-size: 0.85rem !important;
}

/* Add small scrollbars to overflowing elements */
::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05) !important;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 3px !important;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25) !important;
}