/* ==============================
   GLOBAL / LAYOUT UTILITIES
   ============================== */

/* Force black navbar background on mobile view */
@media (max-width: 991px) {
  .custom-nav {
    background-color: #000 !important; 
  }
}

/* Push dashboard modal down only on desktop */
@media (min-width: 992px) {
  #dashboardModal .modal-dialog {
    margin-top: 80px;  /* spacing below navbar */
  }
}


/* ==============================
   ICONS & BUTTONS
   ============================== */

/* Profile icon - small white version */
.profile-icon {
  width: 24px;
  height: 24px;
  filter: brightness(0) invert(1); /* turn black icon to white */
}

/* Close / Back button inside modals */
.btn-close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 1056;
  padding: 0;
}

/* Adjust button placement only on large screens */
@media (min-width: 992px) {
  .btn-close-modal {
    top: 60px; 
    right: 200px;
  }
}

/* Icon colors */
.btn-close-modal i {
  color: #fff; 
  transition: color 0.2s ease-in-out;
}
.btn-close-modal i:hover {
  color: #007e5d; /* Minadi green */
}


/* ==============================
   HERO SECTION
   ============================== */

/* Large centered image */
.zoomed-img {
  max-height: 100vh;
  width: auto;
  border-radius: 8px;
}


/* ==============================
   BRAND LOGOS
   ============================== */

/* Default logo size */
.brand-logo {
  max-height: 60px;   
  max-width: 150px;    
  object-fit: contain; 
  display: block;      
  margin: 0 auto;      
  padding: 0.5rem 0;   
}

/* Bigger on mobile */
@media (max-width: 767.98px) {
  .brand-logo {
    max-height: 80px;
    max-width: 140px;
  }
}

/* Only the main car images, not the logos */
.container.my-5 .card-img-top {
  width: 100%;          /* keep full card width */
  height: 300px;        /* increase height as desired */
  object-fit: cover;    /* crop to fill while keeping aspect ratio */
}

/* General responsive fix for card images */
.card-img-top {
  width: 100%;
  height: auto;
  object-fit: contain;  /* keeps proportions without cropping */
  max-height: 250px;    /* limit height so it doesn't overflow */
}

/* Brand logos should also resize */
.brand-logo {
  max-width: 120px;
  height: auto;
}

/* For mobile screens */
@media (max-width: 767.98px) {
  .card-img-top {
    max-height: 230px !important ;  /* smaller cars on phones */
  }
  
  .brand-logo {
    max-width: 90px;
  }

  .card-text {
    font-size: 0.9rem;   /* make text easier to read */
    line-height: 1.4;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
  }
}

/* For very small screens (<576px) */
@media (max-width: 575.98px) {
  .card-body {
    padding: 1rem;
  }

  .card-img-top {
    max-height: 180px;
  }

  .brand-logo {
    max-width: 75px;
  }
}


/* ==============================
   CARD COMPONENTS
   ============================== */

/* General card styling */
.card {
  border-radius: 1rem;
  overflow: hidden;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  opacity: 0; /* start hidden for animation */
  animation: fadeUp 0.8s ease forwards;
}

/* Animate cards one by one */
.card:nth-child(1) { animation-delay: 0.2s; }
.card:nth-child(2) { animation-delay: 0.4s; }
.card:nth-child(3) { animation-delay: 0.6s; }

/* Card body text */
.card-body p {
  text-align: left !important;
}

/* Card images */
.card img {
  object-fit: contain;
  max-height: 200px;
  padding: 1rem;
  transition: transform 0.4s ease;
}

/* Hover lift & zoom */
.card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}
.card:hover img {
  transform: scale(1.05);
}

/* Card titles */
.card-title {
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin-top: 0.5rem;
}

/* Card text */
.card-text {
  font-family: 'Montserrat', sans-serif;
  font-weight: 300;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #666;
}

/* Buttons inside cards */
.card .btn-success {
  background-color: #007e5d; /* Minadi green */
  border: none;
  font-size: 0.9rem; 
  padding: 0.3rem 0.7rem;
  border-radius: 1.5rem;
  transition: background 0.3s ease, transform 0.3s ease;
}
.card .btn-success:hover {
  background-color: #007e5cba;
  transform: scale(1.05);
}

/* Responsive card adjustments */
@media (max-width: 991.98px) {
  .card img { max-height: 150px; }
  .card-text { font-size: 0.85rem; }
}
@media (max-width: 575.98px) {
  .card { margin-bottom: 1.5rem; }
  .card img { max-height: 120px; }
}


/* ==============================
   ANIMATIONS
   ============================== */

/* Fade up effect */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}


/* ==============================
   BRAND DETAIL PAGES
   (MG, GEELY, GWM, etc.)
   ============================== */

/* Smooth zoom hover for car images */
.zoom-img {
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.zoom-img:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Image zoom effect */
.img-zoom {
  transition: transform 0.6s ease, filter 0.6s ease;
  transform-origin: center center; 
}
.img-zoom:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Global buy button style */
.btn-success {
  background-color: #007e5d; 
  border: none;
  border-radius: 25px;
  padding: 6px 18px;
  font-size: 0.9rem;
  transition: background 0.3s ease, transform 0.3s ease;
}
.btn-success:hover {
  background-color: #007e5d;
  transform: scale(1.05);
}


.img-zoom {
  width: 100%;
  max-width: 500px;   /* controls max width of all images */
  height: 350px;      /* fixed height */
  object-fit: cover;  /* crops edges to keep ratio */
  margin: 0 auto;     /* center horizontally if smaller */
  display: block;
}

/* ==============================
   DETAIL PAGE GALLERIES
   ============================== */

/* Gallery wrapper */
.gallery-img {
  width: 100%;
  height: 250px; 
  overflow: hidden;
  border-radius: 0; /* square corners */
  cursor: pointer;
}

/* Gallery image inside */
.gallery-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, filter 0.5s ease;
  border-radius: 0;
}

/* Hover zoom on gallery */
.gallery-img:hover img {
  transform: scale(1.1);
  filter: brightness(1.1);
}

/* Spacing between gallery items */
.gallery-item {
  margin-bottom: 20px;
}


/* =====================================================
   GENERAL MODAL STYLING
===================================================== */

/* Round all modal corners */
.modal-content {
  border-radius: 1rem;
}

/* General smaller modal buttons */
.modal .btn {
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  border-radius: 8px;
}

/* Extra small buttons on mobile (≤576px) */
@media (max-width: 576px) {
  .modal .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.6rem;
  }
}

/* Global override for green button */
.btn-success {
  background-color: #28a745;
  border: none;
}


/* =====================================================
   SIGNUP + LOGIN MODALS
===================================================== */

/* Make Sign Up and Login form submit buttons smaller */
#signupModal form button[type="submit"],
#loginModal form button[type="submit"] {
  width: auto !important;   /* override w-100 */
  display: block;
  margin: 0 auto;           /* center horizontally */
  padding: 6px 16px;
  font-size: 0.9rem;
  border-radius: 6px;
}


/* =====================================================
   CUSTOMIZE EV MODAL
===================================================== */

/* Push Customize EV modal down so it clears navbar */
#customizeModal .modal-dialog {
  margin-top: 100px;
}

/* Adjust spacing and size for small screens */
@media (max-width: 576px) {
  #customizeModal .modal-dialog {
    margin-top: 70px;
    max-width: 95%;
  }

  #customizeModal .modal-content {
    padding: 1rem;
  }
}

/* Scrollable modal content if content exceeds height */
#customizeModal .modal-content {
  max-height: auto;
  overflow-y: auto;
}

/* Tight max height on mobile */
@media (max-width: 576px) {
  #customizeModal .modal-content {
    max-height: calc(100vh - 100px);
  }
}

/* Push back arrow down only in mobile view */
@media (max-width: 768px) {
  #customizeModal .btn-link.position-absolute {
    top: 4.5rem !important;
  }
}

/* Color selector dots */
.color-dot {
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}


/* =====================================================
   DASHBOARD MODAL
===================================================== */

/* Reduce modal max width (smaller than .modal-lg) */
#dashboardModal .modal-dialog {
  max-width: 600px;
}

/* Style modal content */
#dashboardModal .modal-content {
  padding: 1.5rem;
  border-radius: 0.75rem;
}

/* Heading and text sizes */
#dashboardModal h4 {
  font-size: 1.4rem;
}
#dashboardModal p {
  font-size: 0.95rem;
}

/* Card tweaks */
#dashboardModal .card {
  border-radius: 0.5rem;
}
#dashboardModal .card-body h6 {
  font-size: 0.9rem;
}

/* Force uniform card images */
#dashboardModal .card-img-top {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: center;
  border-top-left-radius: 0.5rem;
  border-top-right-radius: 0.5rem;
}


/* =====================================================
   RESPONSIVE FIXES (ALL MODALS)
===================================================== */

/* Prevent modals overlapping navbar on mobile */
@media (max-width: 576px) {
  .modal-dialog {
    margin-top: 160px !important; /* push below navbar */
    margin-left: auto;
    margin-right: auto;
    max-width: 95%;               /* avoid full edge overflow */
  }

  .modal-content {
    padding: 1rem !important;
  }

  /* Dashboard-specific mobile tweaks */
  #dashboardModal .card-img-top {
    height: 140px;
  }
  #dashboardModal .card-body h6 {
    font-size: 0.8rem;
  }
  #dashboardModal h4 {
    font-size: 1.2rem;
  }
  #dashboardModal p {
    font-size: 0.85rem;
  }
}





/* =====================================================
   TEST DRIVE MODAL (Cleaned & Optimized)
===================================================== */

/* General Modal Layout */
#testDriveModal .modal-dialog {
  max-width: 800px;
  margin-top: 100px;
}

#chargeCarModal .modal-dialog {
  max-width: 800px;
  margin-top: 100px;
}

#testDriveModal .modal-content {
  background: url('/assets/Profile Icon Images/piclumen-1760346447307.png') center/cover no-repeat;
  color: #fff;
  padding: 0;
  border: none;
  border-radius: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#chargeCarModal .modal-content {
  background: url('/assets/Profile Icon Images/piclumen-1760355245267.png') center/cover no-repeat;
  color: #fff;
  padding: 0;
  border: none;
  border-radius: 0 !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* White overlay box for readability */
#testDriveModal .bg-white {
  background: rgba(255, 255, 255, 0.95);
}

/* Split modal: top = image, bottom = form */
#testDriveModal .modal-body {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

#testDriveModal .modal-header-bg {
  flex: 1;
  background: url('/assets/Profile Icon Images/piclumen-1760346447307.png') center/cover no-repeat;
  min-height: 45%;
}

#testDriveModal .modal-form-section {
  background: #fff;
  padding: 2rem 1.5rem;
  flex: 1;
}

/* Typography */
#testDriveModal h3,
#testDriveModal h5 {
  font-weight: 700;
}

#testDriveModal p {
  font-size: 0.95rem;
  color: #6c757d;
}

/* Buttons */
#testDriveModal .btn-success {
  background-color: #28a745;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 2rem;
}

.btn-secondary:disabled {
  opacity: 0.6;
}

/* =====================================================
  TESTDRIVE FORM LAYOUT
===================================================== */

#testDriveForm {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end !important;
  gap: 1rem;
}

#testDriveForm .col-md-4 {
  flex: 1 1 30% ; 
  max-width: 100px !important;
}

#testDriveForm * {
  box-sizing: border-box;
}

/* Form Fields */
#testDriveForm .col-md-4 {
  flex: 0 0 auto;
  width: 33.333%;
  padding: 0 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#testDriveForm label {
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  color: #212529;
}

#testDriveForm .form-select {
  width: 100%;
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #ced4da;
  background-color: #fff;
  color: #212529;
}

/******
/* Keep brand, model, year on same row */
#testDriveForm {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 1rem;
}

#testDriveForm .col-md-4 {
  flex: 1 1 30%;
  min-width: 150px;
}

/* Keep brand, model, year on same row */
#chargeCarForm {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 1rem;
}

#chargeCarForm .col-md-4 {
  flex: 1 1 30%;
  max-width: 150px;
}



/* Email field should take more width on desktop */
#testDriveForm #email {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* Stack all fields on mobile */
@media (max-width: 768px) {
  #testDriveForm {
    flex-direction: column;
    align-items: stretch;
  }

  #testDriveForm .col-md-4 {
    flex: 1 1 100%;
    min-width: 100%;
  }
}

/* Email field should take more width on desktop */
#chargeCarForm #email {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* Stack all fields on mobile */
@media (max-width: 768px) {
  #chargeCarForm {
    flex-direction: column;
    align-items: stretch;
  }

  #chargeCarForm .col-md-4 {
    flex: 1 1 100%;
    min-width: 100%;
  }
}

******/

/* Placeholder style */
#testDriveForm select:invalid {
  background-color: #f2f2f2;
  color: #6c757d;
}

/* Placeholder style */
#chargeCarForm select:invalid {
  background-color: #f2f2f2;
  color: #6c757d;
}


.modal-dialog {
  overflow: visible !important;
}

.modal-content {
  overflow: visible !important;
}




/* ===== CHOICES + MODAL FIXES ===== */
/* Ensure dropdowns position relative to their wrapper, not modal */
.choices {
  position: relative !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}


/* Ensure choices wrapper inherits the column width */
.modal .choices,
.choices {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

/* Make the inner input match the wrapper width exactly */
.modal .choices__inner,
.choices__inner {
  width: 100% !important;
  min-height: 44px;
  padding: 8px 12px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ced4da;
  color: #212529;
}

/* Dropdown list is positioned relative to .choices (appendTo made it inside modal-content)
   Make sure it doesn't overflow the modal and uses full available width */
.modal .choices__list--dropdown,
.choices__list--dropdown {
  position: absolute;
  left: 0 !important;
  right: 0 !important;
  width: auto !important;
  max-width: 100% !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  z-index: 2100;       /* large enough to sit above modal content */
  box-sizing: border-box;
  overflow-y: auto;
  max-height: 50vh;    /* prevents super tall dropdowns on small screens */
}

/* Ensure individual dropdown items wrap and are readable */
.choices__list--dropdown .choices__item {
  white-space: normal;
  color: #000 !important;
}

/* Mobile / tablet tweaks */
@media (max-width: 992px) {
  .modal .choices__list--dropdown,
  .choices__list--dropdown {
    max-height: 40vh;
    font-size: 0.95rem;
  }
}

@media (max-width: 576px) {
  .modal .choices__inner,
  .choices__inner {
    font-size: 0.95rem;
    min-height: 42px;
    padding: 6px 10px;
  }

  .modal .choices__list--dropdown,
  .choices__list--dropdown {
    max-height: 36vh;
  }
}

/* === FIX SELECT OVERFLOW === */
#testDriveForm,
#chargeCarForm {
  display: block; /* let Bootstrap row layout work */
}

#testDriveForm .col-md-4,
#chargeCarForm .col-md-4 {
  flex: 1 1 300px;
  max-width: 100%;
}

@media (max-width: 768px) {
  #testDriveForm .col-md-4,
  #chargeCarForm .col-md-4 {
    flex: 1 1 100%;
  }
}


/* Main form wrapper controls */
.form-wrapper {
  max-width: 900px; /* matches modal-lg look on desktop */
  margin: 0 auto; /* center horizontally */
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

/* Tablet view — reduce width */
@media (max-width: 991.98px) {
  .form-wrapper {
    max-width: 700px;
    padding: 0 1rem;
  }
}

/* Mobile view — full width inside modal */
@media (max-width: 767.98px) {
  .form-wrapper {
    max-width: 100%;
    padding: 0 0.75rem;
  }

  .form-wrapper .col-md-4 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .form-wrapper .form-select,
  .form-wrapper .form-control {
    width: 100%;
    max-width: 100%;
  }
}

#chargeCarForm {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end !important;
  gap: 1rem;
}

#chargeCarForm .col-md-4 {
  flex: 1 1 30%;
  max-width: 150px; 
}

/* Email field should take more width on desktop */
#chargeCarForm #chargeEmail {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}

/* Stack all fields on mobile */
@media (max-width: 768px) {
  #chargeCarForm {
    flex-direction: column;
    align-items: stretch;
  }

  #chargeCarForm .col-md-4 {
    flex: 1 1 100%;
    min-width: 100%;
  }
}
