/* cart.css — sidebar cart drawer */

/* ── Wrapper ──────────────────────────────── */
.cart-drawer{
  position:fixed;
  inset:0;
  z-index:99999;
  visibility:hidden;
  pointer-events:none;
}
.cart-drawer.is-open{
  visibility:visible;
  pointer-events:all;
}

/* ── Overlay ──────────────────────────────── */
.cart-overlay{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.55);
  opacity:0;
  transition:opacity .3s ease;
}
.cart-drawer.is-open .cart-overlay{
  opacity:1;
}

/* ── Sliding panel ────────────────────────── */
.cart-panel{
  position:absolute;
  right:0;
  top:0;
  width:420px;
  max-width:100vw;
  height:100%;
  background:#fff;
  display:flex;
  flex-direction:column;
  transform:translateX(100%);
  transition:transform .35s cubic-bezier(.4,0,.2,1);
  box-shadow:-6px 0 40px rgba(0,0,0,.2);
  z-index:1;
}
.cart-drawer.is-open .cart-panel{
  transform:translateX(0);
}

/* ── Header ───────────────────────────────── */
.cart-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 20px;
  border-bottom:2px solid #f0f0f0;
  flex-shrink:0;
}
.cart-header-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:16px;
  font-weight:700;
  color:#1a1a1a;
}
.cart-close{
  width:34px !important;
  height:34px !important;
  border:none !important;
  background:#f5f5f5 !important;
  border-radius:50% !important;
  font-size:16px !important;
  cursor:pointer !important;
  color:#555 !important;
  line-height:1 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  transition:background .2s !important;
  padding:0 !important;
}
.cart-close:hover{
  background:#e0e0e0 !important;
}

/* ── Items list ───────────────────────────── */
.cart-items{
  flex:1;
  overflow-y:auto;
  padding:8px 0;
  position:relative;
}
.cart-items--loading{
  opacity:.5;
  pointer-events:none;
}

/* ── Empty state ──────────────────────────── */
.cart-empty{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:60px 20px;
  gap:14px;
  color:#aaa;
  font-size:15px;
  text-align:center;
}

/* ── Single item ──────────────────────────── */
.cart-item{
  display:flex !important;
  align-items:flex-start !important;
  gap:12px !important;
  padding:12px 16px !important;
  border-bottom:1px solid #f3f3f3 !important;
  position:relative;
  transition:opacity .2s;
}
.cart-item:last-child{
  border-bottom:none !important;
}

/* Image */
.cart-item-img{
  flex-shrink:0 !important;
  width:72px !important;
  height:72px !important;
  border:1px solid #eeeeee !important;
  border-radius:8px !important;
  overflow:hidden !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  background:#fafafa !important;
}
.cart-item-img img{
  width:100% !important;
  height:100% !important;
  object-fit:contain !important;
  display:block !important;
}

/* Body */
.cart-item-body{
  flex:1 !important;
  min-width:0 !important;
  display:flex !important;
  flex-direction:column !important;
  gap:5px !important;
}

/* Name */
.cart-item-name{
  font-size:13px !important;
  line-height:1.4 !important;
  color:#222 !important;
  display:-webkit-box !important;
  -webkit-line-clamp:2 !important;
  -webkit-box-orient:vertical !important;
  overflow:hidden !important;
  text-decoration:none !important;
  font-weight:500 !important;
}
.cart-item-name:hover{
  color:#2f80ed !important;
}

/* Subtotal */
.cart-item-subtotal{
  font-weight:700 !important;
  font-size:14px !important;
  color:#e31720 !important;
}
.cart-item-subtotal .woocommerce-Price-amount{
  color:#e31720 !important;
  font-weight:700 !important;
}

/* Qty controls */
.cart-item-controls{
  display:flex !important;
  align-items:center !important;
  width:fit-content !important;
  border:1px solid #e0e0e0 !important;
  border-radius:8px !important;
  overflow:hidden !important;
  margin-top:2px !important;
  background:#fff !important;
}
.qty-btn{
  width:30px !important;
  height:30px !important;
  border:none !important;
  background:#f5f5f5 !important;
  font-size:16px !important;
  cursor:pointer !important;
  color:#333 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  line-height:1 !important;
  transition:background .15s !important;
  padding:0 !important;
}
.qty-btn:hover{
  background:#e5e5e5 !important;
}
.qty-input{
  width:38px !important;
  height:30px !important;
  border:none !important;
  border-left:1px solid #e0e0e0 !important;
  border-right:1px solid #e0e0e0 !important;
  text-align:center !important;
  font-size:13px !important;
  font-weight:600 !important;
  background:#fff !important;
  -moz-appearance:textfield !important;
  padding:0 !important;
}
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button{
  -webkit-appearance:none;
  margin:0;
}

/* Remove button */
.cart-item-remove{
  flex-shrink:0 !important;
  width:24px !important;
  height:24px !important;
  border:none !important;
  background:transparent !important;
  color:#bbb !important;
  font-size:13px !important;
  cursor:pointer !important;
  border-radius:50% !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:0 !important;
  transition:color .15s, background .15s !important;
  margin-top:2px !important;
}
.cart-item-remove:hover{
  background:#fff0f0 !important;
  color:#e31720 !important;
}

/* ── Footer ───────────────────────────────── */
.cart-footer{
  padding:16px 20px !important;
  border-top:2px solid #f0f0f0 !important;
  background:#fafafa !important;
  flex-shrink:0 !important;
}
.cart-footer-row{
  display:flex !important;
  justify-content:space-between !important;
  align-items:center !important;
  margin-bottom:14px !important;
  font-size:14px !important;
}
.cart-footer-row span:first-child{
  color:#666 !important;
}
.cart-footer-total{
  font-weight:700 !important;
  font-size:16px !important;
  color:#1a1a1a !important;
}
.cart-footer-total .woocommerce-Price-amount{
  font-weight:700 !important;
  color:#1a1a1a !important;
}
.cart-checkout{
  display:block !important;
  text-align:center !important;
  background:#2ED47A !important;
  color:#fff !important;
  padding:14px !important;
  border-radius:12px !important;
  font-weight:700 !important;
  font-size:15px !important;
  text-decoration:none !important;
  transition:background .2s, transform .15s !important;
}
.cart-checkout:hover{
  background:#25c06d !important;
  transform:translateY(-1px) !important;
  color:#fff !important;
}

.cart-continue{
  display:block;
  width:100%;
  margin-top:10px;
  text-align:center;
  background:#333333;
  color:#fff;
  border:1.5px solid #ddd;
  padding:11px;
  border-radius:12px;
  font-weight:500;
  font-size:14px;
  cursor:pointer;
  transition:border-color .2s, color .2s;
}
.cart-continue:hover{
  border-color:#2ED47A;
  color:#2ED47A;
}

/* ── Lock body scroll ─────────────────────── */
.cart-body-open{
  overflow:hidden !important;
}

/* ── Cart icon badge ──────────────────────── */
.cart-link{
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  background:none !important;
  border:none !important;
  cursor:pointer !important;
  color:#fff !important;
  font-weight:600 !important;
  padding:0 !important;
}
.cart-count{
  background:#e31720;
  color:#fff;
  border-radius:50%;
  width:22px;
  height:22px;
  font-size:12px;
  font-weight:700;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  line-height:1;
}

/* ── Cart loading spinner ─────────────────── */
.cart-spinner-wrap{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:60px 20px;
}
.cart-spinner{
  width:36px;
  height:36px;
  border:3px solid #f0f0f0;
  border-top-color:#2f80ed;
  border-radius:50%;
  display:inline-block;
  animation:cart-spin .7s linear infinite;
}
@keyframes cart-spin{
  to{ transform:rotate(360deg); }
}

/* ── Add-to-cart button ───────────────────── */
.fastshop-add-to-cart{
  background:#e31720 !important;
  color:#fff !important;
  border:none !important;
  padding:10px 18px !important;
  border-radius:10px !important;
  cursor:pointer !important;
  font-weight:600 !important;
  transition:background .2s, opacity .2s !important;
}
.fastshop-add-to-cart:hover{
  background:#c8111a !important;
}
.fastshop-add-to-cart.loading{
  opacity:.6 !important;
  pointer-events:none !important;
}

/* ── Optimistic cart item (shows instantly, replaced by real data) ── */
.cart-item--optimistic {
  opacity: .85;
  animation: opt-pulse 1.2s ease-in-out infinite;
}
@keyframes opt-pulse {
  0%, 100% { opacity: .85; }
  50%       { opacity: .55; }
}

/* Міні-спінер замість кнопок qty поки сервер відповідає */
.cart-item-controls--loading {
  display: flex !important;
  align-items: center !important;
  border: none !important;
  background: transparent !important;
  padding: 4px 0 !important;
}
.cart-opt-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #e0e0e0;
  border-top-color: #2f80ed;
  border-radius: 50%;
  animation: cart-spin .7s linear infinite;
}
@keyframes cart-spin {
  to { transform: rotate(360deg); }
}
