/* =========================================
   CART & SIDEBAR
========================================= */
.cart-wrapper {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.cart-icon {
    max-width: 40px;
    max-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    z-index: 10;
    padding: 0;
	
	/* === Remove unwanted square or pseudo-elements === */
	background: none !important;
    border: none !important;
    box-shadow: none !important;
	transition: transform 0.3s ease;
}

.cart-icon::before,
.cart-icon::after {
    content: none !important;
}

.cart-icon:hover,
.cart-icon:focus {
    transform: scale(1.1);
    color: inherit; /* Matches text/icon color; adjust if needed */
    outline: none;
}

.cart-icon.active {
    background-color: rgba(255,255,0,0.0);
    border-radius: 5px;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #555;
    color: white;
	font-family: Arial, sans-serif;
    font-size: 0.7rem; /* smaller badge text */
    font-weight: 700;
    line-height: 1;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    padding: 2px 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.36s cubic-bezier(.22,.9,.34,1), opacity 0.28s ease;
}

.cart-badge.active {
    transform: scale(1);
    opacity: 1;
    animation: bounceBadge 0.45s ease;
}

@keyframes bounceBadge {
    0%,100%{transform:scale(1);}
    30%{transform:scale(1.3);}
    50%{transform:scale(0.9);}
    80%{transform:scale(1.1);}
}

/* Sidebar */
.shopping-sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 300px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 5px rgba(0,0,0,0.5);
    padding: 20px;
    transition: transform 0.3s ease;
    transform: translateX(100%);
    z-index: 100;
    border-left: 3px solid #007bff1a;
    backdrop-filter: blur(4px);
}

.shopping-sidebar.open { transform: translateX(0); }

.shopping-sidebar .close {
    font-size: 30px;
    cursor: pointer;
    padding: 10px;
	outline: none; /* Remove focus outline */
    border: none;  
    background: transparent;
    color: black;
	cursor: pointer;
}

#shoppingSidebar .close:hover {
    color: #161616;
}

.sidebar-header { font-size: 1.25em; color: black; }
.sidebar-paragraph { font-size: 1em; color: black; }

#cartContents {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-top: 20px;
}

.cart-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    gap: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 10px;
    border-bottom: 1px solid #eee;
    transition: all 0.3s ease;
    min-height: 70px; /* enough for 55px image + padding */
    max-height: 120px; /* prevents overly tall items if text wraps */
    min-width: 180px; /* prevents shrinking too small in a row layout */
    max-width: 100%; /* allows flexibility for container */
}

.cart-item-left {
  display: flex;
  align-items: center;
  gap: 10px; /* space between thumbnail and info */
  flex: 1; /* allows info to grow */
}

.cart-item-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    transition: width 0.3s ease, height 0.3s ease, font-size 0.3s ease;
}

.cart-item-left-mid {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px; /* space between thumbnail and info */
  flex: 1; /* allows info to grow */
}

.cart-item-name {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
	gap: 2px;
    font-size: 13px;
    color: #111;
    width: 100%;
    align-items: center;
    transition: font-size 0.3s ease;
}

.cart-item-price {
	display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
	gap: 2px;
    font-size: 13px;
    color: #111;
    width: 100%;
    align-items: center;
    transition: font-size 0.3s ease;
}

.cart-item-right-mid {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* The actual number in between the + and - buttons */
.cart-item-qty {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
    color: #111;
}

/* + and - Buttons */
.qty-btn {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    line-height: 1;
	padding: 0;
    background: #f0f0f0;
    color: black;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.qty-btn:hover { 
    background-color: #dddddd;
    color: black;
}

.cart-item-right {
  display: flex;
  align-items: center;
  gap: 10px; /* space between qty controls and trash */
}

.remove-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #E1E1E1;
    margin-left: -7.5px;
    align-self: center;
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
}

.remove-btn:hover { color: #b02a37; transform: scale(1.1); }
.remove-btn:focus { outline: 2px solid #007bff; outline-offset: 2px; }

.delete-confirmation {
    position: fixed;
    top: 50%;
	left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index:150;
    display: none;
	width: 280px;
    max-width: 90%;
}

/* =========================================
   DELETE PROMPT + VISUAL OVERLAY (NON-BLOCKING)
========================================= */

/* Semi-dark overlay that shows when modal is open.
   Important: pointer-events:none keeps sidebar clickable. */
body.show-delete-overlay::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 140; /* Behind modal but above everything else */
    pointer-events: none;
}

.delete-confirmation p {
	margin-bottom: 15px;
	font-size: 14px;
	color: black;
}

.delete-confirmation button {
    margin-right: 10px;
	padding: 5px 12px;
	border-radius: 5px;
	border: none;
	cursor: pointer;
	font-size: 14px;
}

.delete-confirmation .confirm-btn { 
    background-color: #28a745; 
    color: white; 
}
.delete-confirmation .cancel-btn { 
    background-color: #555; 
    color: white; 
}

/* =========================================
   GRAND TOTAL + CHECKOUT CONTAINER
========================================= */
.shopping-sidebar .grand-total-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 20px; /* spacing from cart items */
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.shopping-sidebar .grand-total-container .grand-total {
    font-weight: bold;
    font-size: 16px;
    color: #111;
    text-align: right;
}

.shopping-sidebar .grand-total-container .checkout-btn {
    background-color: #007bff;
    color: #fff;
    border: none;
    padding: 12px 0;
    font-size: 16px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.shopping-sidebar .grand-total-container .checkout-btn:hover {
    background-color: #0056b3;
    transform: scale(1.02);
}

.shopping-sidebar .grand-total-container .checkout-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   TOAST NOTIFICATIONS
========================================= */
.toast-container {
	position: fixed;
	bottom: 20px;
	right: 20px;
	z-index: 200;
	display: flex;
	flex-direction: column-reverse;
	gap: 10px;
	pointer-events: none;
}

.toast {
	min-width: 250px;
	max-width: 300px;
	padding: 12px 16px 12px 45px;
	border-radius: 5px;
	background: #555;
	color: white;
	font-size: 14px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.3);
	opacity: 0;
	transform: translateY(20px);
	transition: transform 0.3s ease, opacity 0.3s ease;
	pointer-events: auto;
	position: fixed;
	bottom: 20px;
	right: 20px;
}

.toast.main-toast {
	background: #555;
}

.toast.success-toast {
	background: #3CC235;
	color: #fff;
}

.toast.bag-toast {
	background: #94A7B0;
	z-index: 110;
}

.toast.trash-toast {
	background: #4BAC46;
	color: #fff;
	z-index: 110;
}

.toast.hide {
	opacity: 0;
	transform: translateY(50px);
}

@keyframes toastSlideUp {
	0% {opacity:0;
	transform:translateY(40px);}
	25% {opacity:1; transform:translateY(0);}
	75% {opacity:1; transform:translateY(0);}
	100% {opacity:0; transform:translateY(40px);}
}

.toast.show {
	animation: toastSlideUp 2.8s ease forwards;
}

/* =========================================
   RESPONSIVE MEDIA QUERIES
========================================= */

/* --------- TABLET ≤900px --------- */
@media (max-width: 900px) {
    .shopping-sidebar { width: 280px; }

  .shopping-sidebar .grand-total-container .checkout-btn {
      width: calc(100% - 30px);
      font-size: 14px;
      padding: 10px 0;
  }

    .toast { min-width: 220px; font-size: 13px; }
}
/* --------- MOBILE ≤600px --------- */
@media (max-width: 600px) {
    .cart-item-info {
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .cart-item-controls {
        gap: 2px;
    }

    /* + and - Buttons */
    .cart-item-controls .qty-btn {
        width: 20px;
        height: 20px;
        padding: 0;
        margin: 0;
    }

    /* The actual number in between the + and - buttons */
    .cart-item-controls .cart-item-qty {
        min-width: 16px;
        text-align: center;
        margin: 0;
    }

    .cart-item .remove-btn {
        margin-right: 20px;
        align-self: center;
    }

    .shopping-sidebar { width: 260px; }
	
    .shopping-sidebar .grand-total-container .checkout-btn {
		font-size: 13px;
		padding: 8px 0;
	}
	
    .toast { min-width: 200px; font-size: 12px; }
}

/* --------- SMALL MOBILE ≤400px --------- */
@media (max-width: 400px) {
    .cart-item {
		flex-direction: column;
		align-items: flex-start;
		min-height: 55px;
		max-height: 90px;
		}
		
		.cart-item-right {
			width: 100%;
			justify-content: space-between;
			margin-top: 5px;
			}
		
    .cart-item-img { width: 40px; height: 40px; }
    .cart-item-info { font-size: 10px; }
    .shopping-sidebar { width: 240px; }
	
    .shopping-sidebar .grand-total-container .checkout-btn {
		font-size: 12px;
		padding: 6px 0;
	}
	
    .toast { min-width: 180px; font-size: 11px; }
}
