/* ==========================================================================
   Portfolio  — Frontend
   Usa as mesmas variáveis de cor do tema (--primary, --text, --light, etc.)
   com fallbacks caso o tema principal não as defina.
   ========================================================================== */

:root{
    --pf-primary: var(--primary, #16537f);
    --pf-accent: #00c9a7;
    --pf-text: var(--text, #29323c);
    --pf-text-muted: var(--text-muted, #757575);
    --pf-light: var(--light, #f5f7fa);
    --pf-border: #e5e9ee;
    --pf-radius: 16px;
}

/* ── Filter bar ── */
.filter-bar{
    background: #fff;
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: 0 2px 10px rgba(20,30,50,.04);
}

.filter-select{
    width: 100%;
    padding: .6rem .75rem;
    border: 1px solid var(--pf-border);
    border-radius: 10px;
    background: #fff;
    color: var(--pf-text);
    font-size: .9rem;
}

.filter-select:focus{
    outline: none;
    border-color: var(--pf-primary);
    box-shadow: 0 0 0 .2rem rgba(22,83,127,.12);
}

#priceRange{
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--pf-primary) 0%, var(--pf-primary) var(--pct, 100%), var(--pf-border) var(--pct, 100%), var(--pf-border) 100%);
    margin-top: .35rem;
}

#priceRange::-webkit-slider-thumb{
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pf-primary);
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--pf-primary);
    cursor: pointer;
}

#priceRange::-moz-range-thumb{
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--pf-primary);
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--pf-primary);
    cursor: pointer;
}

.range-labels{
    display: flex;
    justify-content: space-between;
    font-size: .75rem;
    color: var(--pf-text-muted);
    margin-top: .25rem;
}

.btn-outline{
    display: inline-block;
    border: 1px solid var(--pf-border);
    color: var(--pf-text);
    background: #fff;
    border-radius: 10px;
    padding: .55rem 1rem;
    font-size: .9rem;
    text-decoration: none;
    transition: .2s;
}
.btn-outline:hover{
    border-color: var(--pf-primary);
    color: var(--pf-primary);
}

/* ── Results bar ── */
.results-bar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem .25rem;
    flex-wrap: wrap;
    gap: .5rem;
}

.sort-select{
    padding: .45rem .75rem;
    border: 1px solid var(--pf-border);
    border-radius: 10px;
    background: #fff;
    font-size: .85rem;
    color: var(--pf-text);
}

/* ── Product grid ── */
.product-grid{
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.product-card{
    position: relative;
    background: #fff;
    border: 1px solid var(--pf-border);
    border-radius: var(--pf-radius);
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease;
}

.product-card:hover{
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(20,30,50,.09);
}

.product-card-img{
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--pf-light);
    padding: 1rem;
}

.product-card-img svg,
.product-card-img img{
    width: 100%;
    height: 100%;
}

.card-type-badge{
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: .7rem;
    font-weight: 600;
    padding: .3rem .6rem;
    border-radius: 20px;
    color: #fff;
    text-transform: capitalize;
    background: var(--pf-primary);
}

.card-type-badge.type-biometria{ background: #16537f; }
.card-type-badge.type-smart{ background: #1d6fa8; }
.card-type-badge.type-rfid{ background: #6b7280; }
.card-type-badge.type-senha{ background: #9333ea; }
.card-type-badge.type-bluetooth{ background: #2563eb; }

.wish-btn{
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,.9);
    color: var(--pf-text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    transition: .2s;
}
.wish-btn:hover{ color: #e0245e; }
.wish-btn.active{ color: #e0245e; background: #fff; }

.product-card-body{
    padding: 1rem 1.1rem 1.25rem;
}

.p-brand-line{
    font-size: .75rem;
    color: var(--pf-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .15rem;
}

.p-name{
    font-weight: 600;
    color: var(--pf-text);
    margin-bottom: .5rem;
    display: block;
}

.p-tags{
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin-bottom: .6rem;
}

.p-tag{
    font-size: .7rem;
    background: var(--pf-light);
    color: var(--pf-text-muted);
    padding: .2rem .55rem;
    border-radius: 20px;
}

.p-price{
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--pf-primary);
}

.p-price-inst{
    font-size: .8rem;
    color: var(--pf-text-muted);
}

.btn-brand{
    display: inline-block;
    background: var(--pf-primary);
    color: #fff !important;
    border: none;
    border-radius: 10px;
    padding: .6rem 1rem;
    font-size: .9rem;
    text-decoration: none;
    transition: .2s;
}
.btn-brand:hover{
    background: #123f60;
    color: #fff;
}

/* ── Página de produto ── */
.thumb-img{
    transition: border-color .2s;
}
.thumb-img:hover{
    border-color: var(--pf-primary) !important;
}

.price-box{
    border: 1px solid var(--pf-border);
}

.product-description{
    color: var(--pf-text);
    line-height: 1.7;
}

@media (max-width: 767.98px){
    .product-grid{
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 1rem;
    }
}

/* ==========================================================================
   Hero da página do portfólio
   ========================================================================== */
.portfolio-hero{
    background: linear-gradient(135deg, var(--pf-primary), var(--pf-accent));
    padding: 3.5rem 0 2.5rem;
    text-align: center;
    color: #fff;
}
.portfolio-hero .label{
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.85);
}
.portfolio-hero h1{
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    margin: .5rem 0;
}
.portfolio-hero p{
    color: rgba(255,255,255,.85);
    max-width: 600px;
    margin: 0 auto;
}

.p-price-old{
    text-decoration: line-through;
    color: var(--pf-text-muted);
    font-size: .85rem;
}

/* ==========================================================================
   Botão de favoritos (injetado ao lado do theme toggle via JS)
   ========================================================================== */
.fav-nav-btn{
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--pf-border);
    background: #fff;
    color: var(--pf-text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 1rem;
    transition: .2s;
}
.fav-nav-btn:hover{ color: #ef4444; border-color: #ef4444; }

.fav-nav-count{
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 99px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
}

.fav-nav-btn-floating{
    position: fixed;
    bottom: 7.5rem;
    right: 2rem;
    z-index: 998;
    width: 48px;
    height: 48px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

/* ==========================================================================
   Modal de produto
   ========================================================================== */
.product-modal .modal-content{
    border-radius: var(--pf-radius);
    border: 1px solid var(--pf-border);
}
.product-modal .modal-header{
    border-bottom: 1px solid var(--pf-border);
    padding: 1.25rem 1.5rem;
}

.modal-img-viewer{
    background: var(--pf-light);
    border-radius: var(--pf-radius);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 1rem;
}
.modal-img-viewer img,
.modal-img-viewer svg{
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-thumb-row{
    display: flex;
    gap: .5rem;
    margin-top: .75rem;
    flex-wrap: wrap;
}
.modal-thumb{
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: var(--pf-light);
    border: 2px solid transparent;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .2s, transform .2s;
}
.modal-thumb img{ width: 100%; height: 100%; object-fit: cover; }
.modal-thumb:hover{ border-color: var(--pf-primary); transform: scale(1.05); }
.modal-thumb.active{ border-color: var(--pf-primary); }

.modal-info-col{
    max-height: 75vh;
    overflow-y: auto;
    padding-right: .25rem;
}

.modal-brand{
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--pf-text-muted);
    margin-bottom: .35rem;
}
.modal-title-prod{
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: .75rem;
}
.modal-desc{
    font-size: .9rem;
    color: var(--pf-text-muted);
    line-height: 1.7;
    margin-bottom: 1.25rem;
    max-height: 100px;
    overflow-y: auto;
}

.specs-grid{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
    margin-bottom: 1.25rem;
}
.spec-item{
    background: var(--pf-light);
    border: 1px solid var(--pf-border);
    border-radius: 10px;
    padding: .6rem .9rem;
}
.spec-lbl{
    font-size: .68rem;
    color: var(--pf-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .15rem;
}
.spec-val{ font-size: .9rem; font-weight: 600; }

.modal-resources{ display: flex; flex-wrap: wrap; gap: .4rem; }
.res-tag{
    background: var(--pf-light);
    border: 1px solid var(--pf-border);
    border-radius: 99px;
    font-size: .75rem;
    padding: 3px 12px;
    color: var(--pf-text);
}

.modal-price{
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--pf-primary);
}
.modal-installment{
    font-size: .82rem;
    color: var(--pf-text-muted);
}

/* ==========================================================================
   Modal de favoritos
   ========================================================================== */
#favoritesModal .product-grid{
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
