:root {
  --blue-accent: #063e1e;
  --qty-btn-bg: #2e7d4f;
  --checkout-bg: #1a4d2e;
  --remove-bg: #ff3b30;
  --text-deep: #1a4d2e;
  --mint: #BDE3D9;
}

.cart-container {
  padding: 40px 15px 80px 15px;
}

.cart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.cart-col-left,
.cart-col-right {
  display: flex;
  flex-direction: column;
}

.main-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--bdr);
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  color: var(--text-deep);
  text-align: left;
}

@media (max-width: 1024px) {
  .cart-grid {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
}

@media (max-width: 768px) {
  .cart-container {
    padding: 16px 12px 28px;
  }

  .cart-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cart-items-list {
    max-height: min(380px, 50vh);
  }

  .summary-body {
    gap: 4px;
  }

  .summary-total-row {
    margin-top: 8px;
  }
}


.cart-header,
.summary-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--bdr);
  text-align: left;
}

.section-title {
    font-size: 20px;
    font-weight: 500;
    color: var(--gd);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

.blue-bar::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 24px;
  background-color: var(--blue-accent);
  margin-right: 12px;
  border-radius: 2px;
}

.cart-items-list {
  padding: 12px 6px 12px 10px;
  max-height: min(260px, 40vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ga) transparent;
}

.cart-items-list::-webkit-scrollbar {
  width: 5px;
}

.cart-items-list::-webkit-scrollbar-track {
  background: transparent;
}

.cart-items-list::-webkit-scrollbar-thumb {
  background: var(--ga);
  border-radius: 10px;
}

.cart-item {
  display: grid;
  grid-template-columns: 65px 1fr auto;
  align-items: stretch;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  border: 1px solid #dfe6e2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(5, 42, 20, 0.05);
}

.cart-item:last-child {
  margin-bottom: 0;
}


.item-visual {
  width: 65px;
  height: 65px;
  background: #fff;
  border: 1px solid var(--bdr);
  border-radius: 8px;
  flex-shrink: 0;
  align-self: center;
}

.item-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.item-name {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 4px 0;
    color: var(--text-deep);
    text-align: left;
}

.item-brand {
  font-size: 13px;
  color: #888;
  margin: 0 0 6px 0;
  text-align: left;
}

.item-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  padding: 2px 0;
}

.item-meta {
  width: 100%;
  text-align: left;
}

.item-controls {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 12px;
}

.qty-btn {
  width: 24px;
  height: 24px;
  border: none;
  background: var(--qty-btn-bg);
  color: #fff;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.qty-btn:hover {
  opacity: 0.8;
}

.qty-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-deep);
  min-width: 15px;
  text-align: center;
}

.item-price-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-width: 120px;
  padding: 2px 0;
}

.item-pricing {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-deep);
  white-space: nowrap;
}

.price-sep {
  color: #ccc;
  font-weight: 400;
}

.unit-price {
  text-align: right;
}

.total-price {
  text-align: right;
}

.item-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
}

.btn-remove {
  background: var(--remove-bg);
  color: #fff;
  border: none;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-remove:hover {
  transform: scale(1.05);
}

.cart-footer-total {
  background: var(--mint);
  padding: 15px 30px 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: auto;
  border-radius: 0 0 12px 12px;
}

.total-label {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-deep);
  text-align: left;
}

.total-amount {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-deep);
    text-align: right;
}

/* Summary Card */
.summary-body {
  padding: 15px 20px 20px 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.row-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-deep);
  line-height: 1.4;
  flex: 1;
  text-align: left;
}

.row-label .note {
  display: block;
  font-size: 12px;
  color: var(--qty-btn-bg);
  font-weight: 500;
}

.row-value {
  font-size: 14px;
  font-weight: 400;
  color: #333;
  text-align: right;
}

.summary-divider {
  height: 1px;
  background: #eee;
  margin: 15px 0 20px 0;
}

.summary-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--text-deep);
  margin-bottom: 20px;
  margin-top: auto;
}

.summary-total-row .row-label {
    font-size: 16px;
    font-weight: 400;
}

.summary-total-row .row-value {
    font-size: 16px;
    font-weight: 400;
}

.btn-checkout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--checkout-bg);
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  padding: 14px;
  border-radius: 8px;
  transition: all 0.3s;
  box-shadow: 0 4px 12px rgba(0, 166, 81, 0.3);
}

.btn-checkout:hover {
  background: var(--ga);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 166, 81, 0.4);
}

.arrow-icon {
  width: 18px;
  height: 18px;
}

@media (max-width: 767px) {
  .main-card {
    border-radius: 10px;
  }

  .cart-header,
  .summary-header {
    padding: 12px 16px;
  }

  .summary-body,
  .cart-items-list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .cart-footer-total {
    padding: 14px 16px;
  }

  .section-title {
    font-size: 18px;
  }

  .blue-bar::before {
    height: 20px;
    margin-right: 10px;
  }

  .cart-item {
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px 15px;
  }

  .item-visual {
    width: 58px;
    height: 58px;
  }

  .item-details {
    min-width: 0;
  }

  .item-meta {
    min-width: 0;
  }

  .item-name {
    font-size: 15px;
    line-height: 1.35;
  }

  .item-brand {
    margin-bottom: 6px;
  }

  .item-controls {
    margin-top: 2px;
  }

  .qty-control {
    gap: 10px;
  }

  .item-price-action {
    min-width: 95px;
    gap: 5px;
  }

  .item-pricing {
    gap: 8px;
    font-size: 14px;
  }

  .summary-row,
  .summary-total-row,
  .cart-footer-total {
    gap: 12px;
  }

  .row-label,
  .total-label {
    font-size: 13px;
  }

  .row-value {
    flex-shrink: 0;
    text-align: right;
  }

  .summary-total-row .row-label,
  .summary-total-row .row-value,
  .total-amount {
    font-size: 16px;
  }

  .btn-checkout {
    padding: 12px 14px;
    font-size: 14px;
  }
}

/* Mobile Adjustments for Items */
@media (max-width: 575px) {
  .cart-container {
    padding: 16px 8px 24px;
  }

  .cart-items-list {
    padding: 10px 12px 12px;
  }

  .cart-item {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas:
      "visual meta priceaction"
      "visual controls priceaction";
    gap: 8px 12px;
    align-items: stretch;
    margin-bottom: 10px;
    padding: 12px 12px;
    border: 1px solid #dfe6e2;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(5, 42, 20, 0.05);
  }

  .cart-item:last-child {
    margin-bottom: 0;
  }

  .item-visual {
    grid-area: visual;
    width: 54px;
    height: 54px;
    border: none;
    border-radius: 12px;
    overflow: hidden;
    align-self: center;
  }

  .item-price-action {
    grid-area: priceaction;
    align-self: stretch;
    justify-content: space-between;
    min-width: 90px;
  }

  .cart-header,
  .summary-header,
  .summary-body,
  .cart-footer-total {
    padding-left: 14px;
    padding-right: 14px;
  }

  .section-title {
    font-size: 17px;
  }

  .item-name {
    font-size: 14px;
    margin-bottom: 2px;
  }

  .item-brand {
    font-size: 12px;
    margin: 0;
  }

  .item-details {
    display: contents;
  }

  .item-meta {
    grid-area: meta;
    min-width: 0;
  }

  .item-controls {
    grid-area: controls;
    margin-top: 0;
    align-self: center;
  }

  .item-pricing {
    justify-content: flex-end;
    gap: 8px;
    font-size: 13px;
  }

  .price-sep {
    display: inline;
  }

  .unit-price,
  .total-price {
    min-width: auto;
    text-align: right;
  }

  .btn-remove {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: 999px;
    line-height: 1;
  }

  .qty-control {
    gap: 14px;
  }

  .qty-btn {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: #0f7b6c;
    font-size: 15px;
  }

  .qty-val {
    min-width: 10px;
    font-size: 14px;
  }

  .summary-body {
    padding: 18px 14px 16px;
    gap: 0;
  }

  .summary-row,
  .summary-total-row {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
  }

  .summary-row {
    margin-bottom: 18px;
  }

  .summary-divider {
    margin: 10px 0 20px;
  }

  .row-label {
    font-size: 13px;
    line-height: 1.5;
    flex: 1;
  }

  .row-label .note {
    display: inline;
    font-size: inherit;
    line-height: inherit;
    color: #1495db;
  }

  .summary-row .row-value,
  .summary-total-row .row-value {
    width: auto;
    min-width: 64px;
    text-align: right;
    flex-shrink: 0;
    white-space: nowrap;
  }

  .cart-footer-total {
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
  }

  .cart-footer-total .total-label,
  .cart-footer-total .total-amount {
    width: auto;
  }

  .cart-footer-total .total-amount {
    margin-left: 12px;
    text-align: right;
  }
}

@media (max-width: 420px) {
  .cart-container {
    padding: 16px 10px 24px;
  }

  .summary-body {
    padding: 16px 12px 14px;
  }

  .summary-row {
    margin-bottom: 16px;
  }

  .row-label {
    font-size: 12px;
  }

  .summary-row .row-value,
  .summary-total-row .row-value {
    min-width: 56px;
    font-size: 12px;
  }

  .summary-total-row .row-label,
  .summary-total-row .row-value {
    font-size: 13px;
  }

  .cart-item {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    grid-template-areas:
      "visual meta priceaction"
      "visual controls priceaction";
    align-items: stretch;
    gap: 7px 10px;
    padding: 10px 10px;
    border-radius: 12px;
  }

  .item-visual {
    width: 50px;
    height: 50px;
    align-self: center;
  }

  .item-price-action {
    grid-area: priceaction;
    align-self: stretch;
    justify-content: space-between;
    min-width: 80px;
  }

  .item-name {
    font-size: 13px;
    line-height: 1.25;
  }

  .item-brand {
    font-size: 11px;
  }

  .item-pricing {
    gap: 5px;
    font-size: 12px;
  }

  .qty-control {
    gap: 10px;
  }

  .qty-btn {
    width: 21px;
    height: 21px;
    background: #0f7b6c;
    font-size: 13px;
  }

  .btn-remove {
    padding: 5px 10px;
    font-size: 10.5px;
  }

  .cart-footer-total {
    padding: 14px 10px;
  }

  .btn-checkout {
    width: 100%;
  }
}
