/* css/components/material-browser.css */
/* v2.0 - Showroom de Materiais Full Screen (Responsivo) */

#material-browser-page {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: #121212;
    z-index: 9000;
    
    display: flex;
    flex-direction: column;
    
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#material-browser-page.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- HEADER (Topo) --- */
.mb-header {
    height: 70px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-glass-dark);
    border-bottom: 1px solid var(--surface-border);
    flex-shrink: 0; /* Garante que o header não encolha */
}

.mb-title h2 {
    margin: 0;
    font-size: 24px;
    color: var(--text-high-emphasis);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.mb-title span {
    font-size: 14px;
    color: var(--text-medium);
    margin-left: 10px;
    font-weight: 400;
}

/* --- LAYOUT PRINCIPAL (Sidebar + Grid) --- */
.mb-body {
    flex: 1;
    display: flex;
    overflow: hidden; /* O scroll é interno */
}

/* Sidebar de Filtros (Esquerda Desktop) */
.mb-sidebar {
    width: 260px;
    background: rgba(255, 255, 255, 0.02);
    border-right: 1px solid var(--surface-border);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.mb-brand-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 8px;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    white-space: nowrap; /* Importante para mobile */
}

.mb-brand-filter:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.mb-brand-filter.active {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

/* Conteúdo (Direita) */
.mb-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Scroll suave no iOS */
}

/* --- SEÇÕES E CARDS --- */
.mb-section {
    margin-bottom: 50px;
}

.mb-section-title {
    font-size: 20px;
    font-weight: 300;
    color: var(--text-high-emphasis);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.mb-section-title::before {
    content: ''; display: block; width: 6px; height: 24px; background: var(--color-primary);
}

.mb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); /* Reduzi um pouco o min para caber mais */
    gap: 15px;
}

/* O Cartão de Textura */
.mb-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mb-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.mb-card-thumb {
    height: 140px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mb-card-info {
    padding: 12px;
}

.mb-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mb-card-meta {
    font-size: 11px;
    color: #888;
    display: flex;
    justify-content: space-between;
}

.mb-badge {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: #ccc;
    text-transform: uppercase;
}

/* --- MOBILE & TABLET (A Mágica Acontece Aqui) --- */
@media (max-width: 768px) {
    
    /* Header Compacto */
    .mb-header {
        height: auto;
        padding: 15px;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .mb-header > div:last-child {
        display: flex;
        gap: 10px;
    }

    #mb-global-search {
        width: 100% !important; /* Força largura total */
        font-size: 16px; /* Evita zoom automático no iOS */
    }

    /* Corpo Vira Coluna */
    .mb-body {
        flex-direction: column;
    }

    /* Sidebar Vira Topbar Horizontal */
    .mb-sidebar {
        width: 100%;
        height: auto;
        max-height: 70px;
        flex-direction: row; /* Itens lado a lado */
        overflow-x: auto; /* Scroll Horizontal */
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid var(--surface-border);
        padding: 10px 15px;
        gap: 10px;
        
        /* Esconder Scrollbar feia mas manter funcionalidade */
        -ms-overflow-style: none;  /* IE and Edge */
        scrollbar-width: none;  /* Firefox */
    }
    
    .mb-sidebar::-webkit-scrollbar {
        display: none; /* Chrome */
    }

    /* Botões de Filtro estilo "Cápsula" */
    .mb-brand-filter {
        flex: 0 0 auto; /* Não encolher nem esticar */
        padding: 8px 16px;
        background: rgba(255,255,255,0.05);
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 20px; /* Formato de pílula */
    }

    .mb-brand-filter.active {
        background: var(--color-primary);
        border-color: var(--color-primary);
    }
    
    /* Remove contagem de itens no mobile se ocupar muito espaço (opcional) */
    .mb-brand-filter span:last-child {
        display: none; 
    }

    /* Grid Responsivo */
    .mb-content {
        padding: 15px;
    }
    
    .mb-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Cards menores */
        gap: 10px;
    }
    
    .mb-card-thumb {
        height: 110px; /* Imagem um pouco menor */
    }
}