/* Cart Overlay Styles */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 2100; /* Above favorites */
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.cart-overlay.open {
  transform: translateY(0);
}

.cart-header {
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  z-index: 10;
  flex-shrink: 0;
}

.cart-header h2 {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  color: var(--accent);
  margin: 0;
}

.cart-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.1);
  background: #fff;
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cart-close:hover {
  background: var(--accent);
  color: #fff;
  transform: rotate(90deg);
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* Removed padding-bottom since footer is now relative */
}

/* --- NEW CLEAN CART DESIGN (Responsive & Structured) --- */

.cart-items {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 4px; /* Small padding to prevent shadow clipping */
}

.cart-item {
  display: grid;
  grid-template-columns: 90px 1fr; /* Fixed image width + flexible content */
  gap: 16px;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  border: 1px solid #f0f0f0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  align-items: stretch;
}

.cart-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-color: #e0e0e0;
}

/* Image Section */
.cart-item-image-container {
  width: 90px;
  height: 100px;
  background: #f8f9fa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.cart-item-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  padding: 4px;
}

/* Details Section */
.cart-item-details-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0; /* Critical for text-overflow to work in Grid/Flex */
}

/* Row 1: Title & Remove */
.cart-item-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 4px;
}

.cart-item-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Limit to 2 lines */
  -webkit-box-orient: vertical;
}

.cart-remove-btn {
  background: none;
  border: none;
  color: #bdc3c7;
  cursor: pointer;
  padding: 4px;
  margin: -4px -4px 0 0; /* Pull it to the corner */
  transition: color 0.2s;
  flex-shrink: 0;
}

.cart-remove-btn:hover {
  color: #e74c3c;
}

/* Row 2: Unit Price */
.cart-item-price-row {
  margin-bottom: 8px;
}

.cart-unit-price {
  font-size: 13px;
  color: #7f8c8d;
  font-weight: 500;
}

/* Row 3: Footer (Qty & Total) */
.cart-item-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto; /* Push to bottom */
}

/* Quantity Selector */
.cart-qty-selector {
  display: flex;
  align-items: center;
  background: #f8f9fa;
  border-radius: 6px;
  padding: 2px;
  border: 1px solid #e9ecef;
}

.qty-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: white;
  border-radius: 4px;
  cursor: pointer;
  color: #2c3e50;
  font-size: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.1s;
}

.qty-btn:active {
  transform: scale(0.95);
}

.qty-btn:hover {
  background: #fff;
  color: var(--accent);
}

.qty-display {
  font-weight: 600;
  font-size: 14px;
  width: 30px;
  text-align: center;
  color: #2c3e50;
}

/* Line Total */
.cart-line-total {
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  text-align: right;
  white-space: nowrap;
}

/* Responsive Adjustments */
@media (max-width: 380px) {
  .cart-item {
    grid-template-columns: 70px 1fr; /* Smaller image on very small screens */
    gap: 12px;
  }
  
  .cart-item-image-container {
    width: 70px;
    height: 80px;
  }
  
  .cart-item-title {
    font-size: 15px;
  }
  
  .cart-line-total {
    font-size: 15px;
  }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #fff;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    color: var(--accent);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--accent);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: none;
}

.modal-body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.billing-checkout {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}

.billing-checkout::before {
    content: "";
    position: absolute;
    inset: -40px;
    background:
        radial-gradient(circle at 20% 25%, rgba(123, 30, 43, 0.18) 0%, rgba(123, 30, 43, 0) 55%),
        radial-gradient(circle at 80% 20%, rgba(44, 62, 80, 0.12) 0%, rgba(44, 62, 80, 0) 55%),
        radial-gradient(circle at 60% 90%, rgba(199, 146, 65, 0.14) 0%, rgba(199, 146, 65, 0) 55%);
    filter: blur(18px);
    opacity: 0.9;
    animation: billingGlow 7.5s ease-in-out infinite;
    pointer-events: none;
}

.billing-checkout > * {
    position: relative;
    z-index: 1;
}

@keyframes billingGlow {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(10px, -8px, 0) scale(1.03); }
    100% { transform: translate3d(0, 0, 0) scale(1); }
}

.billing-checkout-title {
    font-weight: 700;
    color: var(--accent);
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
}

.billing-checkout-choice {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.billing-choice-btn {
    border: 1px solid rgba(0,0,0,0.10);
    background: rgba(255,255,255,0.70);
    backdrop-filter: blur(8px);
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 900;
    color: rgba(31,42,55,0.80);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
    min-width: 92px;
}

.billing-choice-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(123, 30, 43, 0.22);
    box-shadow: 0 10px 22px rgba(123, 30, 43, 0.10);
}

.billing-choice-btn.is-active {
    border-color: rgba(123, 30, 43, 0.35);
    background: rgba(123, 30, 43, 0.08);
    color: #7b1e2b;
    box-shadow: 0 12px 26px rgba(123, 30, 43, 0.16);
}

.billing-checkout-picked {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(0,0,0,0.08);
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    overflow: hidden;
    transition: opacity 220ms ease, transform 220ms ease, max-height 260ms ease;
}

.billing-checkout.is-picked .billing-checkout-picked {
    opacity: 1;
    transform: translateY(0);
    max-height: 140px;
}

.billing-checkout-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.billing-picked-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(123, 30, 43, 0.10);
    border: 1px solid rgba(123, 30, 43, 0.16);
    color: #7b1e2b;
    flex-shrink: 0;
}

.billing-picked-text {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.billing-picked-title {
    font-weight: 900;
    color: #2a1d1b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.billing-picked-sub {
    font-weight: 700;
    color: rgba(31,42,55,0.72);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.billing-checkout-change {
    white-space: nowrap;
}

.billing-checkout-remove {
    white-space: nowrap;
    border-color: rgba(220, 38, 38, 0.22);
    background: rgba(220, 38, 38, 0.05);
}

.billing-checkout-remove:hover {
    background: rgba(220, 38, 38, 0.08);
}

.billing-checkout-radio {
    border: 1px solid #eee;
    background: #fafafa;
    border-radius: 999px;
    padding: 8px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.billing-checkout-radio.is-selected {
    border-color: rgba(123, 30, 43, 0.35);
    background: rgba(123, 30, 43, 0.06);
    box-shadow: 0 8px 18px rgba(123, 30, 43, 0.10);
    transform: translateY(-1px);
}

.billing-checkout-radio:hover {
    transform: translateY(-1px);
    border-color: rgba(123, 30, 43, 0.22);
    background: #fff;
}

.billing-checkout-radio input {
    accent-color: var(--accent);
}

.billing-checkout-select {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 28px;
    opacity: 0;
    transform: translateY(-6px);
    max-height: 0;
    overflow: hidden;
    transition: opacity 220ms ease, transform 220ms ease, max-height 260ms ease;
}

.billing-checkout-select.is-open {
    opacity: 1;
    transform: translateY(0);
    max-height: 560px;
}

.billing-checkout-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 6px 2px 10px;
    scroll-snap-type: x proximity;
}

.billing-checkout-cards::-webkit-scrollbar {
    height: 8px;
}

.billing-checkout-cards::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.14);
    border-radius: 999px;
}

.billing-checkout-cards .billing-card {
    flex: 0 0 auto;
    min-width: 260px;
    scroll-snap-align: start;
}

.billing-choice-empty {
    text-align: center;
    font-weight: 700;
    color: rgba(31,42,55,0.70);
    padding: 12px 10px;
    border-radius: 14px;
    border: 1px dashed rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.55);
}

.billing-checkout .billing-card {
    cursor: pointer;
}

.billing-checkout .billing-card-title {
    cursor: pointer;
}

.billing-checkout .billing-card-actions {
    pointer-events: none;
}

.billing-checkout .billing-card-choice-check {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 160ms ease, transform 160ms ease;
}

.billing-checkout .billing-card.is-selected .billing-card-choice-check {
    opacity: 1;
    transform: scale(1);
}

.billing-checkout .billing-card.is-selected {
    border-color: rgba(123, 30, 43, 0.28);
    box-shadow: 0 18px 40px rgba(123, 30, 43, 0.16);
}

.billing-checkout-dropdown {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-weight: 600;
    color: #222;
}

.billing-checkout-add {
    width: 100%;
}

.billing-checkout-error {
    margin-top: 10px;
    color: #d32f2f;
    font-size: 13px;
}

.modal-footer {
    padding: 20px;
    background: #f9f9f9;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-secondary {
    padding: 12px 20px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f1f1f1;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #5a1520;
    transform: translateY(-1px);
}

.order-summary-preview {
    margin-top: 16px;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    line-height: 1.6;
}

.order-summary-preview strong {
    color: var(--accent);
}

/* ... existing styles for options ... */

.option-group h3 {
    font-size: 16px;
    margin-bottom: 12px;
    font-weight: 600;
}

.option-cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.option-card {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.option-card:hover {
  background: #fff;
  border-color: #ddd;
  transform: translateY(-2px);
}

.option-card i {
  font-size: 20px;
  color: var(--muted);
  transition: color 0.2s;
}

.option-card.selected {
  border-color: var(--accent);
  background: #fff5f6;
  box-shadow: 0 4px 12px rgba(128, 0, 32, 0.1);
}

.option-card.selected i {
  color: var(--accent);
}

.option-card span {
  font-weight: 500;
  font-size: 14px;
}

.delivery-warning {
  color: #d32f2f;
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.5;
  background: #ffebee;
  padding: 12px;
  border-radius: 8px;
  display: none;
  border: 1px solid #ffcdd2;
}

.delivery-warning.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

.payment-warning {
  color: #2f5fd3;
  font-size: 13px;
  margin-top: 8px;
  line-height: 1.5;
  background: #e8f0ff;
  padding: 12px;
  border-radius: 8px;
  display: none;
  border: 1px solid #cddcff;
}

.payment-warning.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Footer Totals */
.cart-footer {
  position: relative; /* Changed from absolute */
  background: #fff;
  padding: 24px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  z-index: 20;
  flex-shrink: 0;
}

.cart-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
  background: #fafafa;
  border-radius: 12px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--text);
}

.summary-row span:first-child {
  color: var(--muted);
}

.summary-row.total {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #ddd;
}

.checkout-btn {
  width: 100%;
  padding: 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(128, 0, 32, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.checkout-btn:hover {
  background: #5a1520;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(128, 0, 32, 0.3);
}

.checkout-btn::after {
  content: '\f061';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Empty Cart */
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, rgba(255,255,255,0.8) 0%, rgba(255,245,245,0.5) 100%);
}

.cart-empty i {
  font-size: 40px;
  color: #d7ccc8;
  background: #fff;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  margin-bottom: 24px;
}

.cart-empty p {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--accent);
  margin: 0 0 24px 0;
  font-weight: 600;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
