/* ============================================
   CART PANEL STYLES
   ============================================ */

/* Overlay backdrop */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-mid);
}

.cart-overlay.open {
  opacity: 1;
  pointer-events: all;
}

/* Sliding panel from bottom */
.cart-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.18);
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform var(--transition-mid);
}

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

/* Drag handle */
.cart-panel-handle {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: var(--space-sm) auto var(--space-xs);
  flex-shrink: 0;
}

/* Header */
.cart-panel-header {
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.cart-panel-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.cart-close-btn {
  width: 32px;
  height: 32px;
  background: var(--color-bg);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--color-text-muted);
  transition: background var(--transition-fast);
}

.cart-close-btn:hover {
  background: var(--color-border);
}

/* Cart items list */
.cart-items-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
}

/* Empty cart state */
.cart-empty {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--color-text-muted);
}

.cart-empty .cart-empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* Cart item row */
.cart-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-img {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}

.cart-item-details {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-price {
  font-size: var(--font-size-sm);
  color: var(--color-primary-dark);
  font-weight: 600;
  margin-top: 2px;
}

/* Quantity controls */
.qty-controls {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

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

.qty-value {
  font-size: var(--font-size-md);
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

/* Footer with total + checkout */
.cart-panel-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  flex-shrink: 0;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.cart-total-label {
  font-size: var(--font-size-md);
  color: var(--color-text-muted);
}

.cart-total-amount {
  font-size: var(--font-size-xl);
  font-weight: 700;
  color: var(--color-text);
}

.btn-checkout-whatsapp {
  width: 100%;
  padding: var(--space-md);
  font-size: var(--font-size-md);
  border-radius: var(--radius-md);
  background: #25d366;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(37,211,102,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

.btn-checkout-whatsapp:hover {
  background: #1da851;
}

/* ── Checkout Info Modal ── */
.checkout-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 210;
  opacity: 0;
  transition: opacity var(--transition-mid);
  pointer-events: none;
}

.checkout-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.checkout-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 211;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--space-sm) var(--space-lg) calc(var(--space-lg) + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 30px rgba(0,0,0,0.18);
  transform: translateY(100%);
  transition: transform var(--transition-mid);
  max-height: 90dvh;
  overflow-y: auto;
}

.checkout-modal.open {
  transform: translateY(0);
}

.checkout-modal-handle {
  width: 40px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: var(--space-sm) auto var(--space-md);
}

.checkout-modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  margin-bottom: var(--space-xs);
}

.checkout-modal-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: center;
  margin-bottom: var(--space-lg);
}

.checkout-modal-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.checkout-review {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.checkout-review-block {
  border: 1px solid rgba(137, 97, 50, 0.24);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fffaf2 0%, #f7ecda 100%);
  padding: var(--space-sm) var(--space-md);
}

.checkout-review-title {
  margin: 0 0 var(--space-xs);
  font-size: 0.85rem;
  color: #62431d;
}

.checkout-review-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkout-review-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.78rem;
  color: #5f4524;
}

.checkout-review-item-name {
  font-weight: 700;
}

.checkout-review-item-meta {
  font-weight: 600;
  color: #7b5a2f;
}

.checkout-review-total-row {
  margin-top: var(--space-sm);
  padding-top: var(--space-xs);
  border-top: 1px dashed rgba(134, 95, 51, 0.36);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  color: #5f421e;
}

.checkout-review-count {
  font-size: 0.72rem;
  font-weight: 800;
  color: #355a89;
  background: rgba(47, 79, 126, 0.12);
  border: 1px solid rgba(47, 79, 126, 0.22);
  border-radius: 999px;
  padding: 3px 8px;
}

.checkout-review-customer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  color: #5f4524;
}

.checkout-review-customer p {
  margin: 0;
}

.checkout-review-customer strong {
  color: #4d3619;
}

.checkout-review-edit-btn {
  margin-top: var(--space-sm);
  width: 100%;
  border: 1px solid rgba(129, 90, 47, 0.32);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.7);
  color: #5d401c;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 10px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.checkout-review-edit-btn:hover {
  background: rgba(200, 169, 110, 0.2);
  border-color: rgba(129, 90, 47, 0.46);
}

.checkout-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.checkout-field label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
}

.checkout-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-arabic);
  font-size: var(--font-size-md);
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  direction: rtl;
}

.checkout-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(200,169,110,0.18);
}

.checkout-input.input-error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(224,92,92,0.14);
}

.checkout-modal-actions {
  display: flex;
  gap: var(--space-sm);
}

.checkout-modal-actions > button {
  flex: 1;
}

.checkout-modal-btn-cancel {
  padding: var(--space-sm) var(--space-md);
}

.checkout-modal-btn-confirm {
  flex: 2;
  padding: var(--space-sm) var(--space-md);
  background: #25d366;
  box-shadow: 0 4px 14px rgba(37,211,102,0.30);
}

.checkout-modal-btn-confirm:hover {
  background: #1da851;
}

.checkout-modal-btn-back {
  padding: var(--space-sm) var(--space-md);
}

.checkout-modal-btn-send {
  flex: 2;
  padding: var(--space-sm) var(--space-md);
  background: #25d366;
  box-shadow: 0 4px 14px rgba(37,211,102,0.30);
}

.checkout-modal-btn-send:hover {
  background: #1da851;
}

.checkout-modal-btn-send.is-loading {
  opacity: 0.8;
  cursor: wait;
}

/* ── Bottom Navigation ── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 150;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--space-sm) 0;
  cursor: pointer;
  color: var(--color-text-muted);
  transition: color var(--transition-fast), transform var(--transition-fast);
  user-select: none;
}

.nav-item:active {
  transform: scale(0.88);
}

.nav-item.active {
  color: var(--color-primary);
}

.nav-item .nav-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
}

/* Active indicator dot */
.nav-item.active .nav-icon {
  position: relative;
}

.nav-item.active .nav-icon::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}
