/* ==========================================================================
   Public CSS — Catálogo de Peças para Empilhadores
   ========================================================================== */

/* --- Widget: Detalhe da Peça --- */
.cl-detalhe-peca {
    font-family: inherit;
}

.cl-detalhe-peca .cl-galeria-slider {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}

.cl-detalhe-peca .cl-galeria-slider img {
    border-radius: 6px;
    object-fit: cover;
    max-width: 200px;
    max-height: 200px;
    border: 1px solid #e0e0e0;
    transition: transform 0.2s ease;
}

.cl-detalhe-peca .cl-galeria-slider img:hover {
    transform: scale(1.04);
}

.cl-detalhe-peca .cl-codigo-interno {
    display: inline-block;
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px 10px;
    font-family: monospace;
    font-size: 14px;
    margin-bottom: 16px;
    color: #333;
}

.cl-detalhe-peca .cl-peca-descricao {
    line-height: 1.7;
    margin-bottom: 24px;
    color: #444;
}

.cl-detalhe-peca .cl-modelos-lista {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cl-detalhe-peca .cl-modelos-lista li {
    background: #1a1a2e;
    color: #fff;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
}

/* --- Widget: Grelha de Catálogo --- */

/* Wrapper: pesquisa + grelha */
.cl-grelha-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Barra de pesquisa */
.cl-grelha-searchbar {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cl-grelha-search-input-wrap {
    flex: 1;
    position: relative;
}

.cl-grelha-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    pointer-events: none;
    display: block;
}

.cl-grelha-search {
    width: 100%;
    border: 2px solid #e8e8e8;
    border-radius: 10px;
    padding: 12px 16px 12px 46px;
    font-size: 14px;
    color: #222;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.cl-grelha-search:focus {
    outline: none;
    border-color: #e87722;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(232, 119, 34, 0.12);
}

.cl-grelha-search::placeholder {
    color: #bbb;
}

.cl-grelha-count {
    flex-shrink: 0;
    font-size: 13px;
    color: #888;
    white-space: nowrap;
}

.cl-grelha-count-num {
    font-weight: 700;
    color: #1a1a2e;
}

/* Grelha */
.cl-grelha-catalogo {
    display: grid;
    gap: 24px;
}

/* Card */
.cl-grelha-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #efefef;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.cl-grelha-item:hover {
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.13);
    transform: translateY(-5px);
}

/* Link wrapper (imagem + corpo) */
.cl-item-link {
    display: flex;
    flex-direction: column;
    flex: 1;
    text-decoration: none;
    color: inherit;
}

/* Imagem */
.cl-item-imagem {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f5f5f5;
    flex-shrink: 0;
}

.cl-item-imagem img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.cl-grelha-item:hover .cl-item-imagem img {
    transform: scale(1.06);
}

.cl-item-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 48px;
}

/* Corpo do card */
.cl-item-corpo {
    padding: 16px 18px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cl-item-familia-tag {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #e87722;
}

.cl-item-titulo {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cl-item-codigo {
    font-family: monospace;
    font-size: 11px;
    color: #aaa;
    background: #f4f4f4;
    border-radius: 4px;
    padding: 2px 8px;
    display: inline-block;
    align-self: flex-start;
}

/* Rodapé do card (botão) */
.cl-item-footer {
    padding: 0 14px 14px;
}

.cl-item-footer .cl-btn-adicionar-cotacao {
    width: 100%;
    justify-content: center;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
}

/* Sem resultados da pesquisa */
.cl-no-results-search {
    text-align: center;
    color: #888;
    font-size: 15px;
    padding: 32px 0;
}

/* --- Sidebar de Famílias --- */

/* Layout com sidebar: flex em linha */
.cl-grelha-has-sidebar {
    flex-direction: row;
    align-items: flex-start;
    gap: 28px;
}

/* Sidebar */
.cl-grelha-sidebar {
    width: 230px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #efefef;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 24px;
    overflow: hidden;
}

/* Cabeçalho da sidebar */
.cl-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.cl-sidebar-titulo {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    margin: 0;
}

/* Toggle mobile (oculto no desktop) */
.cl-sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    padding: 4px;
    line-height: 1;
}

/* Nav (lista de famílias) */
.cl-sidebar-nav {
    padding: 8px 0;
}

.cl-sidebar-lista {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cl-sidebar-item {
    margin: 0;
}

/* Botão de família */
.cl-sidebar-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    padding: 9px 16px;
    font-size: 13px;
    color: #333;
    text-align: left;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    line-height: 1.3;
    gap: 8px;
}

.cl-sidebar-btn:hover {
    background: #fdf3ea;
    color: #e87722;
}

.cl-sidebar-btn.is-active {
    background: #fdf3ea;
    color: #e87722;
    font-weight: 700;
}

/* Seta de expansão */
.cl-sidebar-arrow {
    flex-shrink: 0;
    color: #bbb;
    transition: transform 0.2s ease;
}

.cl-sidebar-item.is-expanded > .cl-sidebar-btn .cl-sidebar-arrow {
    transform: rotate(90deg);
    color: #e87722;
}

/* Sub-lista (filhos) */
.cl-sidebar-sub {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    border-bottom: 1px solid #f0f0f0;
}

.cl-sidebar-item.is-expanded > .cl-sidebar-sub {
    display: block;
}

.cl-sidebar-sub-item {
    margin: 0;
}

.cl-sidebar-sub-item .cl-sidebar-btn {
    padding-left: 28px;
    font-size: 12px;
    color: #555;
}

.cl-sidebar-sub-item .cl-sidebar-btn:hover {
    color: #e87722;
    background: #fdf3ea;
}

.cl-sidebar-sub-item .cl-sidebar-btn.is-active {
    color: #e87722;
    font-weight: 700;
    background: #fdf3ea;
}

/* Área principal (pesquisa + grelha) */
.cl-grelha-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Responsive */
@media (max-width: 900px) {
    .cl-grelha-has-sidebar {
        flex-direction: column;
    }

    .cl-grelha-sidebar {
        width: 100%;
        position: static;
    }

    .cl-sidebar-toggle-mobile {
        display: flex;
        align-items: center;
    }

    .cl-sidebar-nav {
        display: none;
    }

    .cl-sidebar-nav.is-open {
        display: block;
    }
}

@media (max-width: 768px) {
    .cl-grelha-catalogo {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px;
    }
    .cl-grelha-searchbar {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .cl-grelha-catalogo {
        grid-template-columns: 1fr !important;
    }
}

/* --- Lightbox --- */

.cl-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.cl-lightbox.is-open {
    display: flex;
}

.cl-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    cursor: zoom-out;
}

.cl-lightbox-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: 92vh;
    animation: cl-lightbox-in 0.22s ease;
}

@keyframes cl-lightbox-in {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

.cl-lightbox-img {
    display: block;
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.cl-lightbox-close {
    position: absolute;
    top: -44px;
    right: -4px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    cursor: pointer;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.cl-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Cursor nas imagens da galeria */
.cl-galeria-slider a {
    cursor: zoom-in;
    display: inline-block;
}

/* --- Menu de Famílias --- */

.cl-menu-familias {
    display: grid;
}

.cl-menu-familia-item {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.cl-menu-familia-item:hover {
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
    transform: translateY(-4px);
}

.cl-menu-familia-foto {
    position: relative;
    overflow: hidden;
    background: #f0f0f0;
    width: 100%;
}

.cl-menu-familia-foto img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.38s ease;
}

.cl-menu-familia-item:hover .cl-menu-familia-foto img {
    transform: scale(1.07);
}

.cl-menu-familia-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    background: #f0f0f0;
}

.cl-menu-familia-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, transparent 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 32px 16px 14px;
    line-height: 1.3;
    pointer-events: none;
}

@media (max-width: 768px) {
    .cl-menu-familias {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    .cl-menu-familias {
        grid-template-columns: 1fr !important;
    }
}

/* SEO — Div invisível com OEM codes */
.cl-oem-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}