/*
 * Custom styles for the Cart page
 */

/* General page container */
#checkout-cart #content {
  max-width: 100%; /* Full width on mobile */
  padding: 15px;
}

@media (min-width: 768px) {
  #checkout-cart #content {
    max-width: 820px;
    margin: auto;
    padding: 0;
  }
}

/* Table styling */
.table-responsive {
  border: 1px solid #e9e9e9;
  border-radius: 8px;
  overflow-x: auto; /* Allows horizontal scrolling for tables on small screens */
  margin-bottom: 25px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.table-bordered {
  margin-bottom: 0; /* Remove default margin */
}

.table-bordered thead td {
  background-color: #f9f9f9;
  font-weight: 600;
  padding: 15px;
  border-bottom: 1px solid #e9e9e9;
  vertical-align: middle;
}

.table-bordered tbody td {
  padding: 15px;
  vertical-align: middle;
  border-top: 1px solid #e9e9e9;
}

.table-bordered tbody tr:first-child td {
  border-top: none; /* No top border for the first row */
}

.table-bordered .text-center img {
  border-radius: 5px;
}

/* Quantity input and buttons */
.input-group.btn-block {
  max-width: 150px; /* Adjust as needed */
  display: flex;
  flex-wrap: nowrap; /* Prevent wrapping */
  align-items: stretch; /* Stretch items to fill the container height */
}

.input-group.btn-block input[type="text"] {
  flex-grow: 1; /* Allow input to take available space */
  height: 48px; /* Keep original height */
  border-radius: 5px 0 0 5px;
  border: 1px solid #ddd;
  padding: 0 10px;
  text-align: center;
  min-width: 50px; /* Ensure input doesn't become too small */
}

.input-group.btn-block .input-group-btn {
  display: flex; /* Make the button group a flex container */
  flex-direction: column; /* Stack buttons vertically within the group */
  margin-left: 5px; /* Space between input and button group */
}

.input-group.btn-block .input-group-btn .btn {
  height: 24px; /* Half height for each button */
  font-size: 14px; /* Smaller font size */
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0; /* Remove individual button radius for stacking */
  width: 40px; /* Fixed width for buttons */
}

.input-group.btn-block .input-group-btn .btn:first-child {
  border-radius: 5px 5px 0 0; /* Top button rounded top corners */
  margin-bottom: 1px; /* Small gap between buttons */
}

.input-group.btn-block .input-group-btn .btn:last-child {
  border-radius: 0 0 5px 5px; /* Bottom button rounded bottom corners */
}

.input-group.btn-block .input-group-btn .btn-primary {
  background-color: #6f4e37;
  border-color: #6f4e37;
  color: #fff;
}

.input-group.btn-block .input-group-btn .btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

/* Accordion styling (for coupon/shipping) */
#accordion {
  border: 1px solid #e9e9e9;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  margin-bottom: 25px;
}

#accordion .accordion-item {
  border: none; /* Remove default accordion item border */
}

#accordion .accordion-item:not(:first-child) {
  border-top: 1px solid #e9e9e9; /* Separator between accordion items */
}

#accordion .accordion-header {
  background-color: #fff;
}

#accordion .accordion-button {
  background-color: #fff;
  color: #333;
  font-size: 18px;
  font-weight: 600;
  padding: 20px 25px;
  border: none;
  border-radius: 8px; /* Apply to top corners of first item, bottom of last */
  text-align: left;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#accordion .accordion-button:not(.collapsed) {
  color: #6f4e37; /* Accent color for active header */
  background-color: #f9f9f9; /* Light gray background for active header */
  border-bottom: 1px solid #e9e9e9;
  border-radius: 8px 8px 0 0;
}

#accordion .accordion-button:focus {
  box-shadow: none;
}

#accordion .accordion-button i.fa {
  transition: transform 0.3s ease;
}

#accordion .accordion-button:not(.collapsed) i.fa {
  transform: rotate(180deg);
}

#accordion .accordion-body {
  padding: 25px 30px 30px 30px;
  background-color: #fff;
  border-radius: 0 0 8px 8px;
}

#accordion .accordion-body .input-group {
  max-width: 350px; /* Limit width of coupon input */
}

#accordion .accordion-body .form-control {
  height: 48px;
  border-radius: 5px 0 0 5px;
  border: 1px solid #ddd;
  padding: 0 15px;
}

#accordion .accordion-body .input-group-btn .btn-primary {
  height: 48px;
  border-radius: 0 5px 5px 0;
  background-color: #6f4e37;
  border-color: #6f4e37;
  color: #fff;
  font-weight: bold;
  text-transform: uppercase;
  padding: 0 20px;
}

/* Total table at the bottom */
.row .col-sm-4.col-sm-offset-8 .table-bordered {
  border: 1px solid #e9e9e9;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.row .col-sm-4.col-sm-offset-8 .table-bordered td {
  padding: 12px 15px;
}

.row .col-sm-4.col-sm-offset-8 .table-bordered tr:last-child td {
  font-weight: bold;
  color: #6f4e37;
}

/* Buttons at the bottom */
.buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 25px;
}

.buttons .btn {
  height: 50px;
  font-weight: bold;
  text-transform: uppercase;
  border-radius: 5px;
  padding: 0 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 15px; /* For mobile spacing */
}

.buttons .btn-default {
  background-color: #f0f0f0;
  border-color: #f0f0f0;
  color: #333;
}

.buttons .btn-primary {
  background-color: #6f4e37;
  border-color: #6f4e37;
  color: #fff;
}

@media (max-width: 767px) {
  .buttons {
    flex-direction: column;
  }

  .buttons .btn {
    width: 100%;
    margin-bottom: 15px;
  }

  .buttons .pull-left,
  .buttons .pull-right {
    width: 100%;
    text-align: center;
  }

  #accordion {
    border: none;
    box-shadow: none;
  }

  #accordion .accordion-button {
    padding: 15px;
    font-size: 17px;
    border-radius: 0;
  }

  #accordion .accordion-button:not(.collapsed) {
    border-radius: 0;
  }

  #accordion .accordion-body {
    padding: 20px 15px 25px 15px;
    border-radius: 0;
  }

  .table-responsive {
    border-radius: 0;
    box-shadow: none;
  }

  .row .col-sm-4.col-sm-offset-8 {
    width: 100%;
    margin-left: 0;
  }

  .row .col-sm-4.col-sm-offset-8 .table-bordered {
    border-radius: 0;
    box-shadow: none;
  }
}
