/* General Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "IBM Plex Sans", sans-serif;
  background-color: #f7f7f7; /* Light gray background, consistent with order page */
  color: #333;
  line-height: 1.6;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "IBM Plex Sans", sans-serif;
}

.container {
  width: 95%;
  max-width: 1200px;
  margin: 12px auto;
  padding: 0 10px;
}

/* Header Styles (Green, White, Red Scheme) - Adapted from order_aircon_ref.html */
header {
  background-color: #2e8b57; /* Green, consistent with order page */
  color: white;
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05); /* Consistent shadow */
}

header .container {
  display: flex;
  flex-direction: column; /* Stack logo and nav vertically */
  align-items: center; /* Center content horizontally */
  padding: 0 20px;
  margin: 0 auto; /* Override container margin for header */
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center; /* Center content horizontally */
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
  margin-bottom: 1rem; /* Space between logo and nav */
}

.header-top img {
  height: 60px; /* Adjust as needed */
  margin-right: 1rem;
}

.header-top .logo-text {
  /* Changed from .logo to .logo-text to avoid conflict */
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.5rem; /* Adjust for responsiveness */
  color: #ffffff; /* Changed logo text color to white for contrast */
  text-align: center; /* Center text on smaller screens */
  font-weight: 600; /* Added font-weight */
}

.hero-header {
  background-color: #2e8b57;
  padding: 1.5rem 1rem 2.5rem;
  color: white;
}

.hero-top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: space-between;
}

.hero-logo {
  height: 64px;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.hero-logo:hover {
  transform: scale(1.05);
}

.hero-search-container {
  flex: 1;
  position: relative;
  max-width: 700px;
}

.hero-search-container input {
  width: 100%;
  height: 46px;
  padding: 0 3.5rem 0 1.25rem;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  outline: none;
}

.hero-search-container button {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: #22c55e;
  border: none;
  height: 34px;
  width: 42px;
  border-radius: 4px;
  cursor: pointer;
}

.hero-search-container i {
  color: white;
}

.hero-cart {
  position: relative;
  cursor: pointer;
}

.hero-cart .cart-icon {
  width: 32px;
  height: 32px;
}

.hero-cart .cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: red;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  padding: 2px 6px;
}

.hero-text {
  text-align: center;
  margin-top: 2.5rem;
}

.hero-text h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #111827;
}

.hero-text p {
  margin-top: 0.5rem;
  color: #374151;
}


#navbar ul {
  display: flex;
  justify-content: center;
  gap: 2rem;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-direction: row; /* Always side-by-side */
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

#navbar .nav-link {
  color: #ffffff; /* Changed nav link color to white for contrast */
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  text-decoration: none; /* Ensure no underline */
  font-family: "IBM Plex Sans", sans-serif;
}

#navbar .nav-link:hover,
#navbar .nav-link.active {
  background-color: rgba(
    255,
    255,
    255,
    0.2
  ); /* Light white background on hover */
  color: #ffffff; /* Keep text white */
}

/* Cart Icon specific styles for the header-right section */
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 1rem; /* Space below nav links */
}

.header-right .cart-icon-wrapper {
  /* New wrapper for cart icon and badge */
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-right .cart-icon-wrapper .cart-icon {
  font-size: 1.5rem; /* Font Awesome icon size */
  color: white;
  transition: transform 0.2s ease;
}

.header-right .cart-icon-wrapper .cart-icon:hover {
  transform: scale(1.1);
}

.header-right .cart-icon-wrapper .cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #ff5252; /* Red */
  color: white;
  font-size: 0.7rem;
  font-weight: bold;
  border-radius: 50%;
  padding: 3px 6px;
  min-width: 20px;
  text-align: center;
  line-height: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Main Content Layout */
.cart-page-content {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.cart-items-section {
  flex: 3; /* Takes more space */
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  min-width: 300px; /* Minimum width for this section */
}

.order-summary-section {
  flex: 1; /* Takes less space */
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  min-width: 280px; /* Minimum width for this section */
}

/* Cart Items Section */
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.cart-header h2 {
  font-size: 1.2rem;
  color: #333;
}

.cart-header .select-all {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: #555;
}

.cart-header .delete-btn {
  color: #ff5252; /* Red */
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 0.3s ease;
}
.cart-header .delete-btn:hover {
  color: #bd2130;
}

.cart-item-list {
  list-style: none;
  padding: 0;
}

.cart-item {
  display: flex;
  align-items: flex-start; /* Align items to the top */
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid #eee;
  /* Removed position: relative; as checkbox is no longer absolutely positioned */
}

.cart-item:last-child {
  border-bottom: none;
}

/* Styles for cart-item-checkbox */
.cart-item-checkbox {
  margin-top: 10px; /* Align with the top of the item */
  margin-right: 15px; /* Space between checkbox and thumbnail */
  transform: scale(1.2); /* Slightly larger checkbox */
}

.cart-item-thumbnail {
  width: 100px; /* Increased size for better visibility */
  height: 100px; /* Increased size for better visibility */
  object-fit: contain; /* Ensure full image is visible */
  border-radius: 4px;
  flex-shrink: 0; /* Prevent shrinking */
}

.cart-item-details-wrapper {
  /* New wrapper for all details to the right of image */
  flex-grow: 1;
  display: flex;
  justify-content: space-between; /* Space out info and controls */
  align-items: flex-start; /* Align content to the top */
}

.cart-item-info {
  /* Name, Brand/HP, Price */
  display: flex;
  flex-direction: column;
  flex-grow: 1; /* Allow info to take available space */
  margin-right: 15px; /* Space between info and controls */
}

.cart-item-info h3 {
  font-size: 1.1rem; /* Slightly larger for prominence */
  color: #333;
  margin-bottom: 5px;
  font-weight: 600;
}

.cart-item-info p {
  /* This targets the brand/HP line */
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 8px;
}

.cart-item-info .price {
  font-size: 1.1rem; /* Consistent with h3 */
  font-weight: 700;
  color: #dc3545; /* Red for price */
}

.cart-item-controls {
  /* Quantity, Delete */
  display: flex;
  flex-direction: column;
  align-items: flex-end; /* Align controls to the right */
  gap: 10px; /* Space between quantity and delete */
  flex-shrink: 0; /* Prevent shrinking */
}

.quantity-control {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.quantity-control button {
  background-color: #f0f0f0;
  border: none;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 1rem;
  color: #555;
  transition: background-color 0.2s ease;
}

.quantity-control button:hover {
  background-color: #e0e0e0;
}

.quantity-control input {
  width: 40px;
  text-align: center;
  border: none;
  outline: none;
  font-size: 0.95rem;
  -moz-appearance: textfield; /* Hide arrows for Firefox */
}
/* Hide arrows for Chrome, Safari, Edge */
.quantity-control input::-webkit-outer-spin-button,
.quantity-control input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-item-remove {
  color: #777;
  cursor: pointer;
  font-size: 1.1rem; /* Slightly larger trash icon */
  transition: color 0.3s ease;
  padding: 5px; /* Add padding for easier click */
}
.cart-item-remove:hover {
  color: #333;
}

/* Order Summary Section */
.order-summary-section h3 {
  font-size: 1.2rem;
  margin-bottom: 15px;
  color: #333;
}

.order-summary-section .location {
  font-size: 0.9rem;
  color: #777;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.summary-row .label {
  color: #555;
}

.summary-row .value {
  font-weight: 500;
  color: #333;
}

.summary-row.total {
  border-top: 1px solid #eee;
  padding-top: 15px;
  margin-top: 15px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #dc3545; /* Red */
}
.summary-row.total .value {
  color: #dc3545; /* Red */
}

.vat-info {
  font-size: 0.8rem;
  color: #777;
  text-align: right;
  margin-top: -5px;
  margin-bottom: 20px;
}

.proceed-to-checkout-btn {
  background-color: #dc3545; /* Red */
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  width: 100%;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center; /* Center the text inside the button */
  text-decoration: none; /* Remove underline */
  transition: background-color 0.3s ease;
}

.proceed-to-checkout-btn:hover {
  background-color: #bd2130; /* Darker Red */
}

/* Custom Message Box Styles */
#customMessageBox {
  background-color: rgba(0, 0, 0, 0.5); /* Dark overlay */
}
#customMessageBox > div {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
#messageBoxClose {
  background-color: #2e8b57; /* Green */
  color: white;
}
#messageBoxClose:hover {
  background-color: #218838; /* Darker Green */
}
#messageBoxCancel {
  background-color: #f0f0f0;
  color: #555;
}
#messageBoxCancel:hover {
  background-color: #e0e0e0;
}

/* Responsive Adjustments */
@media (min-width: 768px) {
  header .container {
    flex-direction: column; /* Keep logo and nav stacked */
    align-items: center;
  }
  .header-top {
    justify-content: center; /* Center content horizontally */
    text-align: center; /* Center text */
  }
  .header-top .logo-text {
    font-size: 2rem;
  }
  #navbar ul {
    gap: 2rem; /* Maintain gap */
    margin-top: 1rem; /* Space below header-top */
  }
}

@media (max-width: 767px) {
  .header-top {
    flex-direction: column;
    text-align: center;
  }

  .header-top img {
    margin-right: 0;
    margin-bottom: 0.5rem;
  }

  #navbar ul {
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap; /* Allow wrapping if space is tight */
  }

  #navbar .nav-link {
    width: auto; /* Allow links to size naturally */
    margin: 0; /* Remove auto margins that might center them individually */
  }

  .cart-page-content {
    flex-direction: column; /* Stack sections vertically */
  }

  .cart-items-section,
  .order-summary-section {
    flex: none; /* Remove flex grow/shrink */
    width: 100%; /* Take full width */
    min-width: unset; /* Remove min-width constraint */
  }

  .proceed-to-checkout-btn {
    padding: 10px 18px;
    font-size: 1rem;
  }

  /* For larger mobile/tablet screens, keep side-by-side but allow wrapping */
  .cart-item-details-wrapper {
    flex-direction: row; /* Keep info and controls side-by-side */
    flex-wrap: wrap; /* Allow wrapping if space is tight */
    align-items: flex-start;
    justify-content: space-between;
  }
  .cart-item-info {
    margin-right: 15px; /* Maintain space */
    margin-bottom: 0;
  }
  .cart-item-controls {
    align-items: flex-end; /* Align controls to the right */
  }
}

/* Mobile-specific styles (max-width: 480px) */
@media (max-width: 480px) {
  .cart-item {
    flex-direction: column; /* Stack item details vertically */
    align-items: flex-start; /* Align content to the left */
    text-align: left; /* Align text to the left */
    padding-top: 15px; /* Add some top padding */
  }
  .cart-item-checkbox {
    margin-bottom: 10px; /* Space below checkbox */
    margin-right: 0; /* Remove right margin */
    align-self: flex-start; /* Align checkbox to the left */
  }
  .cart-item-thumbnail {
    margin-bottom: 10px;
    align-self: center; /* Center the image */
  }
  .cart-item-details-wrapper {
    flex-direction: column; /* Stack info and controls */
    align-items: center; /* Center content horizontally */
    text-align: center; /* Center text */
    width: 100%; /* Take full width */
  }
  .cart-item-info {
    margin-right: 0;
    margin-bottom: 10px;
    width: 100%; /* Take full width */
    align-items: center; /* Center content within info block */
  }
  .cart-item-info h3,
  .cart-item-info p,
  .cart-item-info .price {
    text-align: center; /* Center text within info block */
  }
  .cart-item-controls {
    flex-direction: column; /* Stack quantity and trash vertically */
    align-items: center; /* Center stacked items horizontally */
    width: 100%; /* Take full width */
    gap: 10px; /* Space between quantity and delete */
    margin-top: 10px; /* Space above controls */
  }
  .quantity-control {
    width: auto; /* Allow quantity control to size naturally */
    justify-content: center; /* Center quantity control buttons */
  }
  .cart-item-remove {
    margin-top: 0;
    margin-left: 0;
  }

  .proceed-to-checkout-btn {
    padding: 8px 15px;
    font-size: 0.9rem;
  }

  /* Base stays mobile-friendly */
  .checkout-hero {
    text-align: center;
    color: #ffffff;
    padding: 1.75rem 1rem 1.25rem;
  }

  /* Desktop enhancement */
  @media (min-width: 768px) {
    .checkout-hero {
      padding: 2.5rem 2rem 2rem;
    }

    .checkout-hero-inner {
      max-width: 1100px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .checkout-title {
      font-size: 2.25rem;
      letter-spacing: 0.6px;
    }

    .checkout-subtitle {
      font-size: 1.05rem;
      max-width: 640px;
      margin-top: 0.5rem;
      opacity: 0.9;
    }
    .checkout-hero::after {
      content: "";
      display: block;
      width: 72px;
      height: 3px;
      background: rgba(255, 255, 255, 0.35);
      border-radius: 999px;
      margin: 1rem auto 0;
    }
  }
}

/* =========================
   FINAL MOBILE HEADER — CLEAN & FIXED
   ========================= */
@media (max-width: 600px) {
  .hero-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;

    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  /* LOGO */
  .hero-top .logo-link {
    flex: 0 0 auto;
  }

  .hero-logo {
    height: 38px;
  }

  /* SEARCH */
  .hero-top .search-container {
    flex: 1 1 160px;      /* can grow, but has a base */
    max-width: 180px;
    min-width: 120px;
    margin: 0 0.5rem;
  }

  .hero-top .search-container input {
    height: 36px;
    font-size: 0.8rem;
    padding-left: 0.75rem;
    padding-right: 2.25rem;
  }

  /* CART */
  .hero-top .cart-container {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
  }

  .hero-top .cart-icon {
    width: 28px;
    height: 28px;
  }

  .hero-top .cart-badge {
    top: -6px;
    right: -6px;
    font-size: 0.65rem;
  }
}

#cartIconTrigger {
  position: relative;          /* NOT fixed on desktop */
  width: auto;
  height: auto;
  background: transparent;
  border-radius: 0;
  box-shadow: none;

  display: flex;
  align-items: center;
  justify-content: center;
}

/* Desktop icon size */
#cartIconTrigger .cart-icon-img {
  width: 22px;
  height: 22px;
  filter: none;                /* keep original color on desktop */
}

/* Desktop badge */
#cartIconTrigger .cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;

  min-width: 16px;
  height: 16px;

  font-size: 0.65rem;
  font-weight: 700;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  background: #ef4444;
  color: #ffffff;
}

/* =========================
   MOBILE FLOATING CART (FINAL FIX)
   ========================= */
@media (max-width: 768px) {
  #cartIconTrigger {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 99999;

    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #16a34a;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  }

  /* ICON — perfectly centered */
  #cartIconTrigger .cart-icon-img {
    width: 26px;
    height: 26px;
    object-fit: contain;

    filter: brightness(0) invert(1); /* white icon */
    display: block;
  }

  /* BADGE — pinned to top-right of circle */
  #cartIconTrigger .cart-badge {
    position: absolute;
    top: -4px;
    right: -4px;

    min-width: 18px;
    height: 18px;

    font-size: 0.7rem;
    font-weight: 700;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    background: #ef4444;
    color: #fff;
  }
}

#cartIconTrigger:hover {
  transform: translateY(-1px);
}

#cartIconTrigger:active {
  transform: scale(0.95);
}


/* =========================
   CUSTOM CART ICON
   ========================= */

.cart-icon-wrapper {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-icon-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Hover / tap feedback */
.cart-icon-wrapper:hover .cart-icon-img {
  transform: scale(1.1);
  opacity: 0.9;
}

.cart-icon-wrapper:active .cart-icon-img {
  transform: scale(0.95);
}


/* =========================
   CART HERO (REDUCED HEADER)
   ========================= */

.cart-hero {
  background-color: #2e8b57;
  padding: 0.6rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.cart-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Back button */
.cart-back-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  display: none;
}

/* Logo only */
.cart-hero-logo {
  height: 36px;
  object-fit: contain;
}

/* Cart icon */
.cart-hero-cart {
  position: relative;
  cursor: pointer;
}

.cart-hero-cart img {
  width: 24px;
  height: 24px;
}

/* Badge */
.cart-hero-cart .cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: #ef4444;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 50%;
  padding: 2px 6px;
  line-height: 1;
}

/* Mobile behavior */
@media (max-width: 768px) {
  .cart-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .cart-hero-logo {
    height: 32px;
  }
}
