:root {
    --bg: #f8fafc;
    --bg-white: #ffffff;
    --bg-subtle: #f1f5f9;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --header-bg: #1e293b;
    
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    --accent: #6366f1;
    --accent-light: #818cf8;
    --accent-bg: #eef2ff;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.05);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
    
    --radius: 16px;
    --radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* =====================
   HEADER ESCURO
   ===================== */
.header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 2rem;
    background: var(--header-bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Botão Voltar ao Sistema */
.btn-voltar {
    position: absolute;
    left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85em;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-voltar:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.btn-voltar .material-icons-round {
    font-size: 1.1em;
}

/* Container central do header */
.header-center {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
}

.header-title h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.header-title span {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    font-weight: 500;
    background: rgba(255,255,255,0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
}

/* =====================
   SEÇÃO DE CONTROLES
   ===================== */
.controls-section {
    background: var(--bg-white);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* PESQUISA MODERNA */
.search-wrapper {
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px;
    color: var(--text-muted);
    transition: 0.2s;
}

.search-box:focus-within .search-icon {
    color: var(--accent);
}

#searchInput {
    width: 100%;
    padding: 1.1rem 1.1rem 1.1rem 60px;
    font-size: 1.1rem;
    font-family: inherit;
    font-weight: 500;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: 0.2s;
}

#searchInput::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px var(--accent-bg);
}

.clear-btn {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-subtle);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.clear-btn:hover {
    background: var(--border);
    color: var(--text);
}

/* Botão de Pesquisar/Ir para resultados */
.search-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.search-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-50%) scale(1.05);
}

.search-btn .material-icons-round {
    font-size: 22px;
}

/* CATEGORIAS MODERNAS - CORES SÓLIDAS */
.categories-wrapper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

.cat-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1rem;
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.cat-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
    filter: brightness(1.1);
}

.cat-btn.active {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* Botão TODAS - Roxo */
.cat-btn[data-category="todas"] {
    background: #7c3aed;
}

/* Botão 115 - Verde */
.cat-btn.cat-115 {
    background: #10b981;
}

/* Botão 014 - Azul */
.cat-btn.cat-014 {
    background: #3b82f6;
}

/* Botão 114 - Rosa/Vermelho */
.cat-btn.cat-114 {
    background: #ec4899;
}

/* Botão 016 - Laranja (Caixa 3cm) */
.cat-btn.cat-016 {
    background: #f59e0b;
}

/* Botão 019 - Vermelho (Caixa 4,6cm) */
.cat-btn.cat-019 {
    background: #ef4444;
}

/* Botão Trabalhadas 2,5cm - Dourado */
.cat-btn.cat-trab25 {
    background: linear-gradient(135deg, #b8860b 0%, #daa520 100%);
}

/* Botão Trabalhadas 3cm - Bronze */
.cat-btn.cat-trab3 {
    background: linear-gradient(135deg, #8B4513 0%, #CD853F 100%);
}

/* Botão Trabalhadas 4cm - Roxo escuro */
.cat-btn.cat-trab4 {
    background: linear-gradient(135deg, #6b21a8 0%, #9333ea 100%);
}

/* Botão 1,5cm - Índigo */
.cat-btn.cat-15 {
    background: #6366f1;
}

/* Badges */
.card-badge.badge-016 { color: #f59e0b; }
.card-badge.badge-019 { color: #ef4444; }
.card-badge.badge-trab25 { color: #b8860b; }
.card-badge.badge-trab3 { color: #8B4513; }
.card-badge.badge-trab4 { color: #6b21a8; }
.card-badge.badge-15 { color: #6366f1; }

.cat-icon {
    font-size: 2rem;
    color: white;
    opacity: 0.9;
}

.cat-size {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.cat-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
}

.cat-name {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: white;
    opacity: 0.95;
}

.cat-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: rgba(255,255,255,0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
}

/* =====================
   BARRA DE RESULTADOS
   ===================== */
.results-bar {
    padding: 1rem 2rem;
    background: var(--bg);
}

.results-bar p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.results-bar strong {
    color: var(--accent);
}

/* =====================
   GRID DE PRODUTOS
   ===================== */
.main-content {
    padding: 0 2rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

/* CARD MODERNO */
.product-card {
    background: var(--bg-white);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.25s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-light);
}

.card-image {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s, opacity 0.3s;
    opacity: 0;
}

.card-image img.loaded,
.card-image img[complete] {
    opacity: 1;
}

/* Força mostrar imagem quando carregada */
.card-image img {
    animation: fadeIn 0.3s ease forwards;
    animation-delay: 0.1s;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.product-card:hover .card-image img {
    transform: scale(1.05);
}

.card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 0.3rem 0.6rem;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.card-badge.badge-115 { color: #059669; }
.card-badge.badge-014 { color: #2563eb; }
.card-badge.badge-114 { color: #e11d48; }

.card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15,23,42,0.8) 0%, transparent 60%);
    opacity: 0;
    transition: 0.25s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1rem;
}

.product-card:hover .card-overlay {
    opacity: 1;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: var(--bg-white);
    border: none;
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transform: translateY(10px);
    transition: 0.2s ease;
    box-shadow: var(--shadow);
}

.product-card:hover .view-btn {
    transform: translateY(0);
}

.view-btn:hover {
    background: var(--accent);
    color: white;
}

.card-info {
    padding: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.card-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.card-code strong {
    color: var(--accent);
}

/* =====================
   SEM RESULTADOS
   ===================== */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.no-results .material-icons-round {
    font-size: 4rem;
    opacity: 0.2;
}

.no-results h3 {
    margin: 1rem 0 0.5rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.hidden { display: none !important; }

/* =====================
   MODAL MODERNO
   ===================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
}

.modal-container {
    position: relative;
    background: var(--bg-white);
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-subtle);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.modal-image-area {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image-area img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-subtle);
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.modal-info {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.modal-category {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    background: var(--accent-bg);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    align-self: flex-start;
}

.modal-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.modal-code {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.modal-code strong {
    color: var(--accent);
}

.modal-specs {
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.spec-item .material-icons-round {
    color: var(--accent);
    font-size: 20px;
}

.modal-tip {
    margin-top: auto;
    padding-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* =====================
   RESPONSIVO
   ===================== */
@media (max-width: 1100px) {
    .categories-wrapper {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 800px) {
    .categories-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Header responsivo */
    .header {
        flex-direction: column;
        padding: 1rem;
        gap: 0.6rem;
    }
    
    .header-center {
        display: flex;
        align-items: center;
        gap: 0.8rem;
        order: 1;
    }
    
    .btn-voltar {
        position: relative;
        left: 0;
        font-size: 0.8em;
        padding: 8px 16px;
        order: 2;
        margin-top: 0.3rem;
    }
    
    .header-title h1 {
        font-size: 1.1em;
    }
    
    .header-title span {
        font-size: 0.7em;
    }
    
    .logo {
        width: 45px;
        height: 45px;
    }
}

@media (max-width: 500px) {
    .categories-wrapper {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .header {
        padding: 1rem;
    }
    
    .controls-section {
        padding: 1.5rem 1rem;
    }
    
    #searchInput {
        padding: 1rem 1rem 1rem 50px;
        font-size: 1rem;
    }
    
    .search-icon {
        left: 16px;
        font-size: 20px;
    }
    
    .categories-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .cat-btn {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1rem 0.75rem;
        gap: 0.4rem;
    }
    
    .cat-size {
        font-size: 1.5rem;
    }
    
    .cat-icon {
        font-size: 1.75rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .main-content {
        padding: 0 1rem 2rem;
    }
    
    .card-info {
        padding: 0.75rem;
    }
    
    .card-title {
        font-size: 0.85rem;
    }
    
    .modal-content {
        grid-template-columns: 1fr;
    }
    
    .modal-image-area {
        max-height: 45vh;
    }
    
    .modal-info {
        padding: 1.5rem;
    }
    
    .modal-info h2 {
        font-size: 1.25rem;
    }
}

/* ========================================
   CARROSSEL DE IMAGENS
   ======================================== */

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 10;
}

.carousel-btn:hover {
    background: white;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.carousel-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
    left: 10px;
}

.carousel-next {
    right: 10px;
}

.carousel-btn .material-icons-round {
    font-size: 24px;
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicators .indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.carousel-indicators .indicator:hover {
    background: rgba(255, 255, 255, 0.8);
}

.carousel-indicators .indicator.active {
    background: white;
    transform: scale(1.2);
}

/* Esconder botões se só tem 1 imagem */
.carousel-btn.hidden,
.carousel-indicators.hidden {
    display: none;
}

/* Mobile */
@media (max-width: 800px) {
    .carousel-btn {
        width: 36px;
        height: 36px;
    }
    
    .carousel-btn .material-icons-round {
        font-size: 20px;
    }
    
    .carousel-prev {
        left: 5px;
    }
    
    .carousel-next {
        right: 5px;
    }
    
    .carousel-indicators {
        bottom: 10px;
    }
    
    .carousel-indicators .indicator {
        width: 8px;
        height: 8px;
    }
}

/* =====================
   SEÇÃO DE COMPARTILHAMENTO
   ===================== */
.share-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.share-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.share-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

.share-btn .material-icons-round {
    font-size: 1.25rem;
}

.share-btn-image {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.share-btn-image:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.share-btn-desc {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.share-btn-desc:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.share-btn:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

.share-btn.success {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
}

.share-instructions {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    text-align: center;
}

.share-instructions strong {
    color: var(--text);
    background: var(--bg-subtle);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
}

/* Feedback flutuante */
.share-feedback {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1000;
    animation: feedbackSlide 0.3s ease;
}

.share-feedback.info {
    background: var(--accent);
    color: white;
}

.share-feedback.error {
    background: #ef4444;
    color: white;
}

@keyframes feedbackSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Mobile - Compartilhamento */
@media (max-width: 800px) {
    .share-section {
        margin-top: 1rem;
        padding-top: 1rem;
    }
    
    .share-buttons {
        flex-direction: column;
    }
    
    .share-btn {
        width: 100%;
        padding: 0.875rem 1rem;
    }
}
