/*
 Theme Name:   Divi Child Theme – Blue Level Shop
 Author:       Blue Level
 Description:  Custom Shop Layout & Styling für WooCommerce, Digitec/Galaxus-Style
 Version:      1.0
*/

/* ============================
   1. GLOBAL VARIABLES
============================ */
:root {
  --bl-blue: #2980b9;
  --bl-blue-dark: #006a9b;
  --bl-grey-light: #f4f4f4;
  --bl-text: #333333;
  --bl-border: #dddddd;
  --bl-radius: 6px;
}

/* ============================
   2. TYPOGRAFIE
============================ */
body, p, td, table {
  font-family: "Open Sans", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--bl-text);
}

h1 {
  font-size: 35px;
  font-weight: 200;
  line-height: 1.2;
}

h2 {
  font-size: 25px;
  font-weight: 200;
  line-height: 1.3;
}

h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

a {
  color: var(--bl-blue-dark);
  text-decoration: none;
}
a:hover {
  color: var(--bl-blue);
}

/* ============================
   3. PRODUKTGRID (3–4 Spalten)
============================ */
.bl-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-gap: 25px;
  margin-top: 30px;
}

.bl-product-card {
  background: #ffffff;
  border: 1px solid var(--bl-border);
  border-radius: var(--bl-radius);
  padding: 15px;
  text-align: center;
  transition: box-shadow .2s ease;
}

.bl-product-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.09);
}

.bl-product-card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  margin-bottom: 12px;
}

.bl-product-category {
  font-size: 13px;
  color: var(--bl-blue);
  font-weight: 600;
}

.bl-product-title {
  font-size: 15px;
  font-weight: 700;
  margin: 5px 0 10px;
  min-height: 40px;
}

.bl-price-incl {
  font-weight: 700;
  font-size: 18px;
  color: #000;
}

.bl-price-excl {
  font-size: 14px;
  color: #666666;
  margin-top: -4px;
}

.bl-product-btn {
  display: inline-block;
  margin-top: 12px;
  background: var(--bl-blue);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--bl-radius);
  font-size: 14px;
  font-weight: 600;
}
.bl-product-btn:hover {
  background: var(--bl-blue-dark);
}

/* ============================
   4. FILTERBAR – Digitec/Galaxus-Stil
============================ */
.bl-filterbar {
  background: var(--bl-grey-light);
  padding: 15px;
  border-radius: var(--bl-radius);
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bl-filter-dropdown {
  background: #fff;
  border: 1px solid var(--bl-border);
  padding: 8px 10px;
  border-radius: var(--bl-radius);
  cursor: pointer;
  font-size: 14px;
}

.bl-filter-dropdown:hover {
  border-color: var(--bl-blue);
}

/* ============================
   5. SIDEBAR BOXEN
============================ */
.bl-sidebar-box {
  background: #fff;
  border: 1px solid var(--bl-border);
  padding: 15px;
  border-radius: var(--bl-radius);
  margin-bottom: 20px;
}

.bl-sidebar-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
}

/* ============================
   6. PRODUKTSEITE
============================ */
.bl-product-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 40px;
  margin-bottom: 50px;
}

.bl-product-main-img img {
  width: 100%;
  height: auto;
}

.bl-product-info h1 {
  margin-bottom: 10px;
}

.bl-product-highlights ul {
  padding-left: 18px;
  margin-top: 15px;
}
.bl-product-highlights li {
  margin-bottom: 8px;
}

/* ============================
   7. FOOTER
============================ */
.bl-footer {
  background: #222;
  color: #ddd;
  padding: 40px 0;
  margin-top: 40px;
}

.bl-footer h3 {
  color: #fff;
  margin-bottom: 12px;
}

.bl-footer a {
  color: #ddd;
}
.bl-footer a:hover {
  color: #fff;
}

/* =========================
   PRODUCT GRID – Blue Level
========================= */

.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 30px 0;
}

@media (max-width: 1200px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr;
    }
}

.woocommerce ul.products li.product {
    background: #ffffff;
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    padding: 16px;
    text-align: left;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.woocommerce ul.products li.product:hover {
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* Produktbild */
.woocommerce ul.products li.product img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 12px;
}

/* Kategorie */
.woocommerce ul.products li.product .posted_in,
.woocommerce ul.products li.product .product-category {
    font-size: 13px;
    font-weight: 600;
    color: #2980b9;
    margin-bottom: 4px;
}

/* Titel */
.woocommerce ul.products li.product h2,
.woocommerce ul.products li.product .woocommerce-loop-product__title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 6px 0 10px;
    min-height: 42px;
}

/* Preisbox (kommt aus deinem PHP-Code) */
.bl-price-box {
    margin-bottom: 12px;
}

.bl-price-incl {
    font-size: 18px;
    font-weight: 700;
    color: #000;
}

.bl-price-excl {
    font-size: 14px;
    color: #666;
}

/* Button */
.woocommerce ul.products li.product a.button {
    display: inline-block;
    margin-top: 10px;
    background: #2980b9;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.woocommerce ul.products li.product a.button:hover {
    background: #006a9b;
}

/* =========================
   FORCE GRID – DISABLE WC FLOAT LAYOUT
========================= */

.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.woocommerce ul.products li.product {
    float: none !important;
    width: auto !important;
    clear: none !important;
    margin: 0 !important;
}

/* Tablet */
@media (max-width: 1200px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 767px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   BLUE LEVEL – SHOP GRID FIX + DIGITEC STYLE
   ========================================================= */

/* --- WICHTIG: Float-Layout von Divi neutralisieren --- */
.woocommerce ul.products {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin: 0;
}

.woocommerce ul.products li.product {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
}

/* --- Produktkarte Grunddesign --- */
.woocommerce ul.products li.product {
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 14px;
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.woocommerce ul.products li.product:hover {
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* --- Produktbild vereinheitlichen --- */
.woocommerce ul.products li.product img {
    aspect-ratio: 4 / 3;
    object-fit: contain;
    background: #fafafa;
    padding: 10px;
    margin-bottom: 8px;
}

/* --- Produkttitel (technisch, kompakt) --- */
.woocommerce ul.products li.product h2,
.woocommerce ul.products li.product h3 {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin: 10px 0 6px;
    color: #333333;
}

/* --- Preisbox (inkl. / exkl. MwSt) --- */
.bl-price-box {
    margin-top: 8px;
}

.bl-price-incl {
    font-size: 15px;
    font-weight: 700;
    color: #000000;
    margin-bottom: 2px;
}

.bl-price-excl {
    font-size: 13px;
    color: #666666;
}

/* --- Button: klarer Commerce-Stil --- */
.woocommerce ul.products li.product a.button {
    background: #2980b9;
    color: #ffffff;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    margin-top: 10px;
    display: inline-block;
}

.woocommerce ul.products li.product a.button:hover {
    background: #006a9b;
}

/* --- Sale Badge sauber positionieren --- */
.woocommerce span.onsale {
    background: #f2994a;
    color: #ffffff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    top: 10px;
    left: 10px;
    right: auto;
}

/* --- Sidebar Abstand korrigieren (verhindert Ghost-Slots) --- */
@media (min-width: 981px) {
    .et_right_sidebar #main-content .container:before {
        display: none;
    }
}

/* =========================================================
   BLUE LEVEL – DIVI + WOOCOMMERCE SHOP FIX (FINAL)
   ========================================================= */

/* 1️ Divi-Float-Logik komplett ausschalten */
.woocommerce ul.products,
.woocommerce-page ul.products {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 24px !important;
    margin: 0 !important;
}

@media (max-width: 1200px) {
    .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
    }
}

/* 2️ Alle Divi-Spalten & Floats neutralisieren */
.woocommerce ul.products li.product {
    float: none !important;
    width: auto !important;
    clear: none !important;
    margin: 0 !important;
}

/* 3️ Ghost-Produkt (leeres erstes Feld) entfernen */
.woocommerce ul.products li.product:empty,
.woocommerce ul.products li.product.first:empty {
    display: none !important;
}

/* 4️ Divi :before Hack entfernen (verursacht leeren Slot) */
.et_right_sidebar #main-content .container:before,
.et_left_sidebar #main-content .container:before {
    display: none !important;
}

/* 5️ Sicherheit: Nur echte Produkte anzeigen */
.woocommerce ul.products li.product:not(:has(*)) {
    display: none !important;
}

/* =========================================================
   BLUE LEVEL – DIVI SHOP GRID ALIGNMENT FIX
   Ursache: 3/4-Spalte + Grid-Zentrierung
   ========================================================= */

/* 1️ Grid IMMER links ausrichten */
.woocommerce ul.products {
    justify-content: start !important;
    align-content: start !important;
}

/* 2️ Standard: 3 Spalten NUR bei genug Platz */
.et_pb_column_3_4 .woocommerce ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* 3️ Fallback: wenn Sidebar aktiv → 2 Spalten */
@media (max-width: 1400px) {
    .et_pb_column_3_4 .woocommerce ul.products {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* 4️ Fullwidth-Layouts dürfen 3–4 Spalten */
.et_pb_section:not(.et_pb_specialty_section) 
.woocommerce ul.products {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

/* 5️ Mobile sauber */
@media (max-width: 600px) {
    .woocommerce ul.products {
        grid-template-columns: 1fr !important;
    }
}
