/*
 Theme Name:   Divi Child - TM Moto
 Theme URI:    https://tmmoto-sklep.bigus.studio
 Description:  Child theme for TM Moto Parts Store
 Author:       Tomas / Bigus Studio
 Template:     Divi
 Version:      1.2.0
 Text Domain:  divi-child-tmmoto
*/

:root {
    --tm-navy: #0a1f44;
    --tm-blue: #00a3e0;
}

/* ══════════════════════════════════════════════════════════════════
   KATALOG — TABELA CZĘŚCI
   ══════════════════════════════════════════════════════════════════ */

.parts-diagram-container {
    margin: 40px 0;
    background: #fff;
    padding: 20px;
    border: 1px solid #e1e1e1;
}

.parts-diagram-image {
    text-align: center;
    margin-bottom: 30px;
}

.parts-diagram-image img {
    max-width: 100%;
    height: auto;
}

.parts-table-wrapper {
    overflow-x: auto;
    margin-top: 30px;
}

.parts-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.parts-table thead {
    background: #f5f5f5;
    border-bottom: 2px solid #e1e1e1;
}

.parts-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--tm-navy);
    font-size: 14px;
    text-transform: uppercase;
}

.parts-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e1e1e1;
    vertical-align: middle;
}

.parts-table tbody tr:hover { background: #f9f9f9; }

.parts-table .position-col    { width: 80px; text-align: center; font-weight: 600; color: var(--tm-navy); }
.parts-table .code-col        { width: 120px; font-family: monospace; color: #666; }
.parts-table .description-col { min-width: 300px; }
.parts-table .quantity-col    { width: 80px; text-align: center; }
.parts-table .availability-col { width: 120px; text-align: center; }
.parts-table .price-col       { width: 150px; text-align: right; }

.availability-icon {
    display: inline-block;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid #ccc;
}
.availability-icon.in-stock     { background: #46b450; border-color: #46b450; }
.availability-icon.out-of-stock { background: #dc3232; border-color: #dc3232; }

.parts-table .price {
    font-weight: 600;
    color: var(--tm-navy);
    font-size: 16px;
    margin-bottom: 5px;
}

.parts-table .add-to-cart-button {
    background: var(--tm-blue);
    color: #fff;
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.3s;
}
.parts-table .add-to-cart-button:hover { background: var(--tm-navy); }
.parts-table .not-available { color: #999; font-style: italic; }

/* SKU pogrubione, kategorie ukryte */
.single-product .sku_wrapper,
.single-product .sku        { font-weight: 700 !important; }
.single-product .posted_in  { display: none !important; }
.product_meta .posted_in    { display: none !important; }

/* WooCommerce przyciski */
.woocommerce #respond input#submit,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
    background: var(--tm-blue) !important;
    color: #fff !important;
    border: none !important;
    font-family: 'industry', sans-serif !important;
    font-weight: 600 !important;
}
.woocommerce #respond input#submit:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
    background: var(--tm-navy) !important;
    color: #fff !important;
}

/* ── Fix: Divi right_sidebar layout na stronach kategorii ─────────── */
.tax-product_cat #primary,
.tax-product_cat .content-area {
    width: 100% !important;
    float: none !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}
.tax-product_cat #secondary,
.tax-product_cat .et_pb_widget_area {
    display: none !important;
}

/* Kontener treści — max-width i padding */
.tax-product_cat .site-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 40px 60px;
    box-sizing: border-box;
}

/* Fix: parts-diagram-container max-width i padding ── */
.parts-diagram-container {
    max-width: 1200px;
    margin: 0 auto 40px;
    box-sizing: border-box;
}

/* Fix: SVG diagram wyświetlanie ── */
.parts-diagram-image img[src$=".svg"] {
    width: 100%;
    max-width: 900px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* ── Breadcrumbs ───────────────────────────────────────────────────── */
.tm-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 18px 0 0;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tm-breadcrumbs a {
    color: #7a8fa6;
    text-decoration: none;
    transition: color 0.2s;
}

.tm-breadcrumbs a:hover {
    color: var(--tm-blue);
}

.tm-breadcrumb-sep {
    color: #c8d4e0;
    font-size: 14px;
    line-height: 1;
}

.tm-breadcrumb-current {
    color: var(--tm-blue);
}

/* ── Subcategory grid ──────────────────────────────────────────────── */
.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    margin: 32px 0 60px;
    padding: 0;
}

.subcategory-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.subcategory-card:hover {
    transform: translateY(-5px);
    border-color: var(--tm-blue);
    box-shadow: 0 16px 32px rgba(10, 31, 68, 0.1), 0 0 0 1px rgba(0, 163, 224, 0.15);
}

/* Image area — dark background */
.subcategory-visual {
    position: relative;
    width: 100%;
    height: 160px;
    background: linear-gradient(155deg, #0e2656 0%, #071630 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.subcategory-visual::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 163, 224, 0.4), transparent);
}

.subcategory-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.35s ease;
}

.subcategory-card:hover .subcategory-visual img {
    transform: scale(1.04);
}

/* Placeholder when no image */
.subcategory-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(155deg, #0e2656 0%, #071630 100%);
}

/* Info area — light */
.subcategory-info {
    padding: 16px 18px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.subcategory-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--tm-navy);
    margin: 0;
    line-height: 1.2;
    letter-spacing: 0.01em;
}

.subcategory-count {
    font-size: 12px;
    font-weight: 500;
    color: #7a8fa6;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.subcategory-count-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--tm-blue);
    opacity: 0.7;
    flex-shrink: 0;
}

/* Arrow — appears on hover */
.subcategory-arrow {
    position: absolute;
    bottom: 16px;
    right: 18px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tm-blue);
    font-size: 13px;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.subcategory-card:hover .subcategory-arrow {
    opacity: 1;
    transform: translateX(0);
    background: rgba(0, 163, 224, 0.08);
    border-color: rgba(0, 163, 224, 0.3);
}

/* ── Mobile — tabela części ────────────────────────────────────────── */
@media screen and (max-width: 768px) {
    .parts-table-wrapper { overflow-x: visible; }
    .parts-table { display: block; font-size: 14px; }
    .parts-table thead { display: none; }
    .parts-table tbody { display: block; }
    .parts-table tbody tr { display: block; border-bottom: 2px solid #ddd; padding: 10px; }
    .parts-table tbody tr:last-child { border-bottom: none; }
    .parts-table tbody td { padding: 0 !important; border: none; line-height: 1.5; }

    .parts-table .position-col,
    .parts-table .code-col,
    .parts-table .description-col {
        display: inline-block !important; vertical-align: top !important;
    }
    .parts-table .position-col { font-weight: 700; font-size: 14px; color: var(--tm-navy); margin-right: 10px; width: auto !important; }
    .parts-table .code-col     { font-weight: 600; font-size: 14px; color: #333; margin-right: 10px; width: auto !important; }
    .parts-table .description-col { font-size: 14px; width: calc(100% - 120px) !important; }
    .parts-table .description-col a { color: var(--tm-blue); text-decoration: none; }
    .parts-table .description-col::after { content: ""; display: block; height: 6px; }

    .parts-table .quantity-col,
    .parts-table .availability-col { display: inline-block !important; vertical-align: middle; margin-right: 12px; }
    .parts-table .availability-icon { width: 12px; height: 12px; }

    .parts-table .price-col { display: block !important; float: right !important; width: auto !important; text-align: right !important; }
    .parts-table .price-and-cart { display: flex !important; flex-direction: row !important; align-items: center !important; gap: 10px !important; }
    .parts-table .price { font-size: 14px; white-space: nowrap; order: 1; }
    .parts-table .add-to-cart-button { padding: 6px 12px; font-size: 12px; white-space: nowrap; order: 2; }
    .parts-table tbody tr::after { content: ""; display: table; clear: both; }

    .subcategories-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
        margin: 20px 0 40px;
    }
    .subcategory-visual { height: 120px; }
    .subcategory-info   { padding: 12px 14px 10px; }
    .subcategory-title  { font-size: 14px; }
    .subcategory-count  { font-size: 11px; }
    .subcategory-arrow  { display: none; }
}

@media screen and (max-width: 380px) {
    .parts-table .price-col { display: block !important; float: none !important; width: 100% !important; margin-top: 6px; }
    .parts-table .price-and-cart { justify-content: space-between !important; }
}