/* =========================================================================
   DESIGN SYSTEM - DELÍCIAS MINEIRAS
   ========================================================================= */

:root {
    /* Cores Primárias (Tons de comida mineira e fogão a lenha) */
    --color-primary: #d35400;      /* Terracota / Laranja Mineiro */
    --color-primary-hover: #ba4a00;
    --color-primary-light: #fdf2e9;
    --color-accent: #f1c40f;       /* Amarelo Ouro */
    --color-success: #27ae60;      /* Verde WhatsApp / Sucesso */
    --color-success-hover: #219653;
    
    /* Cores Neutras */
    --color-dark: #2c3e50;         /* Grafite Escuro */
    --color-dark-muted: #7f8c8d;   /* Cinza Muted */
    --color-light: #faf8f5;        /* Off-white quente */
    --color-white: #ffffff;
    --color-border: #ebdcd0;       /* Borda suave marrom/terracota claro */
    
    /* Tipografia */
    --font-main: 'Outfit', sans-serif;
    
    /* Efeitos */
    --shadow-sm: 0 2px 8px rgba(211, 84, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(211, 84, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================================================
   RESETS E CONFIGURAÇÕES GERAIS
   ========================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--color-light);
    color: var(--color-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* =========================================================================
   LOADERS E SPINNERS
   ========================================================================= */

.loader-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-light);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s;
}

.loader {
    width: 60px;
    height: 60px;
    border: 5px solid var(--color-border);
    border-top: 5px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-container p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-primary);
}

/* =========================================================================
   CABEÇALHO DA LOJA (HEADER)
   ========================================================================= */

.shop-header {
    position: relative;
    background-image: url('https://images.unsplash.com/photo-1596797038530-2c107229654b?q=80&w=1200');
    background-size: cover;
    background-position: center;
    color: var(--color-white);
    padding: 60px 20px 40px;
    text-align: left;
}

.banner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(44, 62, 80, 0.4), rgba(44, 62, 80, 0.85));
    z-index: 1;
}

.header-container {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    z-index: 2;
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 24px;
}

.shop-logo-container {
    width: 100px;
    height: 100px;
    border-radius: var(--border-radius-md);
    background-color: var(--color-white);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--color-accent);
    overflow: hidden;
    flex-shrink: 0;
}

.shop-logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-logo-default {
    font-size: 2.5rem;
    color: var(--color-primary);
}

.shop-text-info h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
}

.shop-address {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.shop-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(4px);
}

.badge-open {
    background-color: rgba(39, 174, 96, 0.25);
    color: #2ecc71;
    border: 1px solid rgba(39, 174, 96, 0.4);
}

.badge-closed {
    background-color: rgba(231, 76, 60, 0.25);
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.4);
}

.badge-delivery-info {
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

@media (max-width: 600px) {
    .shop-header {
        padding: 40px 15px 30px;
    }
    .header-main-info {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    .shop-address {
        justify-content: center;
    }
    .shop-badges {
        justify-content: center;
    }
}

/* =========================================================================
   BARRA DE NAVEGAÇÃO DE CATEGORIAS (STICKY)
   ========================================================================= */

.category-nav-wrapper {
    position: sticky;
    top: 0;
    background-color: rgba(250, 248, 245, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.category-nav-container {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    gap: 8px;
    padding: 12px 15px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none; /* Firefox */
}

.category-nav-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.category-tab {
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-dark);
    background-color: rgba(211, 84, 0, 0.04);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
}

.category-tab:hover {
    background-color: rgba(211, 84, 0, 0.08);
    color: var(--color-primary);
}

.category-tab.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 4px 12px rgba(211, 84, 0, 0.2);
}

/* =========================================================================
   BUSCA E CARDÁPIO PRINCIPAL
   ========================================================================= */

.menu-container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 15px 120px;
    flex-grow: 1;
}

.search-bar-container {
    margin-bottom: 24px;
}

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

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-dark-muted);
    font-size: 1.1rem;
}

#search-input {
    width: 100%;
    padding: 16px 50px 16px 48px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--border-radius-md);
    border: 1.5px solid var(--color-border);
    background-color: var(--color-white);
    color: var(--color-dark);
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

#search-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(211, 84, 0, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-dark-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

/* Seção de Categorias */
.category-section {
    margin-bottom: 40px;
    scroll-margin-top: 80px; /* Evita que o cabeçalho sticky tampe o título ao scrollar */
}

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 24px;
    background-color: var(--color-primary);
    border-radius: 3px;
}

/* Grid de Itens */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

@media (max-width: 850px) {
    .items-grid {
        grid-template-columns: 1fr;
    }
}

/* Card do Item de Menu */
.item-card {
    background-color: var(--color-white);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
    padding: 16px;
    display: flex;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: rgba(211, 84, 0, 0.25);
}

.item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.item-name-row h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 6px;
    line-height: 1.3;
}

.item-description {
    font-size: 0.88rem;
    color: var(--color-dark-muted);
    line-height: 1.45;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.item-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-primary);
}

.item-img-container {
    width: 110px;
    height: 110px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    background-color: #f1f2f6;
}

.item-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.item-card:hover .item-img-container img {
    transform: scale(1.08);
}

/* Badges e Overlay de Indisponível */
.item-card.unavailable {
    opacity: 0.7;
}

.item-card.unavailable .item-img-container::after {
    content: 'Indisponível';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--color-white);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
}

/* Botões de Ação */
.btn-add-cart {
    background-color: var(--color-primary-light);
    color: var(--color-primary);
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-add-cart:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
    transform: scale(1.1);
}

.btn-add-cart:disabled {
    background-color: #f5f6fa;
    color: #ced6e0;
    cursor: not-allowed;
    transform: none;
}

/* Mensagens de estado vazio */
.empty-menu-message, .no-results-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-dark-muted);
}

.empty-menu-message .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.no-results-message i {
    font-size: 3rem;
    color: var(--color-border);
    margin-bottom: 16px;
}

/* =========================================================================
   BARRA DE CARRINHO FLUTUANTE (FLOAT CART)
   ========================================================================= */

.floating-cart-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    max-width: 550px;
    z-index: 500;
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.open-cart-btn {
    width: 100%;
    background-color: var(--color-success);
    color: var(--color-white);
    border: none;
    padding: 16px 24px;
    border-radius: 50px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(39, 174, 96, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.open-cart-btn:hover {
    background-color: var(--color-success-hover);
    box-shadow: 0 12px 35px rgba(39, 174, 96, 0.5);
    transform: translateY(-2px);
}

.cart-btn-qty {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9rem;
}

.cart-btn-text {
    flex-grow: 1;
    text-align: left;
    margin-left: 12px;
}

.cart-btn-total {
    font-weight: 800;
    margin-right: 8px;
}

/* =========================================================================
   MODAL DE CHECKOUT / SACOLA
   ========================================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(44, 62, 80, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    justify-content: flex-end; /* Abre lateralmente ou como gaveta */
}

.modal-content {
    background-color: var(--color-light);
    width: 100%;
    max-width: 550px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: drawerSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes drawerSlide {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-white);
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-dark);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-dark-muted);
    cursor: pointer;
    padding: 4px;
    transition: var(--transition);
}

.close-modal-btn:hover {
    color: var(--color-primary);
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    background-color: var(--color-white);
    border-top: 1px solid var(--color-border);
}

/* Sessão de Carrinho com Itens */
.cart-section {
    background-color: var(--color-white);
    border-radius: var(--border-radius-md);
    border: 1px solid var(--color-border);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.cart-section h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Lista de Itens */
.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f5ebe6;
}

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

.cart-item-details {
    flex-grow: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-dark);
    margin-bottom: 4px;
}

.cart-item-price {
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.9rem;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    background-color: #fdf2e9;
    color: var(--color-primary);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    transition: var(--transition);
}

.qty-btn:hover {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.cart-item-qty {
    font-weight: 700;
    font-size: 0.95rem;
    min-width: 20px;
    text-align: center;
}

/* Opções de Entrega / Retirada */
.delivery-options-grid, .payment-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.payment-options-grid {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 400px) {
    .payment-options-grid {
        grid-template-columns: 1fr;
    }
}

.delivery-option-card, .payment-option-card {
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    padding: 14px;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.delivery-option-card input, .payment-option-card input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.option-card-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-dark);
}

.option-card-content i {
    font-size: 1.25rem;
    color: var(--color-dark-muted);
}

.delivery-option-card:has(input:checked), .payment-option-card:has(input:checked) {
    border-color: var(--color-primary);
    background-color: var(--color-primary-light);
}

.delivery-option-card:has(input:checked) .option-card-content,
.payment-option-card:has(input:checked) .option-card-content {
    color: var(--color-primary);
}

.delivery-option-card:has(input:checked) .option-card-content i,
.payment-option-card:has(input:checked) .option-card-content i {
    color: var(--color-primary);
}

/* Formulário de Checkout */
.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group-row {
    display: flex;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.flex-3 { flex: 3; }
.flex-2 { flex: 2; }

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-dark);
}

.form-group input {
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    border: 1.5px solid var(--color-border);
    background-color: var(--color-light);
    font-size: 0.95rem;
    color: var(--color-dark);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--color-primary);
    background-color: var(--color-white);
    box-shadow: 0 0 0 3px rgba(211, 84, 0, 0.08);
}

.takeout-instructions {
    font-size: 0.9rem;
    line-height: 1.5;
    background-color: var(--color-primary-light);
    color: var(--color-primary-hover);
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    border-left: 4px solid var(--color-primary);
}

/* Resumo de Valores */
.summary-box {
    background-color: #fdfaf7;
    border: 1.5px dashed var(--color-border);
}

.summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    color: var(--color-dark-muted);
    margin-bottom: 10px;
}

.summary-line.total-line {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1.5px dashed var(--color-border);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--color-dark);
}

.summary-line.total-line span:last-child {
    color: var(--color-primary);
}

.free-delivery-alert {
    background-color: rgba(39, 174, 96, 0.1);
    color: var(--color-success);
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 10px;
    text-align: center;
}

/* Botões */
.btn {
    border: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 12px 24px;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--color-white);
    padding: 16px 24px;
}

.btn-success:hover {
    background-color: var(--color-success-hover);
    transform: translateY(-2px);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-large {
    font-size: 1.1rem;
}

/* Estado de sacola vazia */
.empty-cart-view {
    text-align: center;
    padding: 60px 20px;
}

.empty-cart-icon {
    font-size: 4rem;
    color: var(--color-border);
    margin-bottom: 20px;
}

.empty-cart-view p {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 6px;
}

.empty-cart-view p.subtitle {
    font-size: 0.95rem;
    color: var(--color-dark-muted);
    font-weight: 400;
    margin-bottom: 24px;
}

/* =========================================================================
   ANIMAÇÕES E TRANSICÕES ADICIONAIS
   ========================================================================= */

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}
