/**
 * Hangar3 — Shop CSS
 * shop.css
 *
 * Einbinden via functions.php:
 *   wp_enqueue_style('hangar3-shop', get_template_directory_uri() . '/css/shop.css');
 *
 * Passt die Farben an das Hangar3-Branding an.
 * CSS Custom Properties oben anpassen.
 */

/* ─── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  --shop-accent:       #1a1a1a;      /* Hauptfarbe → Hangar3-Primärfarbe */
  --shop-accent-hover: #333333;
  --shop-badge-bg:     #e63946;      /* Warenkorb-Badge Rot */
  --shop-badge-text:   #ffffff;
  --shop-radius:       6px;
  --shop-font:         inherit;      /* erbt vom WordPress-Theme */
  --shop-drawer-width: 420px;
  --shop-transition:   .2s ease;
}

/* ─── Header Cart Icon ─────────────────────────────────────────────────────── */
#cart-icon-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

#cart-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--shop-badge-bg);
  color: var(--shop-badge-text);
  border-radius: 50%;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  display: none;                     /* via JS auf flex gesetzt wenn > 0 */
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* ─── Produktgrid ──────────────────────────────────────────────────────────── */
.hangar3-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
  padding: 0;
}

.hangar3-product-card {
  border: 1px solid #e5e5e5;
  border-radius: var(--shop-radius);
  overflow: hidden;
  background: #fff;
  transition: box-shadow var(--shop-transition);
  display: flex;
  flex-direction: column;
}

.hangar3-product-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}

.hangar3-product-img {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f5f5;
}

.hangar3-product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}

.hangar3-product-card:hover .hangar3-product-img img {
  transform: scale(1.04);
}

.hangar3-product-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.hangar3-product-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
  color: #1a1a1a;
}

.hangar3-product-price {
  font-size: 14px;
  color: #555;
  margin: 0;
}

.hangar3-variant-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: var(--shop-radius);
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

.hangar3-add-to-cart {
  margin-top: auto;
  width: 100%;
  padding: 10px 16px;
  background: var(--shop-accent);
  color: #fff;
  border: none;
  border-radius: var(--shop-radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--shop-transition), opacity var(--shop-transition);
}

.hangar3-add-to-cart:hover:not(:disabled) {
  background: var(--shop-accent-hover);
}

.hangar3-add-to-cart:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.hangar3-unavailable {
  font-size: 13px;
  color: #999;
  font-style: italic;
}

.hangar3-loading,
.hangar3-error {
  font-size: 14px;
  color: #777;
  padding: 24px 0;
  text-align: center;
}

/* ─── Cart Overlay ─────────────────────────────────────────────────────────── */
#hangar3-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--shop-transition);
}

#hangar3-cart-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* ─── Cart Drawer ──────────────────────────────────────────────────────────── */
#hangar3-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--shop-drawer-width);
  max-width: 100vw;
  height: 100dvh;
  background: #fff;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  box-shadow: -4px 0 32px rgba(0, 0, 0, .12);
}

#hangar3-cart-drawer.is-open {
  transform: translateX(0);
}

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

.hangar3-cart-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.hangar3-cart-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #555;
  line-height: 1;
  padding: 0 4px;
}

.hangar3-cart-close:hover {
  color: #000;
}

#hangar3-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hangar3-cart-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.hangar3-cart-item-img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  background: #f5f5f5;
  flex-shrink: 0;
}

.hangar3-cart-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hangar3-cart-item-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

.hangar3-cart-item-variant {
  font-size: 12px;
  color: #888;
  margin: 0;
}

.hangar3-cart-item-qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.hangar3-qty-btn {
  width: 26px;
  height: 26px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--shop-transition);
}

.hangar3-qty-btn:hover {
  background: #f5f5f5;
}

.hangar3-cart-item-price {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  color: #1a1a1a;
}

.hangar3-cart-empty {
  text-align: center;
  color: #999;
  font-size: 14px;
  padding: 40px 0;
}

/* ─── Cart Footer ──────────────────────────────────────────────────────────── */
.hangar3-cart-footer {
  padding: 20px 24px;
  border-top: 1px solid #eee;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#hangar3-cart-total {
  font-size: 15px;
  font-weight: 600;
  text-align: right;
}

.hangar3-checkout-btn {
  width: 100%;
  padding: 14px;
  background: var(--shop-accent);
  color: #fff;
  border: none;
  border-radius: var(--shop-radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--shop-transition);
}

.hangar3-checkout-btn:hover:not(:disabled) {
  background: var(--shop-accent-hover);
}

.hangar3-checkout-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #hangar3-cart-drawer {
    --shop-drawer-width: 100vw;
  }

  .hangar3-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
  }
}
