/* =========================================================
   GX CART DRAWER – FINAL CLEAN PROFESSIONAL CSS
   + Qty +/- centered
   + Close (X) centered
   + Drawer always above
   ========================================================= */

/* ---------------------------------------------------------
   Stop Electro mini-cart dropdown PANEL (but keep icon clickable)
   IMPORTANT: don't hide the cart link itself
--------------------------------------------------------- */
.header-icon__cart .dropdown-menu,
.header-icon__cart .dropdown-menu-mini-cart,
.header-icon__cart .dropdown-menu-cart,
.top-cart .dropdown-menu,
.top-cart .dropdown-menu-mini-cart,
.top-cart .dropdown-menu-cart,
.site-header .dropdown-menu-mini-cart,
.site-header .dropdown-menu-cart{
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Ensure cart anchor is clickable */
.header-icon__cart > a,
.header-icon__cart a.dropdown-toggle{
  pointer-events: auto !important;
  position: relative !important;
  z-index: 10 !important;
}

/* ---------------------------------------------------------
   Backdrop + drawer
--------------------------------------------------------- */
.gxcd-backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 99998;
}

.gxcd{
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(560px, 100vw);
  background: #fff;
  transform: translateX(105%);
  transition: .28s ease;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -12px 0 30px rgba(0,0,0,.12);
}

body.gxcd-open .gxcd{ transform: translateX(0); }
body.gxcd-open .gxcd-backdrop{ opacity: 1; pointer-events: auto; }
body.gxcd-open{ overflow: hidden; }

/* ---------------------------------------------------------
   Close button (perfect center)
--------------------------------------------------------- */
.gxcd__close{
  position: absolute;
  top: 14px;
  right: 14px;

  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;

  border: 0;
  border-radius: 999px;
  background: #f3f4f6;

  font-size: 28px;
  font-weight: 900;
  line-height: 1;

  cursor: pointer;
  z-index: 5;
}

/* ---------------------------------------------------------
   Header
--------------------------------------------------------- */
.gxcd__head{
  padding: 18px 20px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gxcd__title{
  font-size: 26px;
  font-weight: 800;
  color: #111;
}

.gxcd__count{
  font-size: 18px;
  font-weight: 900;
  color: #7c3aed;
}

/* ---------------------------------------------------------
   Items area
--------------------------------------------------------- */
.gxcd__items{
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 18px;
}

.gxcd__items::-webkit-scrollbar{ width: 6px; }
.gxcd__items::-webkit-scrollbar-thumb{
  background: #ddd;
  border-radius: 10px;
}

.gxcd__empty{
  padding: 18px 6px;
  font-weight: 800;
  color: #444;
}

/* ---------------------------------------------------------
   Item row
--------------------------------------------------------- */
.gxcd-item{
  display: grid;
  grid-template-columns: 56px 62px 1fr 44px;
  gap: 14px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid #eee;
}

.gxcd-item__thumb img{
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
}

.gxcd-item__name{
  font-size: 18px;
  font-weight: 800;
  color: #111;
  line-height: 1.25;

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gxcd-item__price{
  margin-top: 10px;
  font-size: 18px;
  font-weight: 900;
  color: #2563eb;
}

/* ---------------------------------------------------------
   Qty column (CENTERED + no weird grey blocks)
--------------------------------------------------------- */
.gxcd-item__qty{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 56px;
}

/* Kill theme pseudo icons on buttons */
.gxcd-qty__btn::before,
.gxcd-qty__btn::after{
  content: none !important;
  display: none !important;
}

/* +/- buttons */
.gxcd-qty__btn{
  width: 34px !important;
  height: 34px !important;

  display: grid !important;
  place-items: center !important;

  border: 0 !important;
  border-radius: 10px !important;
  background: #f3f4f6 !important;

  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;

  padding: 0 !important;
  cursor: pointer !important;
  color: #7c3aed !important;

  box-shadow: none !important;
  outline: none !important;
}

/* Qty input (true center) */
.gxcd-qty__input{
  width: 42px !important;
  height: 42px !important;

  border-radius: 12px !important;
  border: 2px solid #f59e0b !important;
  background: #fff !important;

  text-align: center !important;
  font-size: 18px !important;
  font-weight: 900 !important;

  padding: 0 !important;
  line-height: 42px !important; /* vertical center for input */

  box-shadow: none !important;
  outline: none !important;
}

/* Remove number arrows */
.gxcd-qty__input::-webkit-outer-spin-button,
.gxcd-qty__input::-webkit-inner-spin-button{
  -webkit-appearance: none;
  margin: 0;
}

/* Remove / trash */
.gxcd-item__remove{
  width: 36px !important;
  height: 36px !important;

  display: grid !important;
  place-items: center !important;

  border-radius: 10px !important;
  border: 0 !important;
  background: #f3f4f6 !important;

  padding: 0 !important;
  line-height: 1 !important;
  font-size: 18px !important;
  font-weight: 900 !important;

  cursor: pointer !important;
  box-shadow: none !important;
  outline: none !important;
}

/* ---------------------------------------------------------
   Footer + totals + button
--------------------------------------------------------- */
.gxcd__footer{
  border-top: 1px solid #dfe6f2;
  padding: 16px 18px 22px;
  background: #fff;
}

.gxcd-totals{
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.gxcd-row{
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 18px;
  color: #111;
}
.gxcd-row strong{ font-weight: 900; }

.gxcd-row--total{
  border-top: 1px solid #dfe6f2;
  margin-top: 10px;
  padding-top: 12px;
  font-size: 20px;
  font-weight: 900;
}

.gxcd-checkout{
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  margin-top: 18px;
  border-radius: 14px;
  background: #2563eb;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
}

.gxcd-checkout--ghost{
  background: #2563eb;
  color: #fff;
}

@media (max-width: 600px){
  .gxcd{ width: 100vw; }
}


/* =========================================================
   GX CART DRAWER – RESPONSIVE PATCH (ALL DEVICES)
   Paste AFTER your current CSS
   ========================================================= */

/* Safe-area support (iPhone notch / home bar) */
.gxcd{
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Make header/footer "stick" visually while items scroll */
.gxcd__head{
  flex: 0 0 auto;
}
.gxcd__items{
  flex: 1 1 auto;
  min-height: 0; /* critical for proper scroll inside flex */
}
.gxcd__footer{
  flex: 0 0 auto;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
}

/* Prevent long names/prices from breaking layout */
.gxcd-item__name,
.gxcd-item__price{
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Ensure buttons remain tappable and consistent */
.gxcd__close,
.gxcd-qty__btn,
.gxcd-item__remove{
  -webkit-tap-highlight-color: transparent;
}

/* ---------------------------
   Tablet (<= 991px)
--------------------------- */
@media (max-width: 991px){
  .gxcd{
    width: min(520px, 100vw);
  }

  .gxcd__title{ font-size: 22px; }
  .gxcd__count{ font-size: 16px; }

  .gxcd__items{ padding: 12px 14px; }

  .gxcd-item{
    grid-template-columns: 54px 58px 1fr 40px;
    gap: 12px;
    padding: 16px 0;
  }

  .gxcd-item__thumb img{
    width: 54px;
    height: 54px;
  }

  .gxcd-item__name{ font-size: 16px; }
  .gxcd-item__price{ font-size: 16px; }

  .gxcd-qty__btn{
    width: 32px !important;
    height: 32px !important;
    font-size: 20px !important;
  }
  .gxcd-qty__input{
    width: 40px !important;
    height: 40px !important;
    font-size: 16px !important;
    line-height: 40px !important;
  }

  .gxcd-row{ font-size: 16px; }
  .gxcd-row--total{ font-size: 18px; }

  .gxcd-checkout{
    height: 52px;
    font-size: 18px;
    border-radius: 12px;
  }
}

/* ---------------------------
   Mobile (<= 600px)
--------------------------- */
@media (max-width: 600px){
  .gxcd{
    width: 100vw;
    border-radius: 0;
  }

  .gxcd__head{
    padding: 14px 14px;
  }

  .gxcd__title{ font-size: 18px; }
  .gxcd__count{ font-size: 14px; }

  .gxcd__close{
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .gxcd__items{
    padding: 10px 12px;
  }

  /* Compact but clean item layout */
  .gxcd-item{
    grid-template-columns: 46px 1fr 56px 34px;
    gap: 10px;
    padding: 14px 0;
  }

  .gxcd-item__thumb img{
    width: 46px;
    height: 46px;
    border-radius: 10px;
  }

  .gxcd-item__name{
    font-size: 14px;
    -webkit-line-clamp: 2;
  }

  .gxcd-item__price{
    margin-top: 6px;
    font-size: 14px;
  }

  .gxcd-item__qty{
    gap: 8px;
    min-width: 56px;
  }

  .gxcd-qty__btn{
    width: 30px !important;
    height: 30px !important;
    font-size: 18px !important;
    border-radius: 10px !important;
  }

  .gxcd-qty__input{
    width: 38px !important;
    height: 38px !important;
    font-size: 14px !important;
    line-height: 38px !important;
    border-radius: 12px !important;
  }

  .gxcd-item__remove{
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
    border-radius: 10px !important;
  }

  /* Footer compact + always visible */
  .gxcd__footer{
    padding: 12px 12px calc(16px + env(safe-area-inset-bottom));
  }

  .gxcd-totals{
    max-width: 100%;
  }

  .gxcd-row{
    font-size: 14px;
    padding: 5px 0;
  }
  .gxcd-row--total{
    font-size: 16px;
    padding-top: 10px;
  }

  .gxcd-checkout{
    height: 48px;
    font-size: 16px;
    margin-top: 12px;
    border-radius: 12px;
  }
}

/* ---------------------------
   Very small phones (<= 360px)
--------------------------- */
@media (max-width: 360px){
  .gxcd-item{
    grid-template-columns: 44px 1fr 52px 32px;
    gap: 8px;
  }
  .gxcd-item__name{ font-size: 13px; }
  .gxcd-item__price{ font-size: 13px; }

  .gxcd-qty__btn{
    width: 28px !important;
    height: 28px !important;
    font-size: 16px !important;
  }
  .gxcd-qty__input{
    width: 36px !important;
    height: 36px !important;
    font-size: 13px !important;
    line-height: 36px !important;
  }

  .gxcd-checkout{
    height: 46px;
    font-size: 15px;
  }
}
