/* Variaveis e Reset */
:root {
    --color-primary: rgb(92, 5, 39);
    /* Vinho/Bordô - Cor Principal */
    --color-secondary: rgb(253, 248, 226);
    /* Bege Claro - Cor Secundária */
    --color-accent: #8b4513;
    /* Marrom para detalhes */
    --color-bg: #fdfdfd;
    /* Off-white */
    --color-text: #333;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-heading: 'Georgia', serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

button {
    cursor: pointer;
    border: none;
    font-family: inherit;
}

/* Layout Geral */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
header {
    background: var(--color-secondary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--color-primary);
    font-weight: bold;
}

/* Busca */
.search-bar {
    position: relative;
    max-width: 500px;
    width: 100%;
    margin: 0 2rem;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    border-radius: 25px;
    border: 1px solid #ddd;
    background: #f9f9f9;
    transition: all 0.3s;
}

.search-bar input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 5px rgba(92, 5, 39, 0.2);
    background: white;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: none;
    margin-top: 5px;
    z-index: 10;
}

.search-results .item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.search-results .item:hover {
    background: #f5f5f5;
}

.search-results .item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* Sacola Icone */
.cart-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--color-accent);
    color: white;
    font-size: 0.75rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Hero */
.hero {
    background: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url('https://placehold.co/1200x400/4a5d23/FFFFFF?text=Aromas+e+Sabores');
    background-size: cover;
    background-position: center;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero p {
    font-size: 1.2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Categorias Nav */
.categories-nav {
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    background: var(--color-secondary);
    overflow-x: auto;
    white-space: nowrap;
}

.categories-nav .container {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.cat-link {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.cat-link:hover,
.cat-link.active {
    background: var(--color-primary);
    color: white;
}

/* Grid Produtos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.product-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #eee;
}

.product-info {
    padding: 1rem;
}

.product-cat {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-name {
    font-weight: 600;
    margin: 0.5rem 0;
    color: var(--color-primary);
}

.product-code {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 0.5rem;
}

.product-price {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1rem;
}

.product-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.btn-details {
    background: #f0f0f0;
    color: #333;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

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

.btn-add {
    background: var(--color-primary);
    color: white;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-add:hover {
    background: rgba(92, 5, 39, 0.8);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 1000;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 800px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    max-height: 90vh;
}

.modal-overlay.open .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    display: flex;
    flex-direction: row;
    width: 100%;
    overflow-y: auto;
}

.modal-img-container {
    width: 50%;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-img {
    max-width: 100%;
    max-height: 500px;
    object-fit: cover;
}

.modal-details {
    width: 50%;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.modal-details h2 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.modal-code {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.modal-desc {
    flex: 1;
    color: #555;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-price {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 1.5rem;
}

.modal-footer button {
    width: 100%;
    padding: 15px;
    background: var(--color-primary);
    color: white;
    font-size: 1.1rem;
    border-radius: 6px;
}

/* Sacola (Side Drawer) */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s;
    z-index: 1100;
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    transform: translateX(0);
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
}

.cart-header h2 {
    font-size: 1.2rem;
}

.cart-close {
    font-size: 1.5rem;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-item {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-size: 0.9rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.cart-item-code {
    font-size: 0.75rem;
    color: #999;
    margin-bottom: 2px;
}

.cart-item-price {
    font-size: 0.9rem;
    color: #666;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 5px;
}

.qty-btn {
    width: 24px;
    height: 24px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    background: #fafafa;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.btn-checkout {
    width: 100%;
    padding: 15px;
    background: #25D366;
    color: white;
    font-weight: bold;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-checkout:hover {
    background: #128C7E;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
}

.toast {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    margin-top: 10px;
    opacity: 0;
    animation: fadeUp 0.3s forwards;
}

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

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

/* Responsivo */
@media (max-width: 768px) {
    .modal-content {
        flex-direction: column;
        height: 90vh;
    }

    .modal-img-container,
    .modal-details {
        width: 100%;
    }

    .modal-img-container {
        height: 250px;
    }

    .search-bar {
        display: none;
    }

    /* Simplificar para mobile ou por icone depois */
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Footer */
footer {
    background: var(--color-primary);
    color: white;
    padding: 2rem;
    margin-top: 2rem;
}

footer .container {
    text-align: center;
}