/* ══════════════════════════════════════
   CATALOG LAYOUT
══════════════════════════════════════ */

.catalog-container{
    display: grid;
    grid-template-columns: 270px 1fr;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 16px;
    min-height: 60vh;
}

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */

.catalog-sidebar{
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-right: 12px;
    scrollbar-width: thin;
    scrollbar-color: #1a1a2e #050816;
}
.catalog-sidebar::-webkit-scrollbar{width:5px}
.catalog-sidebar::-webkit-scrollbar-track{background:#050816}
.catalog-sidebar::-webkit-scrollbar-thumb{background:#1a1a2e;border-radius:4px}

/* Sidebar vazia: esconder e grid full width */
.catalog-sidebar.sidebar-vazia{
    display: none;
}
.catalog-container:has(.sidebar-vazia){
    grid-template-columns: 1fr;
}

.sidebar-close{
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

.sidebar-section{
    margin-bottom: 24px;
}

.sidebar-title{
    color: #00d9ff;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #1a1a2e;
}

/* ── Filters ── */

.filter-group{
    margin-bottom: 16px;
}

.filter-label{
    font-size: 13px;
    font-weight: 600;
    color: #ddd;
    margin-bottom: 6px;
}

.filter-unit{
    font-weight: 400;
    color: #666;
    font-size: 11px;
}

.filter-option{
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 13px;
    color: #bbb;
    transition: color .15s;
}
.filter-option:hover{
    color: #fff;
}
.filter-option input[type="checkbox"]{
    width: 15px;
    height: 15px;
    accent-color: #00d9ff;
    cursor: pointer;
}

.filter-value{
    flex: 1;
}

.filter-count{
    color: #555;
    font-size: 11px;
}

/* ── Price Filter ── */

.price-filter{
    display: flex;
    align-items: center;
    gap: 6px;
}
.price-filter input{
    width: 80px;
    padding: 6px 8px;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
}
.price-filter span{
    color: #555;
}
.price-btn{
    background: #00d9ff;
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
}

/* ══════════════════════════════════════
   MAIN CONTENT
══════════════════════════════════════ */

.catalog-breadcrumb{
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.catalog-breadcrumb a{
    color: #888;
    text-decoration: none;
}
.catalog-breadcrumb a:hover{ color: #00d9ff; }
.catalog-breadcrumb .sep{ color: #444; }
.catalog-breadcrumb a:last-child{ color: #00d9ff; font-weight: 600; }

.catalog-header{
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}

.catalog-header h1{
    font-size: 22px;
    color: #fff;
    font-weight: 800;
}

.catalog-count{
    color: #666;
    font-size: 13px;
    margin-left: 8px;
}

.catalog-header-right{
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-toggle{
    display: none;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    color: #ccc;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

.catalog-sort{
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    color: #ccc;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* ── Active Filters ── */

.active-filters{
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
    align-items: center;
}

.filter-tag{
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,217,255,0.1);
    color: #00d9ff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.filter-tag a{
    color: #00d9ff;
    text-decoration: none;
    font-size: 14px;
    margin-left: 2px;
    opacity: 0.6;
}
.filter-tag a:hover{ opacity: 1; }

.filter-clear{
    color: #dc3545;
    font-size: 12px;
    text-decoration: none;
    margin-left: 8px;
}

/* ── Product Grid ── */

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

.product-card{
    background: #0d1025;
    border: 1px solid #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color .2s, transform .15s;
    position: relative;
}
.product-card:hover{
    border-color: #00d9ff;
    transform: translateY(-2px);
}

.product-card.sold-out .card-image img{
    filter: grayscale(1);
    opacity: .55;
}

.card-promo-badge{
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ff7300, #ffb300);
    color: #fff;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    z-index: 2;
}

.card-fav{
    position: absolute;
    top: 8px;
    right: 8px;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    opacity: 0.6;
    transition: opacity .15s;
}
.card-fav:hover, .card-fav.active{ opacity: 1; }

.card-image{
    aspect-ratio: 1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
    position: relative;
}
.card-image img{
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.card-image .sold-out-overlay{
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    padding: 8px 14px;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 10px;
    background: rgba(5,8,14,.78);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
    backdrop-filter: blur(8px);
}

.card-info{
    padding: 12px;
}

.card-title{
    font-size: 13px;
    color: #ddd;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-specs{
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.spec-tag{
    background: #1a1a2e;
    color: #aaa;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.card-price{
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.card-old-price{
    color: #666;
    font-size: 12px;
    text-decoration: line-through;
}
.card-current-price{
    color: #00d9ff;
    font-size: 18px;
    font-weight: 800;
}

.card-installment{
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* ── Empty State ── */

.catalog-empty{
    text-align: center;
    padding: 60px 20px;
    color: #666;
}
.catalog-empty a{
    color: #00d9ff;
    text-decoration: none;
}

/* ── Pagination ── */

.catalog-pagination{
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    margin: 34px auto 8px;
    padding: 8px 0;
}
.page-link{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 13px;
    background: rgba(17, 22, 43, .92);
    border: 1px solid rgba(0, 217, 255, .14);
    border-radius: 11px;
    color: #ccc;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
    transition: border-color .15s, color .15s, background .15s, transform .15s;
}
.page-link:hover{
    border-color: #00d9ff;
    color: #00d9ff;
    transform: translateY(-1px);
}
.page-link.active{
    background: rgba(0, 217, 255, .12);
    border-color: #00d9ff;
    color: #00d9ff;
    box-shadow: 0 0 0 1px rgba(0, 217, 255, .22), 0 10px 26px rgba(0, 217, 255, .12);
}
.page-nav{
    min-width: 46px;
    color: #ff7a18;
    border-color: rgba(255, 122, 24, .24);
}
.page-nav:hover{
    color: #fff;
    border-color: #ff7a18;
    background: rgba(255, 122, 24, .16);
}
.page-link.disabled{
    opacity: .34;
    pointer-events: none;
    color: #7b829b;
    border-color: rgba(255,255,255,.08);
}
.page-ellipsis{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 42px;
    color: #7f879c;
    font-size: 14px;
    font-weight: 900;
}

/* ══════════════════════════════════════
   MOBILE RESPONSIVE
══════════════════════════════════════ */

@media (max-width: 900px){
    .catalog-container{
        grid-template-columns: 1fr;
        padding: 10px 12px;
    }
    
    .catalog-sidebar{
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 100vh;
        min-height: 100dvh;
        background: #050816;
        z-index: 10050;
        padding: calc(18px + env(safe-area-inset-top, 0px)) 20px calc(110px + env(safe-area-inset-bottom, 0px));
        transition: transform .3s ease;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-right: none;
        transform: translateX(-100%);
        -webkit-overflow-scrolling: touch;
        box-shadow: none;
    }
    .catalog-sidebar.open{
        transform: translateX(0);
    }
    
    .sidebar-close{
        display: block;
        position: sticky;
        top: 0;
        z-index: 2;
    }
    
    .sidebar-toggle{
        display: block;
    }
    
    .sidebar-overlay{
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        background: rgba(0,0,0,0.6);
        z-index: 10049;
        opacity: 0;
        pointer-events: none;
        transition: opacity .3s;
    }
    .sidebar-overlay.open{
        opacity: 1;
        pointer-events: auto;
    }
    
    body.sidebar-open{
        overflow: hidden;
        touch-action: none;
    }
    
    .catalog-grid{
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }
    
    .catalog-header h1{
        font-size: 18px;
    }
}

@media (max-width: 480px){
    .catalog-grid{
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .card-info{ padding: 8px; }
    .card-title{ font-size: 12px; }
    .card-current-price{ font-size: 15px; }
}

@media (max-width: 700px){
    html,
    body{
        max-width: 100%;
        overflow-x: hidden;
    }

    .catalog-container,
    .catalog-main,
    .catalog-grid,
    .product-card,
    .card-info,
    .card-price{
        min-width: 0;
        box-sizing: border-box;
    }

    .catalog-container{
        width: 100%;
        max-width: 100%;
        padding-left: 12px;
        padding-right: 12px;
        overflow-x: hidden;
    }

    .catalog-grid{
        width: 100%;
        max-width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        overflow-x: hidden;
    }

    .product-card{
        width: 100%;
        max-width: 100%;
        border-radius: 12px;
    }

    .card-image{
        padding: 8px;
    }

    .card-info{
        padding: 10px 9px 11px;
    }

    .card-title{
        font-size: 12px;
        line-height: 1.25;
    }

    .card-stock,
    .card-installment{
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .card-current-price{
        font-size: 16px;
        line-height: 1.05;
    }

    .catalog-pagination{
        gap: 6px;
        margin-top: 24px;
        padding: 6px 0 12px;
    }

    .page-link{
        min-width: 38px;
        height: 38px;
        padding: 0 10px;
        border-radius: 10px;
        font-size: 13px;
    }

    .page-nav{
        min-width: 40px;
    }

    .page-ellipsis{
        min-width: 22px;
        height: 38px;
        font-size: 13px;
    }
}

@media (max-width: 360px){
    .catalog-grid{
        gap: 8px;
    }

    .card-info{
        padding: 8px;
    }

    .card-title{
        font-size: 11px;
    }

    .card-current-price{
        font-size: 15px;
    }

    .catalog-pagination{
        gap: 5px;
    }

    .page-link{
        min-width: 34px;
        height: 34px;
        padding: 0 8px;
        font-size: 12px;
    }

    .page-nav{
        min-width: 36px;
    }
}
