/* =============================================================
   JMT Browser – Frontend Stylesheet v2.0.0
   Author: Dirk Zaal, Digizaal
   ============================================================= */

/* ── Layout ──────────────────────────────────────────────────── */
.jmt-container {
    display: flex;
    gap: 1em;
    align-items: flex-start;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.jmt-sidebar {
    width: 230px;
    flex-shrink: 0;
    padding: 0.45em;
    background: #f5f5f5;
    border-radius: 4px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.jmt-sidebar h3 {
    margin: 0 0 0.5em;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #333;
}

/* Sidebar accordion */
.jmt-accordion {
    margin-bottom: 0.6em;
}
.jmt-acc-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: 0;
    padding: 0.32em 0.15em;
    margin: 0;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.92em;
    font-weight: 600;
    color: #333;
}
.jmt-acc-icon {
    font-size: 0.95em;
    opacity: 0.8;
    transform: rotate(0deg);
    transition: transform 120ms ease;
}
/* Fast slide animation (ease-in-out) */
.jmt-acc-panel {
    margin-top: 0.3em;
    overflow: hidden;
    max-height: 1200px;
    opacity: 1;
    transition: max-height 160ms ease-in-out, opacity 160ms ease-in-out, margin-top 160ms ease-in-out;
}
.jmt-accordion.is-collapsed .jmt-acc-panel {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}
.jmt-accordion.is-collapsed .jmt-acc-icon {
    transform: rotate(-90deg);
}
.jmt-category-list {
    list-style: none;
    margin: 0 0 1.5em;
    padding: 0;
}
.jmt-category-list li {
    padding: 0.28em 0.42em;
    margin: 0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.82em;
    transition: background 0.15s;
}
.jmt-category-list li:hover {
    background: #e0e0e0;
}
.jmt-category-list li.selected {
    background: #51af2f;
    color: #fff;
}

/* ── Colour filter list (sidebar) ────────────────────────────── */
.jmt-color-list {
    list-style: none;
    margin: 0 0 1.5em;
    padding: 0;
}
.jmt-color-list li {
    padding: 0.28em 0.42em;
    margin: 0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.82em;
    transition: background 0.15s;
}
.jmt-color-list li:hover {
    background: #e0e0e0;
}
.jmt-color-list li.selected {
    background: #51af2f;
    color: #fff;
}

/* Colour swatch + label layout */
.jmt-color-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}
.jmt-swatch {
    width: 1em;
    height: 1em;
    display: inline-block;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.25);
    box-sizing: border-box;
    background: #ccc;
}
.jmt-swatch--all {
    background: linear-gradient(135deg, #ddd 0%, #bbb 100%);
}

/* Swatch palette (stable slugs, used across NL/EN labels) */
.jmt-swatch--beige { background: #d8c3a5; }
.jmt-swatch--sand { background: #c2b280; }
.jmt-swatch--donker-blauw { background: #1a3a6b; }
.jmt-swatch--beuken, .jmt-swatch--beech { background: #e0c68e; }
.jmt-swatch--blauw, .jmt-swatch--blue { background: #2f6db2; }
.jmt-swatch--bruin-hout, .jmt-swatch--brown-wood { background: #6b4f3a; }
.jmt-swatch--geel, .jmt-swatch--yellow { background: #f2c200; }
.jmt-swatch--grijs, .jmt-swatch--grey, .jmt-swatch--gray { background: #7a7a7a; }
.jmt-swatch--grey-green, .jmt-swatch--grijs-groen { background: #6f7f70; }
.jmt-swatch--groen, .jmt-swatch--green { background: #2f7d4c; }
.jmt-swatch--licht-blauw, .jmt-swatch--light-blue { background: #74b6e6; }
.jmt-swatch--lungo-legero { background: #a58b6a; }
.jmt-swatch--metaal-transparant, .jmt-swatch--metal-transparent { background: #a9b0b6; }
.jmt-swatch--oranje, .jmt-swatch--orange { background: #f28c28; }
.jmt-swatch--paars, .jmt-swatch--purple { background: #7b4ea3; }
.jmt-swatch--rood, .jmt-swatch--red { background: #d53a3a; }
.jmt-swatch--wit, .jmt-swatch--white { background: #ffffff; }
.jmt-swatch--zwart, .jmt-swatch--black { background: #111111; }

/* Version badge at bottom of sidebar */
.jmt-version {
    margin: 1.25em 0 0;
    font-size: 0.72em;
    color: #aaa;
    text-align: center;
}

/* Refreshing / warming-cache message */
.jmt-refreshing {
    color: #555;
    font-style: normal;
}
.jmt-refreshing small {
    font-size: 0.85em;
    color: #888;
    display: block;
    margin-top: 0.3em;
}

/* Inline retry button inside error message */
.jmt-retry-btn {
    margin-left: 0.6em;
    font-size: 0.85em;
    padding: 0.3em 0.8em;
}

/* ── Main content ────────────────────────────────────────────── */
.jmt-main {
    flex: 1;
    min-width: 0;
    padding: 0 0.5em;
}

/* ── Product grid ────────────────────────────────────────────── */
.jmt-products-grid {
    display: grid;
    grid-template-columns: repeat( auto-fill, minmax( 160px, 1fr ) );
    gap: 1em;
}
.jmt-product {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    padding: 0.5em;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    background: #fff;
    transition: box-shadow 0.15s, transform 0.1s;
}
.jmt-product:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.jmt-product img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 3px;
    margin-bottom: 0.5em;
}
.jmt-product h4 {
    margin: 0;
    font-size: 0.82em;
    color: #333;
    line-height: 1.3;
}
.jmt-no-image {
    width: 100%;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 0.8em;
    border-radius: 3px;
    margin-bottom: 0.5em;
}

/* ── Pagination ──────────────────────────────────────────────── */
.jmt-pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3em;
    margin: 1.25em 0;
}
.jmt-page {
    padding: 0.3em 0.6em;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85em;
}
.jmt-page:hover {
    background: #f0f0f0;
}
.jmt-page.active {
    background: #51af2f;
    color: #fff;
    border-color: #51af2f;
    cursor: default;
}
.jmt-ellipsis {
    padding: 0.3em 0.4em;
    font-size: 0.85em;
    color: #999;
}

/* ── Product detail modal ────────────────────────────────────── */
.jmt-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.65em;
}
.jmt-modal-content {
    background: #fff;
    border-radius: 5px;
    width: 90%;
    max-width: 820px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.5em;
    position: relative;
}
.jmt-modal-close {
    position: absolute;
    top: 0.6em;
    right: 0.8em;
    font-size: 1.6em;
    line-height: 1;
    cursor: pointer;
    color: #888;
    background: none;
    border: none;
    padding: 0;
}
.jmt-modal-close:hover {
    color: #222;
}

/* Two-column layout inside modal */
.jmt-modal-cols {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5em;
}
.jmt-modal-left {
    flex: 1 1 40%;
    min-width: 0;
}
.jmt-modal-right {
    flex: 1 1 50%;
    min-width: 0;
}
.jmt-modal-left img {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 3px;
    margin-bottom: 0.5em;
}
.jmt-modal-left h2 {
    margin: 0.5em 0 0.3em;
    font-size: 1.1em;
}
.jmt-description {
    font-size: 0.87em;
    color: #555;
    margin: 0;
}

/* Attributes grid: 2-column key/value pairs */
.jmt-attr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 6px;
    font-size: 0.84em;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1em;
}
.attr-name {
    font-weight: 600;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 2px;
}
.attr-value {
    padding: 2px 4px;
}

/* Colour swatches inside product modal */
.jmt-modal-colors {
    margin: 0.5em 0 0.3em;
    font-size: 0.87em;
}
.jmt-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 0.18em;
    margin-top: 0.25em;
}
.jmt-color-swatch {
    padding: 0.18em;
    margin-right: 0;
    border: 2px solid #ccc;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.jmt-color-swatch .jmt-swatch {
    width: 1.1em;
    height: 1.1em;
    border-radius: 2px;
    display: block;
}
.jmt-color-swatch:hover {
    border-color: #51af2f;
}
.jmt-color-swatch.active {
    border-color: #51af2f;
}

/* Cart controls inside modal */
.jmt-cart-controls {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-top: 1em;
}
.jmt-cart-qty {
    width: 65px;
    padding: 0.4em 0.5em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 1em;
}

/* ── Hamburger toggle button (mobile only) ───────────────────── */
.jmt-menu-toggle {
    display: none;
    width: 100%;
    padding: 0.55em 1em;
    background: #51af2f;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    text-align: left;
    margin-bottom: 0.6em;
    align-items: center;
    gap: 0.5em;
    box-sizing: border-box;
    line-height: 1.3;
}
.jmt-menu-toggle:hover {
    background: #429927;
}
.jmt-menu-toggle-icon {
    font-size: 1.15em;
    line-height: 1;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.jmt-button {
    display: inline-block;
    padding: 0.28em 1em;
    line-height: 1.2;
    background: #51af2f;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.15s;
}
.jmt-button:hover {
    background: #429927;
}
.jmt-button:disabled {
    background: #a0c890;
    cursor: not-allowed;
}

/* ── Quote form ──────────────────────────────────────────────── */
.jmt-form {
    margin-top: 2.5em;
    max-width: 520px;
}
.jmt-form h3 {
    margin-bottom: 1em;
}
.jmt-form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75em;
}
.jmt-form-row label {
    font-size: 0.87em;
    font-weight: 600;
    margin-bottom: 0.2em;
}
.jmt-form-row input {
    padding: 0.4em 0.6em;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 0.95em;
}

/* Cart list inside form */
.jmt-cart {
    list-style: none;
    padding: 0;
    margin: 0.75em 0;
}
.jmt-cart-item {
    display: flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.3em 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}
.jmt-cart-title {
    flex: 1;
}
.jmt-cart-qty-badge {
    color: #555;
    font-size: 0.85em;
}
.jmt-cart-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #c00;
    font-size: 1.1em;
    line-height: 1;
    padding: 0 0.2em;
}
.jmt-cart-remove:hover {
    color: #900;
}
.jmt-cart-empty {
    color: #888;
    font-size: 0.87em;
    margin: 0.5em 0;
}

/* ── Status messages ─────────────────────────────────────────── */
.jmt-loading,
.jmt-empty,
.jmt-error {
    padding: 0.65em;
    font-style: italic;
    color: #777;
}
.jmt-error {
    color: #c00;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media ( max-width: 640px ) {
    .jmt-menu-toggle {
        display: flex;
    }
    .jmt-products-grid {
        grid-template-columns: repeat( 2, 1fr );
    }
    .jmt-container {
        flex-direction: column;
    }
    .jmt-sidebar {
        display: none;
        width: 100%;
        position: static;
        max-height: none;
    }
    .jmt-sidebar.is-open {
        display: block;
    }
    .jmt-modal-cols {
        flex-direction: column;
    }
    .jmt-modal-left,
    .jmt-modal-right {
        flex: 1 1 100%;
    }
    .jmt-attr-grid {
        max-height: none;
    }
}
