/* ============================================================
   MESSERWERK SHOP -- WooCommerce Feinschliff
   Ergaenzt main.css, nutzt dieselben CSS-Variablen (:root)
   ============================================================ */

/* --- Leerer Zustand / Hinweistexte --- */
.shop-empty-note {
    color: var(--text-light);
    background: var(--card-bg);
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 1.5rem 2rem;
}

/* --- Ausverkauft-Badge auf Produktkarten --- */
.product-img-wrap { position: relative; }
.product-stock-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(26,26,26,0.85);
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.7rem;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.15);
}

/* --- Produktdetail-Grid --- */
.product-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}
@media (max-width: 860px) {
    .product-detail-grid { grid-template-columns: 1fr; gap: 2rem; }
}

/* ============================================================
   PRODUKTGALERIE (eigenbau, kein WooCommerce-Flexslider)
   Mobile-first, funktioniert sofort ohne JS-Init-Timing
   ============================================================ */
.mw-gallery {
    position: relative;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

/* Hauptbild -- bewusst kompakter als quadratisch, damit die Seite nicht zu hoch wird */
.mw-gallery-main {
    position: relative;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4 / 3; /* Startwert, wird per JS auf das tatsaechliche Bildformat gesetzt */
}
.mw-gallery-main-slide {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease;
}
.mw-gallery-main-slide.is-active { opacity: 1; visibility: visible; }
.mw-gallery-main-slide img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    display: block;
}
.mw-gallery-main-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(26,26,26,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: background 0.2s ease;
}
.mw-gallery-main-nav:hover { background: var(--secondary-color); }
.mw-gallery-main-prev { left: 0.75rem; }
.mw-gallery-main-next { right: 0.75rem; }

/* Miniaturbild-Leiste: eine Reihe. Pfeile liegen als transparentes Overlay AUSSERHALB
   des Flex-Ablaufs (position: absolute) -- dadurch nehmen sie beim Ein-/Ausblenden
   nie Platz weg und nichts verschiebt sich ruckartig. */
.mw-gallery-thumbs-wrap {
    position: relative;
    margin-top: 0.8rem;
}
.mw-gallery-thumbs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.6rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    min-width: 0;
    width: 100%;
    padding: 2px;
}
.mw-gallery-thumbs::-webkit-scrollbar { display: none; }
.mw-gallery-thumb {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 6px;
    border: 2px solid transparent;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.65;
    background: var(--card-bg);
    transition: opacity 0.2s ease, border-color 0.2s ease;
}
.mw-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mw-gallery-thumb.is-active,
.mw-gallery-thumb:hover { opacity: 1; border-color: var(--accent-color); }

.mw-gallery-thumbs-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 0.8rem;
    z-index: 3;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.mw-gallery-thumbs-nav.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
.mw-gallery-thumbs-prev {
    left: 0;
    justify-content: flex-start;
    background: linear-gradient(to right, var(--bg-dark) 30%, transparent);
}
.mw-gallery-thumbs-next {
    right: 0;
    justify-content: flex-end;
    background: linear-gradient(to left, var(--bg-dark) 30%, transparent);
}
.mw-gallery-thumbs-nav i {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mw-gallery-thumbs-nav:hover i { background: var(--secondary-color); }

@media (min-width: 480px) {
    .mw-gallery-thumb { flex-basis: 70px; width: 70px; height: 70px; }
}

/* Lightbox (eigenbau, kein PhotoSwipe) */
.mw-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10,10,10,0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 2rem;
}
.mw-lightbox.is-open { display: flex; }
.mw-lightbox-img { max-width: 100%; max-height: 88vh; object-fit: contain; border-radius: 8px; }
.mw-lightbox-close,
.mw-lightbox-nav {
    position: absolute;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--white);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
}
.mw-lightbox-close:hover,
.mw-lightbox-nav:hover { background: var(--secondary-color); }
.mw-lightbox-close { top: 1.25rem; right: 1.25rem; }
.mw-lightbox-prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.mw-lightbox-next { right: 1.25rem; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
    .mw-lightbox { padding: 1rem; }
    .mw-lightbox-close, .mw-lightbox-nav { width: 38px; height: 38px; }
}

.product-detail-img-fallback {
    background: var(--card-bg);
    border: 1px dashed rgba(255,255,255,0.2);
    border-radius: 16px;
    aspect-ratio: 4 / 3;
    max-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-light);
    font-size: 2rem;
}
.product-detail-img-fallback span { font-size: 1rem; }

/* --- Kurzbeschreibung / Preis / Warenkorb --- */
.product-detail-desc {
    color: var(--text-light);
    line-height: 1.6;
    margin: 1rem 0 1.5rem;
}
.product-detail-buy { margin: 1.5rem 0; }

/* WooCommerce Add-to-Cart Formular im Theme-Look */
.product-detail-info form.cart {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.product-detail-info .quantity {
    display: inline-flex;
}
.product-detail-info .quantity .qty {
    width: 70px;
    padding: 0.75rem 0.5rem;
    text-align: center;
    background: var(--card-bg);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 1rem;
}
/* Hohe Spezifitaet noetig, um WooCommerce's eigene .button.alt Regel (lila) zu schlagen */
.product-detail-info button.single_add_to_cart_button,
.woocommerce button.single_add_to_cart_button.button,
.woocommerce button.single_add_to_cart_button.button.alt {
    background: var(--secondary-color) !important;
    color: var(--white) !important;
    border: none !important;
    padding: 0.9rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}
.woocommerce button.single_add_to_cart_button.button.alt:hover,
.product-detail-info button.single_add_to_cart_button:hover {
    background: #cf3a2c !important;
    opacity: 1 !important;
    transform: translateY(-2px);
}
.product-detail-info p.stock {
    width: 100%;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}
.product-detail-info p.stock.out-of-stock { color: var(--secondary-color); }
.product-detail-info .woocommerce-variation-add-to-cart { width: 100%; }

/* --- Technische Daten Tabelle --- */
.product-specs-table {
    width: 100%;
    border-collapse: collapse;
}
.product-specs-table tr { border-bottom: 1px solid rgba(255,255,255,0.08); }
.product-specs-table tr:last-child { border-bottom: none; }
.product-specs-table th,
.product-specs-table td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    font-size: 0.95rem;
}
.product-specs-table th {
    color: var(--text-light);
    font-weight: 500;
    width: 40%;
}
.product-specs-table td {
    color: var(--text-dark);
    font-weight: 600;
}

/* --- Generische Seiten (Impressum, Datenschutz, Fallback) --- */
.generic-page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
}
.generic-page-content {
    color: var(--text-light);
    line-height: 1.7;
    max-width: 800px;
}
.generic-page-content a { color: var(--accent-color); }

/* --- Warenkorb / Kasse / Mein Konto (WooCommerce-Standardseiten) --- */
.shop-wc-page { color: var(--text-dark); }
.shop-wc-page .generic-page-content { max-width: none; }
.shop-wc-page h1,
.shop-wc-page h2 { color: var(--text-dark); margin-bottom: 1.5rem; }
.shop-wc-page table.shop_table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
}
.shop-wc-page table.shop_table th,
.shop-wc-page table.shop_table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    color: var(--text-dark);
}
.shop-wc-page .product-thumbnail img { border-radius: 8px; width: 70px; height: auto; }
.shop-wc-page input.qty,
.shop-wc-page input[type="text"],
.shop-wc-page input[type="email"],
.shop-wc-page input[type="tel"],
.shop-wc-page input[type="password"],
.shop-wc-page select,
.shop-wc-page textarea {
    background: var(--bg-dark);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--text-dark);
    padding: 0.7rem 0.9rem;
    width: 100%;
    box-sizing: border-box;
}
.shop-wc-page label { color: var(--text-light); display: block; margin-bottom: 0.4rem; }
.shop-wc-page .button,
.shop-wc-page button[type="submit"],
.woocommerce .shop-wc-page a.button,
.woocommerce .shop-wc-page button.button,
.woocommerce .shop-wc-page input.button,
.woocommerce .shop-wc-page a.button.alt,
.woocommerce .shop-wc-page button.button.alt,
.woocommerce .shop-wc-page input.button.alt {
    background: var(--secondary-color) !important;
    color: var(--white) !important;
    border: none !important;
    padding: 0.9rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}
.woocommerce .shop-wc-page a.button:hover,
.woocommerce .shop-wc-page button.button:hover,
.woocommerce .shop-wc-page input.button:hover {
    background: #cf3a2c !important;
}
.shop-wc-page .woocommerce-message,
.shop-wc-page .woocommerce-info {
    background: var(--card-bg);
    border-left: 4px solid var(--accent-color);
    color: var(--text-dark);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    list-style: none;
    margin-bottom: 1.5rem;
}
.shop-wc-page .woocommerce-error {
    background: var(--card-bg);
    border-left: 4px solid var(--secondary-color);
    color: var(--text-dark);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    list-style: none;
    margin-bottom: 1.5rem;
}
/* --- Produktbeschreibung (lange Beschreibung, volle Breite) --- */
.product-description-section {
    padding: 1rem 0 3rem;
}
.product-description-content {
    color: var(--text-light);
    line-height: 1.7;
    max-width: 800px;
}
