/* ========================================
   ULTRA FLYOUT CART - CLEAN & ORGANIZED CSS
======================================== */

/* ========================================
   1. OVERLAY & MAIN PANEL
======================================== */

/* Overlay background */
.ultra-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 9998;
}

.ultra-cart-overlay.is-active,
body.ultra-cart-open .ultra-cart-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* Main flyout panel */
.ultra-flycart,
#ultra-flyout-cart {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(420px, 92vw);
  background: #fff;
  box-shadow: -12px 0 30px rgba(0, 0, 0, .15);
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  border-left: 1px solid #eee;
}

.ultra-flycart.is-open,
body.ultra-cart-open #ultra-flyout-cart {
  transform: translateX(0);
}

/* Scroll lock when cart is open */
html.ufc-lock,
body.ultra-cart-open {
  overflow: hidden;
}

/* ========================================
   2. HEADER
======================================== */

.ufc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #f1f1f1;
  background: #fafafa;
}

.ufc-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #111;
}

.ufc-close {
  background: none;
  border: 0;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color .2s ease;
}

.ufc-close:hover {
  background: rgba(0, 0, 0, .1);
}

/* ========================================
   3. BODY / CART ITEMS
======================================== */

.ufc-body {
  flex: 1;
  overflow: auto;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* Empty cart message */
.ufc-body .woocommerce-mini-cart__empty-message {
  padding: 40px 20px;
  color: #666;
  text-align: center;
  font-style: italic;
}

/* Mini cart list */
.ultra-flycart .woocommerce-mini-cart {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ========================================
   4. CART ITEM LAYOUT - CORRECTED TO MATCH IMAGE 2
======================================== */

.ultra-flycart .woocommerce-mini-cart .mini_cart_item {
  position: relative;
  padding: 20px;
  border-bottom: 1px solid #f0f0f0;
  display: block; /* Changed from grid to block for vertical stacking */
}

.ultra-flycart .woocommerce-mini-cart .mini_cart_item:last-child {
  border-bottom: none;
}

/* Remove button - top right corner */
.ultra-flycart .woocommerce-mini-cart .mini_cart_item > a.remove {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  line-height: 1;
  text-align: center;
  border-radius: 50%;
  background: #f5f5f5;
  color: #999;
  font-size: 18px;
  text-decoration: none;
  transition: all .2s ease;
  z-index: 2;
}

.ultra-flycart .woocommerce-mini-cart .mini_cart_item > a.remove:hover {
  background: #ff4757;
  color: white;
  transform: scale(1.1);
}

/* Product image - centered and full width */
.ultra-flycart .woocommerce-mini-cart .mini_cart_item img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  display: block;
  margin: 0 auto 16px auto; /* Center the image and add space below */
}

/* Product info container - below the image */
.ultra-flycart .mini-cart-product-info {
  text-align: center; /* Center align all text */
  padding-right: 40px; /* Space for remove button */
}

/* Product title - centered below image */
.ultra-flycart .woocommerce-mini-cart .mini_cart_item > a:not(.remove) {
  display: block;
  text-decoration: none;
  color: #111;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  margin-bottom: 12px;
  transition: color .2s ease;
  text-align: left;
}

.ultra-flycart .woocommerce-mini-cart .mini_cart_item > a:not(.remove):hover {
  color: #007cba;
  text-decoration: none;
}

/* Quantity and Price Container - centered below title */
.ultra-flycart .mini-cart-details {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center; /* Center the quantity and price */
  margin-top: 8px;
}

/* Quantity display with background */
.ultra-flycart .mini-cart-quantity {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-weight: 500;
  color: #495057;
  min-width: 60px;
  text-align: center;
}

/* Price display */
.ultra-flycart .mini-cart-price {
  font-size: 16px;
  font-weight: 600;
  color: #111;
}

/* Quantity controls (if using interactive quantity) */
.ultra-flycart .ufc-qty {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 2px;
  background: #fafafa;
}

.ultra-flycart .ufc-qty-btn {
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  border: 0;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color .2s ease;
}

.ultra-flycart .ufc-qty-btn:hover {
  background: rgba(0, 0, 0, .1);
}

.ultra-flycart .ufc-qty-input {
  width: 32px;
  text-align: center;
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  padding: 0;
  font-size: 13px;
}

/* ========================================
   5. CART TOTAL
======================================== */

.ultra-flycart .woocommerce-mini-cart__total {
  padding: 20px;
  border-top: 2px solid #f0f0f0;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ========================================
   6. FOOTER BUTTONS - FULL WIDTH WITH PROPER PADDING
======================================== */

.ufc-foot {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
  /* Ensure padding matches container width */
  box-sizing: border-box;
}

.ufc-link-cart,
.ufc-link-checkout {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 48px;
  width: 100%;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 14px;
  transition: all .2s ease;
  /* Remove any margin that might cause misalignment */
  margin: 0;
  box-sizing: border-box;
}

/* Cart button - secondary style */
.ufc-link-cart {
  background: #fff;
  color: #111;
  border: 2px solid #111;
}

.ufc-link-cart:hover {
  background: #111;
  color: #fff;
  text-decoration: none;
}

/* Checkout button - primary style */
.ufc-link-checkout {
  background: #111;
  color: #fff;
  border: 2px solid #111;
}

.ufc-link-checkout:hover {
  background: #333;
  border-color: #333;
  text-decoration: none;
}

/* ========================================
   7. RESPONSIVE DESIGN
======================================== */

@media (max-width: 480px) {
  .ultra-flycart,
  #ultra-flyout-cart {
    width: 100vw;
  }
  
  .ultra-flycart .woocommerce-mini-cart .mini_cart_item {
    padding: 16px;
    grid-template-columns: 80px 1fr;
    gap: 12px;
  }
  
  .ultra-flycart .woocommerce-mini-cart .mini_cart_item img {
    width: 80px;
    height: 80px;
  }
  
  .ultra-flycart .mini-cart-product-info {
    min-height: 80px;
  }
  
  .ufc-head {
    padding: 16px;
  }
  
  .ufc-foot {
    padding: 16px;
  }
}

@media (max-width: 360px) {
  .ultra-flycart .mini-cart-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .ultra-flycart .mini-cart-quantity {
    align-self: flex-start;
  }
}

/* ========================================
   8. ACCESSIBILITY & INTERACTIONS
======================================== */

/* Focus states */
.ufc-close:focus,
.ufc-link-cart:focus,
.ufc-link-checkout:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Remove default link styles */
.ultra-flycart a {
  text-decoration: none;
}

.ultra-flycart a:hover,
.ultra-flycart a:focus {
  text-decoration: none;
}

/* Smooth scrolling in cart body */
.ufc-body {
  scroll-behavior: smooth;
}

/* ========================================
   9. ANIMATION REFINEMENTS
======================================== */

/* Slide in animation */
@keyframes slideInFromRight {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

.ultra-flycart.is-open,
body.ultra-cart-open #ultra-flyout-cart {
  animation: slideInFromRight 0.3s ease-out;
}

/* Loading state for dynamic updates */
.ultra-flycart.loading {
  pointer-events: none;
  opacity: 0.7;
}

.ultra-flycart.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #111;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 10;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#content > aside > p.woocommerce-mini-cart__buttons.buttons {
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 10px;
}
.woocommerce-Price-amount {color:#958e09;}

/* Grundlayout-Helpers */
.ultra-cart-open { overflow: hidden; }
[data-ultra-cart-overlay][hidden] { display: none !important; }

/* Ladezustand während AJAX */
.ultra-flycart.is-loading .ufc-body {
  opacity: .55;
  pointer-events: none;
  transition: opacity .15s ease;
}

/* Entfernen-Link sichtbar platzieren (falls Theme den innen rechts oben rendert) */
.woocommerce-mini-cart .remove_from_cart_button {
  text-decoration: none;
}

/* Loader-Zustand */
.ultra-flycart.is-loading .ufc-body { opacity:1; pointer-events:auto; transition:opacity .15s; }
/* Overlay visibility helper */
[data-ultra-cart-overlay][hidden]{ display:none !important; }



/* Optional: eigene Footer-Buttons nutzen (Mini-Cart-Buttons ausblenden) */
.woocommerce-mini-cart__buttons { display: none !important; }

/* ========================================
   MINIMALE BARRIEREFREIHEIT ERGÄNZUNGEN
   Einfach am Ende der bestehenden CSS-Dateien anhängen
======================================== */

/* Screen Reader Utility - unsichtbar aber für Screenreader da */
.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Nur bei Tastaturfokus sichtbar machen */
.screen-reader-text--focus:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 8px 16px !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
  background: #000 !important;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 4px !important;
  z-index: 100000 !important;
}

/* Dezenter Fokus-Indikator - nur dünne Linie, deine Farben */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus,
[tabindex]:focus {
  outline: 0px solid #111 !important;
  outline-offset: 2px !important;
}

/* Für helle Buttons dunkler Fokus */
.button:focus,
.btn:focus {
  outline-color: #333 !important;
}

/* Mindest-Touch-Target für Mobile - aber nur Padding, keine sichtbaren Änderungen */
/* Nur kritische Interactive Elements */
.woocommerce .single_add_to_cart_button,
.woocommerce .checkout-button,
.woocommerce a.remove,
.ultra-wishlist-btn,
.ultra-wish,
.ufc-close,
.ucs-coupon-btn,
button[type="submit"],
input[type="submit"] {
  min-height: 30px;
  min-width: 30px;
}

/* Reduced Motion - Respektiert Nutzer-Einstellungen */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Nur für Screenreader - Live Region für Cart Updates */
.cart-status-announcer {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Besserer Kontrast nur bei Bedarf - High Contrast Mode */
@media (prefers-contrast: high) {
  button,
  .button,
  input,
  select {
    border-width: 2px !important;
  }
}

/* Das war's! Minimale Änderungen, maximale Wirkung */