/* style.css - Allnewused Vehicle Marketplace */

/* CSS Variables */
:root {
  --primary: #0d6efd;
  --primary-dark: #0b5ed7;
  --primary-light: #e8f2ff;
  --secondary: #6c757d;
  --success: #198754;
  --danger: #dc3545;
  --warning: #ffc107;
  --warning-dark: #e0a800;
  --info: #0dcaf0;
  --light: #f8f9fa;
  --dark: #212529;
  --body-bg: #ffffff;
  --card-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.15);
  --border-radius: 0.75rem;
  --transition: all 0.3s ease;
}

/* Base Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--body-bg);
  line-height: 1.6;
  color: var(--dark);
  overflow-x: hidden;
  pointer-events: auto !important;
}

/* Layout */
.h-100 {
  height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  font-weight: 800;
}

.lead {
  font-weight: 500;
  font-size: 1.1rem;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  z-index: 10000;
  text-decoration: none;
  border-radius: 0 0 4px 4px;
  font-weight: 500;
}

.skip-link:focus {
  top: 0;
}

/* Navbar Styles */
.navbar-brand {
  font-size: 1.5rem;
  transition: var(--transition);
}

.navbar-brand:hover {
  transform: translateY(-1px);
}

.navbar-dark .navbar-nav .nav-link {
  font-weight: 500;
  transition: var(--transition);
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  margin: 0 0.25rem;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.navbar-toggler {
  border: none;
  padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
  box-shadow: none;
}

/* Search Bar */
.input-group .form-control {
  border-right: none;
}

.input-group .btn {
  border-left: none;
}

/* Buttons */
.btn {
  font-weight: 500;
  border-radius: 0.5rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  padding: 0.75rem 1.5rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border: none;
}

.btn-primary:hover,
.btn-primary:focus {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
  color: var(--dark);
  font-weight: 600;
  border: none;
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-outline-light:hover {
  color: var(--primary) !important;
}

/* Cards */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
  overflow: hidden;
  background: white;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--card-shadow-hover);
}

.card-img-top {
  height: 200px;
  object-fit: cover;
  transition: var(--transition);
}

.card:hover .card-img-top {
  transform: scale(1.05);
}

.card-title {
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.card-text {
  color: var(--secondary);
  line-height: 1.5;
}

.card-price {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

/* BADGES — FIXED: NO OVERLAP */
.badge {
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.35em 0.65em;
  border-radius: 0.5rem;
  line-height: 1;
  display: inline-block;
  min-width: 70px;
  text-align: center;
  z-index: 3;
}

/* Top Badges: URGENT & VERIFIED */
.position-absolute.top-0.start-0.badge { top: 0.75rem; left: 0.75rem; }
.position-absolute.top-0.end-0.badge   { top: 0.75rem; right: 0.75rem; }

/* Bottom Badge: VERIFIED SELLER */
.position-absolute.bottom-0.start-0.badge { bottom: 0.75rem; left: 0.75rem; }

/* Prevent overlap by adding padding to card-body */
.card-body {
  position: relative;
  padding: 1.5rem;
  padding-top: 3.5rem;     /* Space for top badges */
  padding-bottom: 3.5rem;  /* Space for bottom badge */
}

/* Ensure badges don't block content */
.card-body > *:first-child {
  margin-top: 0;
}

/* Responsive: Reduce padding on small screens */
@media (max-width: 576px) {
  .card-body {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
  .badge {
    font-size: 0.7rem;
    padding: 0.3em 0.5em;
    min-width: 60px;
  }
}

/* Badge Colors */
.badge.bg-danger { background-color: #dc3545 !important; color: white !important; }
.badge.bg-success { background-color: #198754 !important; color: white !important; }
.badge.bg-info { background-color: #0dcaf0 !important; color: var(--dark) !important; }
.badge.bg-warning { background-color: #ffc107 !important; color: var(--dark) !important; }

/* Alerts */
.alert {
  border: none;
  border-radius: var(--border-radius);
  font-weight: 500;
  box-shadow: var(--card-shadow);
}

.alert-success {
  background: rgba(25, 135, 84, 0.1);
  color: var(--success);
  border-left: 4px solid var(--success);
}

.alert-danger {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger);
  border-left: 4px solid var(--danger);
}

.alert-warning {
  background: rgba(255, 193, 7, 0.1);
  color: #856404;
  border-left: 4px solid var(--warning);
}

.alert-info {
  background: rgba(13, 202, 240, 0.1);
  color: #055160;
  border-left: 4px solid var(--info);
}

/* Forms */
.form-control, .form-select {
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid #dee2e6;
  font-weight: 400;
  transition: var(--transition);
}

.form-control:focus, .form-select:focus {
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
  border-color: var(--primary);
}

.form-label {
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: var(--dark);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--primary) 0%, #0043a8 100%);
  color: white;
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000" opacity="0.1"><polygon fill="white" points="0,1000 1000,0 1000,1000"/></svg>');
  background-size: cover;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-title {
  font-weight: 800;
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 2rem;
  opacity: 0.9;
}

/* Category Cards */
.category-card {
  text-align: center;
  padding: 2rem 1.5rem;
  border-radius: var(--border-radius);
  transition: var(--transition);
  background: white;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e9ecef;
}

.category-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--card-shadow-hover);
  color: inherit;
  text-decoration: none;
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary);
  transition: var(--transition);
}

.category-card:hover .category-icon {
  transform: scale(1.1);
}

.category-name {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.category-count {
  color: var(--secondary);
  font-size: 0.875rem;
}

/* Listing Cards */
.listing-card {
  position: relative;
  height: 100%;
}

.listing-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.listing-image {
  height: 200px;
  object-fit: cover;
  width: 100%;
}

.listing-price {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary);
}

.listing-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-location {
  color: var(--secondary);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.listing-date {
  color: var(--secondary);
  font-size: 0.75rem;
}

/* Footer */
footer {
  background: linear-gradient(135deg, var(--dark) 0%, #000 100%) !important;
}

footer a {
  transition: var(--transition);
}

footer a:hover {
  color: var(--primary) !important;
  transform: translateX(3px);
}

/* Loading Spinner */
#loader {
  transition: opacity 0.3s ease;
  background: rgba(255, 255, 255, 0.95);
  pointer-events: none;
}

/* Utility Classes */
.rounded-xl {
  border-radius: var(--border-radius);
}

.shadow-soft {
  box-shadow: var(--card-shadow);
}

.shadow-medium {
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.shadow-strong {
  box-shadow: var(--card-shadow-hover);
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, #0043a8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bg-gradient-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #0043a8 100%) !important;
}

/* Animation Classes */
.fade-in {
  animation: fadeIn 0.6s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
  from { 
    opacity: 0;
    transform: translateY(30px);
  }
  to { 
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .navbar-brand {
    font-size: 1.25rem;
  }
  
  .card-img-top {
    height: 160px;
  }
  
  .category-card {
    padding: 1.5rem 1rem;
  }
  
  .category-icon {
    font-size: 2.5rem;
  }
  
  .btn {
    padding: 0.625rem 1.25rem;
  }
}

@media (max-width: 576px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .hero-section {
    padding: 3rem 0;
  }
  
  .hero-title {
    font-size: 1.75rem;
  }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* Print Styles */
@media print {
  .navbar, footer, .btn {
    display: none !important;
  }
}

/* Hero */
.bg-primary .form-control {
  border-radius: 12px;
}

/* Featured Card */
.shadow-lg {
  box-shadow: 0 15px 35px rgba(0,0,0,0.15) !important;
}

/* Mobile CTA */
@media (max-width: 576px) {
  .display-5 { font-size: 2rem; }
  .lead { font-size: 1rem; }
  .btn-lg { padding: 0.75rem 1rem; }
}

/* Floating Button */
.position-fixed.btn-lg {
  transition: transform 0.2s;
}
.position-fixed.btn-lg:hover {
  transform: scale(1.1);
}

/* Price Slider */
#priceRange {
  accent-color: #0d6efd;
}

/* Live Time */
#liveTime {
  font-family: 'Courier New', monospace;
  font-weight: 600;
}

/* Save Button */
.save-btn {
  padding: 0.25rem !important;
}
.save-btn i {
  font-size: 1.1rem;
}

/* Location Select */
#locationInput {
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.95rem;
}
#locationInput optgroup {
  font-weight: 700;
  color: #0d6efd;
  background: #f8f9fa;
}
#locationInput option {
  padding-left: 1.5rem;
}

/* Form Enhancements */
#previewCard {
  border-left: 4px solid #0d6efd;
  font-size: 0.95rem;
}

.form-control-lg, .form-select-lg {
  border-radius: 12px;
}

.input-group-text {
  border-radius: 12px 0 0 12px;
}

/* Photo Preview */
#photoPreview img {
  height: 80px;
  width: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #0d6efd;
}

/* Detail Page */
.cursor-pointer { cursor: pointer; }
.carousel-item img { transition: transform 0.3s; }
.carousel-item img:hover { transform: scale(1.02); }

.save-btn i { transition: all 0.2s; }
.save-btn:hover i { transform: scale(1.2); }

.modal textarea { resize: none; }

/* Location Filter */
#locationFilter {
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.95rem;
}

#locationFilter optgroup {
  font-weight: 700;
  color: #0d6efd;
  background: #f8f9fa;
}

#locationFilter option {
  padding-left: 1rem;
}