/* ==========================================================================
   SALGADOLANDIA 2.0 - DESIGN SYSTEM (iFood-like)
   ========================================================================== */

:root {
    /* Cores Principais - Focadas na Identidade Visual (Logo) */
    --color-primary: #F9AC19;      /* Amarelo/Laranja da Logo */
    --color-primary-hover: #E09815;
    --color-primary-light: #FFF0D4;
    
    --color-secondary: #621C07;    /* Marrom escuro do texto da logo */
    --color-success: #50A773;      /* Verde vibrante para sucesso */
    --color-success-light: #E7F6ED;
    --color-warning: #FFC107;
    --color-danger: #EA1D2C;

    /* Neutras / Fundo */
    --color-background: #FFFDF9;   /* Fundo puxado para um creme super leve */
    --color-surface: #FFFFFF;      /* Branco puro para cards */
    --color-surface-hover: #F8F9FA;
    
    /* Tipografia e Textos */
    --text-primary: #4A2B20;       /* Marrom super escuro (legibilidade) */
    --text-secondary: #7F5849;     /* Marrom médio */
    --text-tertiary: #A6A6A6;      /* Cinza claro para placeholders/disabled */
    --text-inverse: #FFFFFF;

    /* Geometria e Sombras */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 500px;
    
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-floating: 0 12px 32px rgba(0,0,0,0.15);

    /* Transições */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent; /* Remove blur azul no mobile */
}

body {
    background-color: var(--color-background);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* Espaço para o Bottom Nav */
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
}

/* ==========================================================================
   HEADER (TOP BAR)
   ========================================================================== */
.app-header {
    background: var(--color-surface);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1030;
    box-shadow: var(--shadow-sm);
}

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

.app-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-primary);
    letter-spacing: -0.5px;
}

.app-logo i {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.search-bar-wrapper {
    flex: 1;
    max-width: 500px;
    margin: 0 20px;
    position: relative;
    display: none; /* Só mostra no Desktop */
}

@media (min-width: 768px) {
    .search-bar-wrapper { display: block; }
}

.search-bar {
    width: 100%;
    background: var(--color-background);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 16px 10px 40px;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.search-bar:focus {
    outline: none;
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(234, 29, 44, 0.1);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

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

/* ==========================================================================
   BOTTOM NAVIGATION (MOBILE)
   ========================================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--color-surface);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 1040;
}

@media (min-width: 768px) {
    .bottom-nav { display: none; }
    body { padding-bottom: 0; }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-tertiary);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    gap: 4px;
    position: relative;
    transition: var(--transition-fast);
}

.bottom-nav-item i {
    font-size: 1.4rem;
    transition: transform var(--transition-fast);
}

.bottom-nav-item.active {
    color: var(--color-primary);
}

.bottom-nav-item.active i {
    transform: translateY(-2px);
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

/* Badge no Bottom Nav */
.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-primary);
    color: var(--text-inverse);
    font-size: 0.65rem;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-surface);
}

/* ==========================================================================
   BOTÕES GLOBAIS
   ========================================================================== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 10px 20px;
    transition: var(--transition-fast);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--text-inverse);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: var(--text-inverse);
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background-color: transparent;
}

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

/* Botão Flutuante (Floating Action Button) - Ver Sacola */
.fab-cart {
    position: fixed;
    bottom: 80px; /* Acima do bottom nav */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    box-shadow: var(--shadow-floating);
    z-index: 1035;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

@media (min-width: 768px) {
    .fab-cart { bottom: 30px; }
}

.fab-cart:active {
    transform: translateX(-50%) scale(0.98);
}

.fab-cart-qty {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ==========================================================================
   CAROUSEL E CATEGORIAS (HOME)
   ========================================================================== */
.promo-carousel {
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 20px 0;
    box-shadow: var(--shadow-sm);
}

.promo-carousel img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

@media (min-width: 768px) {
    .promo-carousel img { height: 280px; }
}

/* Filtros Horizontais */
.category-filter {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 4px 0 16px 0;
    scrollbar-width: none; /* Firefox */
}
.category-filter::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.cat-chip {
    background: var(--color-surface);
    border: 1px solid #E5E5E5;
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
    cursor: pointer;
}

.cat-chip:active {
    transform: scale(0.95);
}

.cat-chip.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* ==========================================================================
   CARDS DE PRODUTO (LISTAGEM ESTILO iFOOD)
   ========================================================================== */
.category-section {
    margin-bottom: 40px;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.product-list-card {
    display: flex;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}

.product-list-card:hover {
    box-shadow: var(--shadow-md);
    border-color: #f1f1f1;
}

.product-list-info {
    flex: 1;
    padding-right: 16px;
    display: flex;
    flex-direction: column;
}

.product-list-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.3;
}

.product-list-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 12px;
    line-height: 1.4;
}

.product-list-price-wrapper {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.product-list-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-primary);
}

.product-list-old-price {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.product-list-img-wrapper {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: #E9ECEF;
    position: relative;
}

@media (min-width: 768px) {
    .product-list-img-wrapper { width: 140px; height: 140px; }
}

.product-list-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Badges sobrepostas na imagem */
.badge-overlay {
    position: absolute;
    top: -5px;
    right: -5px;
}

/* ==========================================================================
   MODAL / BOTTOM SHEET DO PRODUTO
   ========================================================================== */
.product-modal .modal-dialog {
    margin: 0;
    height: 100%;
    align-items: flex-end; /* Abre por baixo no mobile */
}

@media (min-width: 768px) {
    .product-modal .modal-dialog {
        margin: 1.75rem auto;
        height: auto;
        align-items: center;
    }
}

.product-modal .modal-content {
    border: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    height: 90vh; /* Ocupa 90% da tela no mobile */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .product-modal .modal-content {
        border-radius: var(--radius-lg);
        height: auto;
        max-height: 90vh;
    }
}

.pm-header {
    position: relative;
    width: 100%;
    height: 250px;
    flex-shrink: 0;
}

.pm-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pm-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    background: var(--color-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    font-size: 1.2rem;
}

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

.pm-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.pm-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.pm-footer {
    padding: 16px 24px;
    background: var(--color-surface);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

/* ==========================================================================
   CARRINHO (DRAWER/OFFCANVAS)
   ========================================================================== */
.cart-offcanvas {
    border-left: none;
    box-shadow: var(--shadow-lg);
    width: 100%;
}
@media (min-width: 768px) {
    .cart-offcanvas { width: 400px; }
}

.cart-item {
    display: flex;
    padding: 16px 0;
    border-bottom: 1px solid #f1f1f1;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    margin-right: 16px;
}

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

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

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

/* Controle de Quantidade Moderno */
.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid #E5E5E5;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.qty-btn {
    background: transparent;
    border: none;
    color: var(--color-primary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
}

.qty-btn:active { background: #f5f5f5; }

.qty-val {
    width: 32px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

/* ==========================================================================
   SKELETON LOADING
   ========================================================================== */
.skeleton {
    background: #e2e5e7;
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0));
    background-size: 40px 100%;
    background-repeat: no-repeat;
    background-position: left -40px top 0;
    animation: shine 1s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes shine {
    to { background-position: right -40px top 0; }
}

.sk-text { height: 16px; margin-bottom: 8px; width: 100%; }
.sk-title { height: 24px; margin-bottom: 12px; width: 70%; }
.sk-img { height: 100%; width: 100%; }

/* ==========================================================================
   CHAT BOT IA - TYPING INDICATOR
   ========================================================================== */
.chat-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
}

.chat-typing-dots span {
    width: 6px;
    height: 6px;
    background-color: var(--color-primary);
    border-radius: 50%;
    animation: chatBouncing 1.4s infinite ease-in-out both;
}

.chat-typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes chatBouncing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.chat-quick-reply {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-pill);
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.chat-quick-reply:hover {
    background: var(--color-primary);
    color: white;
}

