/* Variáveis Globais & Design System */
:root {
    /* Paleta de Cores Premium */
    --brand-dark: #2C1810;
    /* Marrom Café Profundo */
    --brand-primary: #A0522D;
    /* Sienna (Cor da marca original, mantida mas ajustada) */
    --brand-accent: #E67E22;
    /* Laranja Queijo Vibrante */
    --brand-light: #FDFBF7;
    /* Cream/Off-white fundo principal */

    --text-primary: #1A1A1A;
    --text-secondary: #595959;
    --text-light: #8C8C8C;

    --success: #27AE60;
    --error: #C0392B;

    /* Superfícies */
    --surface-white: #FFFFFF;
    --surface-hover: #FFF8F0;
    --stroke: #E5E5E5;

    /* Sombras (Elevation) */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Tipografia */
    --font-title: 'Poppins', sans-serif;
    --font-body: 'Roboto', sans-serif;

    /* Spacing & Radius */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
}

/* Reset Moderno */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--brand-light);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Layout Principal */
.bg-overlay {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Cabeçalho Premium */
header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--stroke);
    padding: 1.5rem 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all 0.3s ease;
}

header h1 {
    font-family: var(--font-title);
    font-weight: 700;
    font-size: 2rem;
    color: var(--brand-dark);
    letter-spacing: -0.5px;
    margin-bottom: 0.25rem;
}

header p {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 600px;
    margin: 0 auto 1rem;
}

.search-bar {
    margin: 0.5rem auto 0;
    margin-top: 1.25rem;
    width: 100%;
    max-width: 480px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.85rem;
    background: #f5f2ed;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.search-bar .search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b6b6b;
}

.search-bar input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-primary);
}

.search-bar input::placeholder {
    color: #6b6b6b;
}

/* Botão Instagram - Estilo Pill */
header .btn-instagram {
    position: absolute;
    top: 50%;
    right: 1.5rem;
    transform: translateY(-50%);
    z-index: 101;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, #DD2A7B, #8134AF);
    color: white;
    font-weight: 500;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(221, 42, 123, 0.2);
}

header .btn-instagram:hover {
    transform: translateY(calc(-50% - 2px));
    box-shadow: 0 6px 16px rgba(221, 42, 123, 0.3);
}

/* Catálogo & Seções */
.catalogo {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1.5rem 6rem;
    /* Padding bottom extra para o carrinho */
}

.secao {
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-out forwards;
}

.secao-titulo {
    font-family: var(--font-title);
    font-size: 1.75rem;
    color: var(--brand-dark);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.secao-titulo::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--brand-primary);
    border-radius: 2px;
}

.secao-divisor {
    border: 0;
    height: 1px;
    background: var(--stroke);
    margin: 3rem auto;
    width: 80%;
    opacity: 0.5;
}

/* Grid de Produtos */
.itens-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

/* Card de Produto - Premium */
.item {
    background: var(--surface-white);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(160, 82, 45, 0.2);
}

.item img {
    width: 100%;
    height: 180px;
    object-fit: contain;
    mix-blend-mode: multiply;
    /* Melhor integração com fundo branco */
    transition: transform 0.3s ease;
}

.item:hover img {
    transform: scale(1.05);
}

.item h2 {
    font-family: var(--font-title);
    font-size: 1.1rem;
    color: var(--brand-dark);
    font-weight: 600;
    min-height: 40px;
    /* Alinhamento para títulos de 2 linhas */
    margin-top: 0.5rem;
}

.item .details {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
    flex-grow: 1;
    /* Empurra o preço e botões para baixo */
}

.item .price {
    font-family: var(--font-title);
    font-size: 1.25rem;
    color: var(--brand-primary);
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Global Buttons */
.btn-primary {
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    transition: transform 0.2s, background 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    transform: translateY(-2px);
    background: #219150;
}

.btn-primary:disabled {
    background: #555;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.7;
}

.btn-secondary {
    background: transparent;
    color: var(--brand-dark);
    border: 2px solid var(--stroke);
    padding: 0.6rem 1.2rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--brand-dark);
    transform: translateY(-1px);
}

/* Botões do Card */
.btn-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* Espalha botões e qtd */
    background: var(--surface-hover);
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}

.btn-add,
.btn-remove {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: white;
    color: var(--brand-dark);
    font-weight: 600;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-add {
    background: var(--brand-dark);
    color: white;
}

.btn-add:hover {
    background: #42261b;
}

.btn-remove:hover {
    background: #e0e0e0;
}

.quantity {
    font-weight: 600;
    font-size: 1rem;
    color: var(--brand-dark);
    min-width: 30px;
    text-align: center;
}

/* Barra de Carrinho Flutuante - Glassmorphism */
.cart-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(44, 24, 16, 0.95);
    /* Brand dark com transparência */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: all 0.3s ease;
}

.cart-bar.hidden {
    transform: translate(-50%, 150%);
    /* Esconde para baixo */
}

.cart-bar.highlight {
    transform: translateX(-50%) scale(1.05);
}

.cart-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    justify-content: flex-end;
}

.info-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* Alinha "Total" à direita */
    line-height: 1.2;
}

.info-group strong {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-group span {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.cart-bar .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.cart-bar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cart-bar .btn-primary {
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    transition: transform 0.2s, background 0.2s;
}

.cart-bar .btn-primary:hover {
    transform: translateY(-2px);
    background: #219150;
}

.cart-bar .btn-primary:disabled {
    background: #555;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: 0.7;
}

/* Página Sacola */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--surface-white);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto auto;
    gap: 1.5rem;
    align-items: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--stroke);
}

.cart-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cart-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
}

.cart-item .item-name {
    font-weight: 600;
    color: var(--brand-dark);
}

.cart-qty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
}

.cart-remove {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
    margin-left: auto;
    /* Empurra para direita se flex */
}

.cart-remove:hover {
    background: var(--error);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(192, 57, 43, 0.2);
}

#cartEmpty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-family: var(--font-body);
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--surface-white);
    border-radius: var(--radius-md);
    width: min(720px, 92vw);
    margin: 20px auto;
    box-shadow: var(--shadow-sm);
}

#cartEmpty svg {
    stroke: var(--text-light);
    opacity: 0.5;
}

#cartEmpty p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--brand-dark);
}

#cartEmpty span {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.cart-qty button {
    width: 30px;
    height: 30px;
    border: none;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-white);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Toast Notification */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--brand-dark);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideLeft 0.3s ease-out forwards;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast svg {
    width: 20px;
    height: 20px;
    fill: var(--success);
}

@keyframes slideLeft {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 100%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer */
footer {
    background: var(--brand-dark);
    color: white;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
}

/* Utilities */
/* Utilities */

/* Responsividade */
@media (max-width: 768px) {
    header {
        padding: 0.8rem;
    }

    header h1 {
        font-size: 1.3rem;
        margin-bottom: 0.1rem;
    }

    header p {
        font-size: 0.85rem;
        margin-bottom: 0.8rem;
    }

    header .btn-instagram {
        position: absolute;
        top: 50%;
        right: 0.75rem;
        transform: translateY(-50%);
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }

    header .btn-instagram:hover {
        transform: translateY(calc(-50% - 1px));
    }

    .catalogo {
        padding: 1rem 1rem 8rem;
        /* Mais espaço embaixo para cart bar */
    }

    .secao-titulo {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }

    .itens-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .item {
        padding: 0.8rem;
    }

    .item img {
        height: 150px;
        /* Foto maior e mais atrativa */
        margin-bottom: 0.5rem;
    }

    .item h2 {
        font-size: 0.95rem;
        min-height: auto;
        line-height: 1.3;
    }

    .item .price {
        font-size: 1.1rem;
    }

    /* Botões redondos e mais táteis no mobile */
    .btn-add,
    .btn-remove {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        font-size: 1.2rem;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

    .btn-add {
        background: var(--brand-dark);
        color: white;
    }

    .cart-qty .quantity {
        font-size: 1.1rem;
    }

    /* Ajustes da barra de carrinho mobile */
    .cart-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "info info"
            "bag checkout";
        gap: 0.75rem;
        border-radius: 20px 20px 0 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        padding: 1rem;
        padding-bottom: 1.5rem;
        /* Espaço seguro para iOS */
    }

    /* Mapeando áreas do grid */
    .cart-bar .cart-info {
        grid-area: info;
        display: flex;
        justify-content: space-around;
        /* Espalha Itens e Total */
        width: 100%;
        background: rgba(255, 255, 255, 0.1);
        padding: 0.3rem;
        border-radius: 12px;
    }

    .info-group strong {
        font-size: 0.5rem;
    }

    .info-group span {
        font-size: 0.75rem;
    }

    .cart-bar .btn-secondary {
        grid-area: bag;
        width: 100%;
    }

    .cart-bar .btn-primary {
        grid-area: checkout;
        width: 100%;
    }

    /* Estilo Sacola Mobile */
    .cart-item {
        grid-template-columns: 60px 1fr;
        grid-template-areas:
            "img info"
            "qty total";
        gap: 0.75rem;
    }

    .cart-item img {
        grid-area: img;
        width: 60px;
        height: 60px;
    }

    .cart-item>div:nth-child(2) {
        grid-area: info;
    }

    .cart-qty {
        grid-area: qty;
        width: fit-content;
    }

    .item-total {
        grid-area: total;
        text-align: right;
    }
}

/* Utilities (Fix) */
.hidden,
#cartEmpty.hidden {
    display: none !important;
    visibility: hidden !important;
}