/* Root variables for easy colour management */
:root {
  --primary-color: #005baa;
  --primary-dark: #00437f;
  --secondary-color: #f5f5f5;
  --accent-color: #ff9800;
  --text-color: #333;
}

/* Global styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  color: var(--text-color);
  background-color: #ffffff;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/*
 * Header
 *
 * The navigation has been refactored into three parts to more closely
 * resemble modern e‑commerce layouts like Swappa or Amazon while
 * retaining the brand colours. A slim top bar displays contact
 * information and links to the various portals. The main navigation
 * contains the logo, a prominent search bar and quick‑access icons for
 * favourites, comparison and car hire. A secondary sub‑navigation bar
 * lists the primary pages. Each component is responsive and uses
 * flexbox for alignment.
 */

/* Top bar showing contact info and portal links */
.top-bar {
  background-color: var(--primary-dark);
  color: #ffffff;
  font-size: 0.8rem;
  padding: 0.25rem 0;
}
.top-bar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.top-bar .contact-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.top-bar .auth-links a {
  margin-left: 1rem;
  color: #ffffff;
  font-weight: 500;
}
.top-bar .auth-links a:hover {
  color: var(--accent-color);
}

/* Main nav containing logo, search bar and quick icons */
.main-nav {
  background-color: var(--primary-color);
  color: #ffffff;
  padding: 0.5rem 0;
}
.main-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.main-nav .logo a {
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
}

/* Prominent search bar in the header */
.nav-search-hero {
  display: flex;
  flex: 1;
  margin: 0 1rem;
  align-items: stretch;
  max-width: 600px;
}
.nav-search-hero select,
.nav-search-hero input,
.nav-search-hero button {
  font-size: 0.9rem;
}
.nav-search-hero select {
  padding: 0.5rem;
  border: none;
  border-radius: 4px 0 0 4px;
  background-color: #ffffff;
  color: var(--text-color);
}
.nav-search-hero input {
  flex: 1;
  padding: 0.5rem;
  border: none;
  outline: none;
  border-left: 1px solid #ccc;
}
.nav-search-hero button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0 4px 4px 0;
  background-color: var(--accent-color);
  color: #ffffff;
  cursor: pointer;
}
.nav-search-hero button:hover {
  background-color: #e08b00;
}

/* Quick icons for favourites, comparison and hire */
.nav-icons a {
  margin-left: 1rem;
  color: #ffffff;
  font-weight: 500;
  position: relative;
}
.nav-icons a:hover {
  color: var(--accent-color);
}
.nav-icons a span {
  font-weight: 700;
}

/* Dropdown menu for Services and Financing in navigation */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: var(--primary-dark);
  min-width: 200px;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}

.dropdown-content a {
  color: #fff;
  padding: 0.5rem 1rem;
  display: block;
  white-space: nowrap;
}

.dropdown-content a:hover {
  background-color: var(--accent-color);
  color: #fff;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* Sub‑navigation listing the primary pages */
.sub-nav {
  background-color: var(--primary-dark);
  color: #ffffff;
}
.sub-nav-container {
  display: flex;
  flex-wrap: wrap;
}
.sub-nav a {
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-weight: 500;
}
.sub-nav a:hover {
  background-color: var(--accent-color);
  color: #ffffff;
}
.sub-nav a.active {
  background-color: var(--accent-color);
  color: #ffffff;
}

/* Legacy nav search styles removed because replaced by nav-search-hero */

/* Hero section */
.hero {
  position: relative;
  height: 80vh;
  background: url('images/car1.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-align: center;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 0 1rem;
}

.hero-content h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.hero-content p {
  font-size: 1.2rem;
  margin-bottom: 1.5rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-right: 0.5rem;
}

/* Links used within service and financing items */
.learn-more {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: underline;
}

.learn-more:hover {
  color: var(--accent-color);
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: #fff;
}

/* Feature section */
.features {
  padding: 3rem 0;
  text-align: center;
}

.features h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
}

.feature-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}

.feature-item {
  background-color: #fafafa;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
  flex: 1 1 250px;
  max-width: 350px;
}

.feature-item h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

/* Call to action */
.cta {
  background-color: var(--primary-color);
  color: #fff;
  padding: 3rem 0;
  text-align: center;
}

.cta-content h2 {
  margin-top: 0;
}

.cta-buttons {
  margin-top: 1.5rem;
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: #fff;
  padding: 1rem 0;
  text-align: center;
  font-size: 0.875rem;
}

.footer-content a {
  color: #ffeb3b;
}

/* Page hero for secondary pages */
.page-hero {
  background-color: var(--secondary-color);
  padding: 2.5rem 0;
  text-align: center;
}

.page-hero h1 {
  margin: 0;
  font-size: 2.5rem;
  color: var(--primary-color);
}

.page-hero p {
  margin-top: 0.5rem;
  color: #555;
}

/* Filter bar */
.filter-bar {
  background-color: #fafafa;
  padding: 1rem 0;
  border-bottom: 1px solid #eee;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.filter-form input[type='text'],
  .filter-form input[type='number'] {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 150px;
  flex: 1 1 150px;
  font-size: 0.9rem;
}

/* Select elements within the filter form */
.filter-form select {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 150px;
  flex: 1 1 150px;
  background-color: #fff;
  font-size: 0.9rem;
}

.filter-form button {
  white-space: nowrap;
}

/* Sort dropdown wrapper */
.sort-wrapper {
  margin-top: 1rem;
  text-align: right;
  flex: 1 1 auto;
}

.sort-wrapper .sort-label {
  margin-right: 0.5rem;
  font-size: 0.9rem;
  color: #555;
}

.sort-wrapper select {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Car grid */
.car-grid {
  padding: 2rem 0;
  display: grid;
  /* Display three vehicles per row on most screens */
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

/* Listings layout */
.listings-container {
  display: flex;
  gap: 1.5rem;
  padding: 2rem 0;
}

.sidebar-left,
.sidebar-right {
  flex: 0 0 200px;
  padding: 1rem;
  background-color: #fafafa;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  height: fit-content;
}

.sidebar-left h3,
.sidebar-right h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-list li {
  margin-bottom: 0.5rem;
}

.sidebar-list a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
}

.sidebar-list a:hover {
  text-decoration: underline;
}

.main-listings {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

/* Adjust filter form within main listings */
.main-listings .filter-bar {
  background-color: #fafafa;
  padding: 1rem;
  border-bottom: 1px solid #eee;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

.main-listings .filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Ensure selects and inputs occupy equal space in filter bar */
.main-listings .filter-form input[type='text'],
.main-listings .filter-form input[type='number'],
.main-listings .filter-form select {
  flex: 1 1 150px;
  min-width: 130px;
}

.main-listings .filter-form button {
  flex: 0 0 auto;
}

/* Responsive: stack sidebars under main content on smaller screens */
@media (max-width: 992px) {
  .listings-container {
    flex-direction: column;
  }
  .sidebar-left,
  .sidebar-right {
    flex: 1 1 100%;
    order: -1;
    margin-bottom: 1rem;
  }
  .sidebar-right {
    order: 1;
  }
}

.car-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease;
}

.car-card:hover {
  transform: translateY(-4px);
}

.car-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.car-card .card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.car-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

.car-card p {
  margin: 0;
  font-size: 0.9rem;
}

.car-card .price {
  font-weight: 600;
  margin-top: 0.75rem;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

.car-card .card-buttons {
  /* Place buttons in a flexible row that can wrap to multiple lines. */
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Ensure buttons within a car card take up equal space and wrap cleanly. */
.car-card .card-buttons a,
.car-card .card-buttons button {
  flex: 1 1 calc(50% - 0.25rem);
  text-align: center;
}

/* Car detail page */
.car-detail {
  padding: 2rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.car-detail .image {
  flex: 1 1 350px;
}

.car-detail .image img {
  width: 100%;
  border-radius: 8px;
}

.car-detail .info {
  flex: 1 1 350px;
}

.car-detail .info h2 {
  margin-top: 0;
  color: var(--primary-color);
}

.car-detail .info ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}

.car-detail .info ul li {
  margin-bottom: 0.5rem;
}

.car-detail .info .description {
  margin-bottom: 1rem;
}

.car-detail .info .actions {
  display: flex;
  gap: 0.75rem;
}

/* About page */
.about-content {
  padding: 2rem 0;
}

.about-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}

.about-image {
  flex: 1 1 350px;
  width: 100%;
  border-radius: 8px;
}

.about-text {
  flex: 1 1 350px;
}

.about-text h2 {
  margin-top: 0;
  color: var(--primary-color);
}

/* Contact page */
.contact-section {
  padding: 2rem 0;
}

.contact-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
}

.contact-info {
  flex: 1 1 300px;
}

.contact-form {
  flex: 1 1 300px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-form input,
.contact-form textarea {
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

/* Style select elements within contact-style forms */
.contact-form select {
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

.contact-form button {
  align-self: flex-start;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2.5rem;
  }
  .about-flex {
    flex-direction: column;
  }
  .car-detail {
    flex-direction: column;
  }
}

/* Comparison page */
.comparison-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 2rem 0;
}

.comparison-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  flex: 1 1 280px;
  padding: 1rem;
  text-align: center;
}

.comparison-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.comparison-details {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  text-align: left;
}

.comparison-details li {
  margin-bottom: 0.5rem;
}

.comparison-card button {
  margin-top: 0.5rem;
}

/* Browse page */
.browse-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1.5rem;
}

.browse-grid > div {
  flex: 1 1 200px;
}

.browse-grid h3 {
  margin-top: 0;
  color: var(--primary-color);
}

.browse-grid ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.browse-grid li {
  margin-bottom: 0.5rem;
}

.browse-grid a {
  color: var(--primary-color);
}

.browse-grid a:hover {
  text-decoration: underline;
}

/* Financing and Payment lists */
.financing-list,
.payment-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 2rem;
}

.financing-list li,
.payment-list li {
  background-color: #fafafa;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.financing-list h3,
.payment-list h3 {
  margin-top: 0;
  color: var(--primary-color);
}

/* Services page */
.services-list {
  padding: 2rem 0;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.service-item {
  background-color: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.service-item h3 {
  margin-top: 0;
  color: var(--primary-color);
}

/* Contact form containers for portals */
.contact-form-container {
  flex: 1 1 300px;
}

.contact-form-container h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--primary-color);
}

/* Phone number fields layout in sign‑up forms */
.phone-fields {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}
.phone-fields select,
.phone-fields input {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
}

/*
 * Chat widget styles appended at the end of the stylesheet. The chat
 * widget consists of floating buttons for live chat and WhatsApp as
 * well as a collapsible chat box for on‑site messaging. Each
 * component is positioned fixed to the bottom right of the viewport.
 */
.chat-button {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background-color: var(--primary-color);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-block;
  margin-left: 0.5rem;
}
.chat-button.whatsapp-button {
  right: 8rem;
  background-color: #25D366;
}

.chat-box {
  position: fixed;
  bottom: 4.5rem;
  right: 1rem;
  width: 260px;
  max-height: 350px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  display: none;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 1000;
}
.chat-box.open {
  display: flex;
}
.chat-header {
  background-color: var(--primary-color);
  color: #fff;
  padding: 0.5rem;
  font-weight: 600;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  background-color: #f9f9f9;
}
.chat-message {
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.5rem;
  background-color: #e0e0e0;
  border-radius: 4px;
  font-size: 0.85rem;
}
.chat-form {
  display: flex;
  padding: 0.5rem;
  border-top: 1px solid #ddd;
}
.chat-form input {
  flex: 1;
  padding: 0.25rem 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-right: 0.5rem;
}
.chat-form button {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Styles for the navigation search bar */
nav .nav-search {
  display: inline-flex;
  align-items: center;
  margin-left: 1rem;
}
nav .nav-search input {
  padding: 0.25rem 0.5rem;
  border-radius: 4px 0 0 4px;
  border: 1px solid #ccc;
  font-size: 0.85rem;
  outline: none;
}
nav .nav-search button {
  padding: 0.25rem 0.5rem;
  border: 1px solid #ccc;
  border-left: none;
  border-radius: 0 4px 4px 0;
  background-color: var(--accent-color);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}