/* ==========================================================================
   MyAgroParts — Brand Taxonomy Page (brand.css)
   Loaded only on brand taxonomy archive pages ($is_brand_tax).
   Depends on catalog.css being loaded first.
   Version: 2.1.0
   ========================================================================== */

/* ---- Utility reset already done in catalog.css ---- */

/* ==========================================================================
   BRAND HERO
   ========================================================================== */

.brand-hero {
    background: linear-gradient(135deg, #145214 0%, #1e7a2a 50%, #2d9a3f 100%);
    border-radius: 24px;
    margin-bottom: 24px;
    overflow: hidden;
    position: relative;
    padding: 40px 40px 34px;
    color: #fff;
}

/* decorative glow, matches the reference brand mockup */
.brand-hero::before {
    content: '';
    position: absolute;
    right: -120px;
    top: -160px;
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(255,255,255,.07) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.brand-hero-top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}

.brand-hero-main {
    display: flex;
    gap: 28px;
    flex: 1;
    min-width: 280px;
}

/* ---- Logo box ---- */
.brand-hero-logo {
    flex-shrink: 0;
    width: 128px;
    height: 128px;
    background: #fff;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    text-align: center;
    padding: 10px;
}

.brand-hero-logo img {
    max-width: 100%;
    max-height: 84px;
    object-fit: contain;
}

.brand-hero-logo .fallback-text {
    font-size: 20px;
    font-weight: 800;
    color: #145214;
    letter-spacing: .5px;
    line-height: 1.1;
    word-break: break-word;
}

.brand-hero-logo .fallback-sub {
    font-size: 10px;
    font-weight: 600;
    color: #7a7a7a;
    text-align: center;
}

/* ---- Hero info ---- */
.brand-hero-info {
    display: flex;
    flex-direction: column;
}

.brand-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    width: fit-content;
    background: rgba(255,255,255,.15);
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    color: #fff;
}

.brand-hero-badge svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.brand-hero-title {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.2;
    margin: 0 0 10px;
    color: #fff;
}

.brand-hero-desc {
    font-size: 15px;
    opacity: .85;
    line-height: 1.6;
    max-width: 560px;
    margin-bottom: 22px;
    color: #fff;
}

.brand-hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.brand-hero-btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 13px 26px;
    background: #fff;
    color: #1a5c26;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}

.brand-hero-btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.brand-hero-btn-outline {
    padding: 13px 26px;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,.4);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all .2s;
}

.brand-hero-btn-outline:hover {
    background: rgba(255,255,255,.22);
}

/* ---- Trust pills ---- */
.brand-hero-pills {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.brand-hero-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    background: rgba(255,255,255,.12);
    border-radius: 12px;
    backdrop-filter: blur(4px);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    transition: background .2s;
    white-space: nowrap;
}

.brand-hero-pill:hover {
    background: rgba(255,255,255,.22);
}

.brand-hero-pill svg {
    width: 16px;
    height: 16px;
    opacity: .9;
    flex-shrink: 0;
}

/* ---- Stats row ---- */
.brand-hero-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 40px;
    margin-top: 30px;
    padding-top: 26px;
    border-top: 1px solid rgba(255,255,255,.18);
    flex-wrap: wrap;
}

.brand-hero-stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    color: #fff;
    white-space: nowrap;
}

.brand-hero-stat-label {
    font-size: 12px;
    opacity: .75;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
}

/* ==========================================================================
   CATEGORY CHIPS BAR
   ========================================================================== */

.brand-categories-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px 20px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e8e8e8;
}

.brand-cat-title {
    font-size: 13px;
    font-weight: 700;
    color: #555;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    padding-right: 8px;
    border-right: 1px solid #e0e0e0;
    margin-right: 4px;
}

.brand-cat-title svg {
    width: 16px;
    height: 16px;
    color: #3ba54e;
}

.brand-cat-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    transition: all .2s;
    white-space: nowrap;
    text-decoration: none;
}

.brand-cat-link .cnt {
    font-size: 11px;
    opacity: .65;
}

.brand-cat-link:hover {
    background: #e8f5e9;
    color: #2d8c3c;
}

.brand-cat-link.active {
    background: #3ba54e;
    color: #fff;
}

.brand-cat-link.active .cnt {
    opacity: .85;
}

/* ==========================================================================
   SORTING BAR EXTENSIONS
   ========================================================================== */

.brand-sorting-bar {
    justify-content: space-between;
}

.brand-sort-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ==========================================================================
   VIEW TOGGLE (Grid / List)
   ========================================================================== */

.brand-view-toggle {
    display: flex;
    gap: 4px;
    background: #f5f5f5;
    border-radius: 10px;
    padding: 4px;
    flex-shrink: 0;
}

.brand-view-btn {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #aaa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
}

.brand-view-btn svg {
    width: 16px;
    height: 16px;
}

.brand-view-btn.active {
    background: #fff;
    color: #3ba54e;
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* ==========================================================================
   IN-STOCK TOGGLE (sidebar)
   ========================================================================== */

.brand-instock-card {
    padding: 0 !important;
    border: 1px solid #e8e8e8;
    border-radius: 16px;
    overflow: hidden;
}

.brand-instock-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
}

.brand-instock-label {
    font-size: 14px;
    font-weight: 500;
    color: #444;
}

.brand-toggle {
    position: relative;
    display: inline-flex;
    cursor: pointer;
    user-select: none;
}

.brand-toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.brand-toggle-track {
    display: inline-flex;
    align-items: center;
    width: 46px;
    height: 26px;
    border-radius: 13px;
    background: #ddd;
    position: relative;
    transition: background .2s;
    flex-shrink: 0;
}

.brand-toggle-input:checked + .brand-toggle-track {
    background: #3ba54e;
}

.brand-toggle-thumb {
    position: absolute;
    right: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.2);
    transition: right .2s;
}

.brand-toggle-input:not(:checked) + .brand-toggle-track .brand-toggle-thumb {
    right: auto;
    left: 3px;
}

/* ==========================================================================
   FIXED BRAND TAG (above product grid)
   ========================================================================== */

.brand-fixed-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #e8f5e9;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #2d8c3c;
    margin-bottom: 16px;
    border: 1px solid #c8e6c9;
}

.brand-fixed-tag svg {
    flex-shrink: 0;
}

/* ==========================================================================
   LIST VIEW  — products-grid--list modifier
   ========================================================================== */

.products-grid.products-grid--list {
    grid-template-columns: 1fr;
    gap: 12px;
}

.products-grid--list .product-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-radius: 14px;
    align-items: start;
}

.products-grid--list .product-image {
    height: 180px;
    border-radius: 14px 0 0 14px;
}

.products-grid--list .product-body {
    padding: 20px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto;
    gap: 4px 24px;
}

.products-grid--list .product-name  { grid-column: 1; font-size: 15px; }
.products-grid--list .product-brand { grid-column: 1; }
.products-grid--list .product-sku   { grid-column: 1; }
.products-grid--list .product-rating{ grid-column: 1; }
.products-grid--list .product-availability { grid-column: 1; }

.products-grid--list .product-price-row {
    grid-column: 2;
    grid-row: 1 / 3;
    align-self: start;
    text-align: right;
}

.products-grid--list .product-actions {
    grid-column: 2;
    grid-row: 3 / 6;
    align-self: end;
    flex-direction: column;
    width: 160px;
}

.products-grid--list .product-btn-cart,
.products-grid--list .product-btn-details {
    width: 100%;
}

/* ==========================================================================
   OTHER BRANDS SECTION
   ========================================================================== */

.other-brands {
    margin-top: 40px;
    margin-bottom: 40px;
    background: #fff;
    border-radius: 20px;
    border: 1px solid #e8e8e8;
    padding: 28px 32px;
}

.other-brands-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
}

.other-brands-title svg {
    width: 18px;
    height: 18px;
    color: #3ba54e;
    flex-shrink: 0;
}

.other-brands-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 12px;
}

.other-brand-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px;
    border: 1px solid #eee;
    border-radius: 14px;
    text-align: center;
    text-decoration: none;
    transition: all .2s;
}

.other-brand-card:hover {
    border-color: #c8e6c9;
    background: #f8fdf8;
    transform: translateY(-2px);
}

.other-brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: #f4f6f4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 11px;
    font-weight: 800;
    color: #555;
    text-align: center;
    line-height: 1.2;
}

.other-brand-name {
    font-size: 13px;
    font-weight: 700;
    color: #1a1a1a;
}

.other-brand-count {
    font-size: 11px;
    color: #999;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1200px) {
    .brand-hero {
        padding: 30px 28px;
    }

    .brand-hero-pills {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .brand-hero-title {
        font-size: 28px;
    }

    .brand-hero-stat-value {
        font-size: 22px;
    }

    .brand-hero-stats {
        gap: 24px;
    }

    .other-brands-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 900px) {
    .brand-hero-main {
        flex-direction: column;
    }

    .brand-hero-logo {
        width: 88px;
        height: 88px;
        border-radius: 16px;
    }

    .brand-hero-logo .fallback-text {
        font-size: 16px;
    }

    .brand-cat-link {
        padding: 5px 10px;
        font-size: 12px;
    }

    .other-brands-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .brand-sort-right .results-count {
        display: none;
    }
}

@media (max-width: 768px) {
    .brand-hero {
        border-radius: 16px;
        padding: 24px 20px;
    }

    .brand-hero-title {
        font-size: 22px;
    }

    .brand-hero-desc {
        font-size: 13px;
    }

    .brand-hero-actions {
        width: 100%;
    }

    .brand-hero-btn-primary,
    .brand-hero-btn-outline {
        flex: 1;
        text-align: center;
    }

    .brand-hero-pills {
        width: 100%;
    }

    .brand-hero-pill {
        flex: 1;
        justify-content: center;
    }

    .brand-hero-stats {
        gap: 18px;
    }

    .brand-hero-stat-value {
        font-size: 20px;
    }

    .other-brands {
        padding: 20px 16px;
    }

    .other-brands-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .brand-sorting-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .brand-sort-right {
        width: 100%;
        justify-content: space-between;
    }

    /* list view: single column on mobile */
    .products-grid--list .product-card {
        grid-template-columns: 1fr;
    }

    .products-grid--list .product-image {
        border-radius: 14px 14px 0 0;
        height: 200px;
    }

    .products-grid--list .product-body {
        grid-template-columns: 1fr;
    }

    .products-grid--list .product-price-row,
    .products-grid--list .product-actions {
        grid-column: 1;
        grid-row: auto;
        text-align: left;
        width: 100%;
    }
}
