/* =========================================
   1. VARIÁVEIS & RESET (Identidade King Menus)
   ========================================= */
:root {
    --king-gold: #FFD700;       /* Ouro Principal */
    --king-gold-hover: #E6C200; /* Ouro Escuro */
    --king-black: #1a1a1a;      /* Preto Fundo */
    --king-dark: #333333;       /* Texto Escuro */
    --king-gray: #f4f4f9;       /* Fundo Claro */
    --king-white: #ffffff;
    
    --color-success: #28a745;   /* Verde */
    --color-danger: #dc3545;    /* Vermelho */
    --color-info: #17a2b8;      /* Azul */
    
    --radius-app: 12px;         /* Arredondamento */
    --shadow-card: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-float: 0 4px 20px rgba(0, 0, 0, 0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--king-gray);
    color: var(--king-dark);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px; /* Espaço para o carrinho mobile */
}

/* =========================================
   2. HEADER & CAPA (Visual Premium)
   ========================================= */
.ifood-header {
    background-color: var(--king-black);
    color: var(--king-white);
    position: relative;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.cover-image {
    height: 180px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.3), rgba(0,0,0,0.95));
    z-index: 1;
}

.header-content {
    position: absolute;
    bottom: 20px; left: 0; width: 100%;
    padding: 0 20px;
    display: flex; align-items: center; gap: 15px;
    z-index: 2;
}

.restaurante-logo {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 3px solid var(--king-gold);
    object-fit: cover;
    background: #fff;
}

/* Texto do Header com alta legibilidade */
.header-info {
    position: relative;
    z-index: 10;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
}

.header-info h1 {
    font-size: 1.6rem;
    color: var(--king-gold);
    font-weight: 800;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.restaurante-meta {
    font-size: 0.95rem;
    color: #ffffff !important; /* Força branco */
    font-weight: 600;
    margin-top: 5px;
    display: flex; flex-wrap: wrap; gap: 10px;
}

.restaurante-meta span {
    background-color: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 20px;
    display: flex; align-items: center;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.restaurante-meta span i { color: var(--king-gold); margin-right: 6px; }

.info-link {
    font-size: 0.85rem; color: var(--king-white);
    text-decoration: underline; opacity: 0.9; margin-top: 5px; display: inline-block;
}

/* Barra de Status */
.status-restaurante {
    background-color: var(--king-black);
    color: var(--king-gold);
    text-align: center; padding: 8px;
    font-weight: bold; font-size: 0.9rem;
    border-bottom: 1px solid #333;
}
.status-restaurante.fechado { background-color: var(--color-danger); color: white; }

/* =========================================
   3. ESTRUTURA GERAL (Layout)
   ========================================= */
.ifood-container {
    max-width: 1200px; margin: 25px auto; padding: 0 15px;
    display: flex; gap: 30px; align-items: flex-start;
}

.ifood-main { flex: 1; }

/* Menu Lateral (Desktop) */
.menu-lateral {
    width: 260px;
    background: var(--king-white);
    border-radius: var(--radius-app);
    padding: 20px;
    box-shadow: var(--shadow-card);
    position: sticky; top: 20px;
    border-top: 4px solid var(--king-gold);
}

.menu-lateral h3 {
    font-size: 1.1rem; margin-bottom: 15px; color: var(--king-black);
    border-bottom: 1px solid #eee; padding-bottom: 10px;
}

.menu-lateral ul { list-style: none; }
.menu-lateral ul li { margin-bottom: 5px; }
.menu-lateral ul li a {
    display: block; padding: 10px 15px; color: var(--king-dark);
    text-decoration: none; border-radius: 8px; transition: all 0.2s; font-weight: 500;
}
.menu-lateral ul li a:hover {
    background-color: #FFF8D6; color: #000; transform: translateX(5px);
}

/* =========================================
   4. COMPONENTES DE ITENS & CARDS
   ========================================= */
.categoria { margin-bottom: 40px; }
.categoria h2 {
    font-size: 1.4rem; margin-bottom: 20px; color: var(--king-black);
    display: flex; align-items: center;
}
.categoria h2::before {
    content: ''; display: inline-block; width: 6px; height: 24px;
    background-color: var(--king-gold); margin-right: 10px; border-radius: 4px;
}

.itens-list, .itens-grid, .categorias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.item, .cat-card {
    background: var(--king-white);
    border-radius: var(--radius-app);
    box-shadow: var(--shadow-card);
    display: flex; overflow: hidden; cursor: pointer;
    transition: transform 0.2s; border: 1px solid transparent;
}

.item:hover, .cat-card:hover {
    transform: translateY(-4px); border-color: var(--king-gold);
}

.item-image { width: 130px; height: 100%; min-height: 130px; }
.item-image img { width: 100%; height: 100%; object-fit: cover; }

.item-details {
    flex: 1; padding: 15px;
    display: flex; flex-direction: column; justify-content: space-between;
}

.item-details h3 { font-size: 1.1rem; margin: 0 0 5px; color: var(--king-black); }
.item-descricao { font-size: 0.85rem; color: #666; margin-bottom: 10px; }
.item-preco { color: var(--color-success); font-weight: 700; font-size: 1.1rem; }

/* =========================================
   5. INTERFACE DO CARRINHO
   ========================================= */
.ifood-carrinho {
    width: 300px; background: var(--king-white);
    border-radius: var(--radius-app); padding: 20px;
    box-shadow: var(--shadow-card); position: sticky; top: 20px;
    max-height: 80vh; overflow-y: auto;
}

.carrinho-header h2 {
    font-size: 1.2rem; color: var(--king-black);
    border-bottom: 2px solid var(--king-gray); padding-bottom: 10px; margin-bottom: 15px;
}

.carrinho-item { margin-bottom: 15px; padding-bottom: 10px; border-bottom: 1px solid #eee; }
.total { font-size: 1.2rem; font-weight: 700; margin: 20px 0; text-align: right; }

/* Botões Principais */
.enviar-pedido, .confirmar {
    background-color: var(--king-gold); color: #000;
    border: none; padding: 14px; width: 100%;
    border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 1rem;
    text-transform: uppercase; transition: background 0.3s;
    display: block; text-align: center; text-decoration: none;
}
.enviar-pedido:hover, .confirmar:hover { background-color: var(--king-gold-hover); }
.enviar-pedido:disabled { background-color: #ccc; cursor: not-allowed; }

/* =========================================
   6. MODAIS, FORMS & SWITCHES
   ========================================= */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); z-index: 2000;
    align-items: center; justify-content: center; backdrop-filter: blur(3px);
}

.modal-content {
    background-color: #fff; padding: 25px; border-radius: 16px;
    width: 90%; max-width: 500px; max-height: 85vh; overflow-y: auto;
    position: relative; border-top: 5px solid var(--king-gold);
}

.close { position: absolute; top: 15px; right: 15px; font-size: 1.8rem; cursor: pointer; }

/* Inputs */
input, textarea, select {
    width: 100%; padding: 12px; background: #f9f9f9;
    border: 1px solid #ddd; border-radius: 8px;
    font-size: 1rem; margin-top: 5px; margin-bottom: 15px;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--king-gold); outline: none; background: #fff;
}

/* SWITCH DOURADO (Botão de arrastar) */
.switch {
    position: relative; display: inline-block; width: 50px; height: 26px; flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc; transition: .4s; border-radius: 34px;
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px;
    left: 3px; bottom: 3px; background-color: white;
    transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--king-gold); }
input:checked + .slider:before { transform: translateX(24px); }

/* Linha de Opção com Switch (Adicionais) */
.item-option-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px; background: #f9f9f9; border: 1px solid #eee;
    border-radius: 8px; margin-bottom: 8px; cursor: pointer;
}
.option-price { font-weight: bold; color: var(--color-success); }

/* =========================================
   7. ADMINISTRAÇÃO (Painel)
   ========================================= */
.config-card {
    background: #fff; padding: 25px; border-radius: var(--radius-app);
    box-shadow: var(--shadow-card); margin-bottom: 25px;
}

.actions { display: flex; gap: 10px; margin-top: 15px; }
.edit-btn { background: var(--color-info); color: white; padding: 8px 15px; border-radius: 6px; text-decoration: none; cursor: pointer; border: none; }
.delete-btn { background: var(--color-danger); color: white; padding: 8px 15px; border-radius: 6px; cursor: pointer; border: none; }
.print-btn { background: var(--color-success); color: white; padding: 8px 15px; border-radius: 6px; cursor: pointer; border: none; }

.filters { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; }

/* Status Badges */
.status-badge { padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; color: white; }
.status-concluido { background-color: var(--color-success); }
.status-cancelado { background-color: var(--color-danger); }
.status-iniciado { background-color: var(--color-info); }

/* Lista Financeiro */
.transaction-item {
    display: flex; justify-content: space-between; padding: 15px;
    border-bottom: 1px solid #eee;
}
.val-plus { color: var(--color-success); }
.val-minus { color: var(--color-danger); text-decoration: line-through; }

/* =========================================
   8. MOBILE UTILS (Carrinho Flutuante)
   ========================================= */
#mobile-cart-btn {
    display: none; position: fixed; bottom: 20px; right: 20px;
    background-color: var(--king-black); color: var(--king-gold);
    border: 2px solid var(--king-gold); width: 65px; height: 65px;
    border-radius: 50%; font-size: 1.5rem; cursor: pointer;
    box-shadow: var(--shadow-float); z-index: 1000;
    align-items: center; justify-content: center;
}

/* Bolinha do Contador (Corrigida: Dourada e Centralizada) */
#mobile-cart-btn span {
    position: absolute; top: -5px; right: -5px;
    background-color: var(--king-gold); color: var(--king-black);
    border: 2px solid var(--king-black); border-radius: 50%;
    width: 24px; height: 24px; font-size: 0.85rem; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1;
}

#scroll-top {
    position: fixed; bottom: 95px; right: 30px;
    background-color: var(--king-white); color: var(--king-black);
    border: 1px solid #ccc; width: 45px; height: 45px; border-radius: 50%;
    display: none; cursor: pointer; z-index: 999;
}

/* =========================================
   9. RESPONSIVIDADE (Mobile)
   ========================================= */
@media (max-width: 900px) {
    .ifood-container { flex-direction: column; margin: 10px auto; padding: 0 10px; gap: 15px; }
    
    /* Esconde menu e carrinho lateral no mobile */
    .menu-lateral:not(.admin-menu), .ifood-carrinho { display: none; }
    
    /* Header Menor */
    .cover-image { height: 160px; }
    .restaurante-logo { width: 70px; height: 70px; }
    .header-info h1 { font-size: 1.3rem; }
    
    /* Layout Cards em Lista */
    .itens-list, .itens-grid, .categorias-grid { grid-template-columns: 1fr; }
    .item { flex-direction: row; height: auto; align-items: stretch; }
    .item-image { width: 110px; min-height: 110px; }
    .item-details { padding: 12px; }
    
    /* Exibe botão flutuante */
    #mobile-cart-btn { display: flex; }
    
    /* Menu Admin Mobile (Horizontal) */
    .menu-lateral { 
        display: block !important; width: 100% !important; 
        overflow-x: auto; white-space: nowrap; padding: 10px;
        border-top: none; border-bottom: 2px solid var(--king-gold);
    }
    .menu-lateral ul { display: flex; gap: 10px; }
    .menu-lateral ul li { margin: 0; flex: 0 0 auto; }
    .menu-lateral ul li a { 
        background: #f4f4f9; padding: 8px 15px; border-radius: 20px; border: 1px solid #ddd; 
    }
    
    .filters { flex-direction: column; }
    .modal-content { width: 95%; max-height: 90vh; padding: 20px; }
}