/* /frontend/cart-panel.css */

:root {
  --cp-panel-w: 380px;
  --cp-bg1: rgba(18, 18, 18, 0.94);
  --cp-bg2: rgba(35, 35, 35, 0.92);
  --cp-line: rgba(255, 255, 255, 0.14);
  --cp-soft: rgba(255, 255, 255, 0.08);
  --cp-text: rgba(255, 255, 255, 0.92);
  --cp-muted: rgba(255, 255, 255, 0.65);
}

.cp-root {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
}

.cp-root.is-open {
  display: block;
}

.cp-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.cp-panel {
  position: absolute;
  right: 0;
  top: 0;
  height: 100vh;
  width: min(var(--cp-panel-w), 92vw);
  color: var(--cp-text);
  background:
    radial-gradient(1200px 800px at 25% 10%, rgba(255,255,255,0.06), transparent 55%),
    linear-gradient(180deg, var(--cp-bg1), var(--cp-bg2));
  border-left: 1px solid rgba(255,255,255,0.10);
  box-shadow: -20px 0 50px rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
}

.cp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 10px;
}

.cp-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.cp-close {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-2px);
}

.cp-steps {
  padding: 0 22px 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.60);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cp-step.is-active {
  color: rgba(255,255,255,0.92);
}

.cp-rule {
  height: 2px;
  margin: 0 22px;
  background: rgba(255,255,255,0.22);
}

.cp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cp-section {
  display: none;
  flex: 1;
  min-height: 0;
}

.cp-section.is-active {
  display: flex;
  flex-direction: column;
}

.cp-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px 22px;
  min-height: 0;
  border-right: 2px solid rgba(255,255,255,0.20); /* gives that “white bar” feel */
}

.cp-scroll::-webkit-scrollbar {
  width: 6px;
}

.cp-scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: 99px;
}

.cp-empty {
  height: 100%;
  min-height: 520px;
  display: grid;
  place-items: center;
  color: rgba(255,255,255,0.65);
  font-size: 18px;
  letter-spacing: 0.2px;
}

.cp-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ITEM CARD */
.cp-item {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 14px;
  align-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 14px;
}

.cp-item-img {
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  overflow: hidden;
}

.cp-item-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: translateY(2px);
}

.cp-item-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.3px;
  line-height: 1.05;
}

.cp-item-name span {
  font-size: 12px;
  font-weight: 800;
  opacity: 0.85;
  margin-left: 6px;
}

.cp-item-sub {
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.62);
}

.cp-item-mid {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.cp-qbtn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.90);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  user-select: none;
}

.cp-qval {
  min-width: 18px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
}

.cp-item-price {
  margin-top: 12px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
}

/* BOTTOM SUMMARY */
.cp-bottom {
  padding: 14px 22px 22px;
  border-top: 1px solid rgba(255,255,255,0.10);
  background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.22));
}

.cp-coupon {
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 10px;
  margin-bottom: 14px;
}

.cp-coupon input {
  height: 40px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  padding: 0 12px;
  outline: none;
}

.cp-coupon button {
  height: 40px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.95);
  font-weight: 700;
  cursor: pointer;
}

.cp-summary {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255,255,255,0.75);
}

.cp-srow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
}

.cp-srule {
  height: 1px;
  background: rgba(255,255,255,0.20);
  margin: 8px 0 10px;
}

.cp-total {
  font-size: 15px;
  font-weight: 800;
  color: rgba(255,255,255,0.92);
}

.cp-checkout {
  width: 100%;
  height: 44px;
  margin-top: 16px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
}

/* Shipping/Payment */
.cp-pad { padding-top: 18px; }

.cp-h2 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}

.cp-note {
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  line-height: 1.35;
}

.cp-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.cp-label {
  font-size: 12px;
  color: rgba(255,255,255,0.72);
}

.cp-input {
  height: 40px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
  padding: 0 12px;
  outline: none;
}

.cp-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cp-btnrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cp-btn {
  height: 44px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.30);
  background: rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  cursor: pointer;
}

.cp-btn.ghost {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.18);
}

.cp-paybox {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.cp-payopt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
}









/* =========================
   RESPONSIVE (TAB + MOBILE)
   Paste at the END of cart-panel.css
========================= */

/* Tablet */
@media (max-width: 1024px){
  :root{ --cp-panel-w: 420px; }

  .cp-panel{
    width: min(var(--cp-panel-w), 94vw);
    height: 100dvh; /* better on mobile browsers */
  }

  .cp-top{ padding: 20px 18px 10px; }
  .cp-steps{ padding: 0 18px 12px; }
  .cp-rule{ margin: 0 18px; }
  .cp-scroll{ padding: 10px 18px; }
  .cp-bottom{ padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }
}

/* Mobile */
@media (max-width: 600px){
  :root{ --cp-panel-w: 100vw; }

  /* Make it a full-width drawer like your screenshot */
  .cp-panel{
    width: 100vw;
    height: 100dvh;
  }

  .cp-top{
    padding: 18px 16px 8px;
  }

  .cp-title{
    font-size: 26px;
  }

  .cp-close{
    width: 32px;
    height: 32px;
    font-size: 30px;
  }

  .cp-steps{
    padding: 0 16px 10px;
    font-size: 11px;
    gap: 6px;
  }

  .cp-rule{
    margin: 0 16px;
  }

  /* Remove the right white-bar feel on mobile (keeps layout clean) */
  .cp-scroll{
    padding: 10px 16px;
    border-right: 0;
  }

  .cp-empty{
    min-height: 360px;
    font-size: 16px;
  }

  /* Item cards scale down like your screenshot */
  .cp-list{ gap: 14px; }

  .cp-item{
    grid-template-columns: 86px 1fr;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .cp-item-img{
    height: 108px;
    border-radius: 10px;
  }

  .cp-item-name{
    font-size: 16px;
  }

  .cp-item-name span{
    font-size: 11px;
  }

  .cp-item-mid{
    margin-top: 10px;
    gap: 10px;
  }

  .cp-qbtn{
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .cp-qval{
    font-size: 13px;
  }

  .cp-item-price{
    margin-top: 10px;
    font-size: 20px;
  }

  /* Bottom summary fits nicely */
  .cp-bottom{
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .cp-coupon{
    grid-template-columns: 1fr 84px;
    gap: 8px;
    margin-bottom: 12px;
  }

  .cp-coupon input,
  .cp-coupon button{
    height: 38px;
  }

  .cp-summary{
    font-size: 13px;
  }

  .cp-total{
    font-size: 15px;
  }

  .cp-checkout{
    height: 44px;
    margin-top: 14px;
  }

  /* Shipping/payment inside popup also becomes comfortable */
  .cp-h2{ font-size: 17px; }
  .cp-input{ height: 38px; }
  .cp-btn{ height: 44px; }
}

/* Extra small phones */
@media (max-width: 380px){
  .cp-title{ font-size: 24px; }
  .cp-item{ grid-template-columns: 80px 1fr; }
  .cp-item-img{ height: 100px; }
}





/* =========================
   MOBILE WIDTH = 80% (as per your SS)
   Paste at END of cart-panel.css
========================= */

@media (max-width: 600px){
  :root{ --cp-panel-w: 80vw; }

  /* Drawer should NOT be full width */
  .cp-panel{
    width: min(var(--cp-panel-w), 420px); /* keeps it 80% but not too wide on big phones */
    height: 100dvh;
  }

  .cp-top{ padding: 18px 16px 8px; }
  .cp-title{ font-size: 26px; }
  .cp-close{ width: 32px; height: 32px; font-size: 30px; }

  .cp-steps{
    padding: 0 16px 10px;
    font-size: 11px;
    gap: 6px;
  }

  .cp-rule{ margin: 0 16px; }

  /* Keep the “white bar” feel on right like your screenshot */
  .cp-scroll{
    padding: 10px 16px;
    border-right: 2px solid rgba(255,255,255,0.20);
  }

  .cp-empty{
    min-height: 360px;
    font-size: 16px;
  }

  /* Scale down cards a bit */
  .cp-list{ gap: 14px; }

  .cp-item{
    grid-template-columns: 86px 1fr;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
  }

  .cp-item-img{ height: 108px; }

  .cp-item-name{ font-size: 16px; }
  .cp-item-name span{ font-size: 11px; }

  .cp-item-mid{ margin-top: 10px; gap: 10px; }

  .cp-qbtn{
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .cp-qval{ font-size: 13px; }

  .cp-item-price{
    margin-top: 10px;
    font-size: 20px;
  }

  .cp-bottom{
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  }

  .cp-coupon{
    grid-template-columns: 1fr 84px;
    gap: 8px;
    margin-bottom: 12px;
  }

  .cp-coupon input,
  .cp-coupon button{ height: 38px; }

  .cp-checkout{
    height: 44px;
    margin-top: 14px;
  }
}

/* Extra small phones */
@media (max-width: 380px){
  :root{ --cp-panel-w: 82vw; } /* slightly more width on tiny screens */
  .cp-title{ font-size: 24px; }
  .cp-item{ grid-template-columns: 80px 1fr; }
  .cp-item-img{ height: 100px; }
}

