/* Importação de fontes (opcional, mas recomendado para um design moderno) */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');

/* Reset básico para garantir consistência entre navegadores */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background-color: #f4f4f4; /* Fundo que aparecerá nas laterais em telas grandes */
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: #fff; /* Fundo do "celular" */
    color: #333;
    line-height: 1.6;
    
    /* Centraliza o body e define largura máxima para simular um celular */
    max-width: 480px; /* Largura máxima para simular um dispositivo móvel */
    margin: 0 auto; /* Centraliza o body na tela do PC */
    min-height: 100vh; /* Garante que o body ocupe a altura total da viewport */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); /* Sombra para destacar o "celular" */
    position: relative; /* Para posicionamento de elementos internos */
    padding-top: 70px; /* Espaço para o cabeçalho fixo */
}

/* --- Topo Fixo --- */
.header-fixed {
    background-color: #8B0000; /* Vermelho escuro do topo */
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between; /* Espaça os itens: menu, título, login */
    align-items: center;
    position: fixed; /* Fixa o topo na parte superior da tela */
    width: 100%; /* Ocupa 100% da largura do body (que é 480px no PC) */
    max-width: 480px; /* Garante que não ultrapasse a largura do body */
    top: 0;
    left: 50%; /* Centraliza o cabeçalho com base na metade da tela */
    transform: translateX(-50%); /* Ajusta para centralizar perfeitamente */
    z-index: 1000; /* Garante que o topo fique acima de outros elementos */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Sombra para dar profundidade */
}

/* CORREÇÃO AQUI: Remove background-color e padding para ícones do cabeçalho */
.menu-icon, .login-icon {
    font-size: 24px;
    cursor: pointer;
    padding: 0; /* REMOVIDO O PADDING */
    background-color: transparent; /* REMOVIDO O BACKGROUND ESCURO */
    border-radius: 0; /* REMOVIDO O BORDER-RADIUS, se quiser redondo no futuro pode usar 50% aqui */
}

/* Garante que a cor do ícone seja branca */
.login-icon i, .menu-icon i {
    color: white !important; /* Força a cor branca para o ícone */
}
/* Se o ícone estiver dentro de um link, garante que o link também seja branco */
.login-icon a, .menu-icon a {
    color: white !important;
}

.app-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: #fff;
    text-align: center;
    flex-grow: 1; /* Ocupa o espaço central disponível */
}

/* --- Menu Hamburguer Deslizante (Sidebar) --- */
.sidebar {
    height: 100%;
    width: 0; /* Inicialmente oculto */
    position: fixed;
    z-index: 1001; /* Acima do topo */
    top: 0;
    left: 50%; /* Centraliza a sidebar com base na metade da tela */
    transform: translateX(-50%); /* Ajusta para centralizar perfeitamente */
    background-color: #600000; /* Vermelho BEM escuro para o corpo da sidebar */
    overflow-x: hidden;
    transition: 0.5s; /* Animação suave de deslizamento */
    padding-top: 60px; /* Espaço para o topo fixo */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.3); /* Sombra para a sidebar */
    max-width: 480px; /* Garante que a sidebar não ultrapasse a largura do body */
}

.sidebar.active {
    width: 80%; /* Abre até 80% da largura do body */
}

.sidebar .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    position: absolute;
    top: 0;
    width: 100%;
    background-color: #400000; /* Vermelho AINDA MAIS ESCURO para o cabeçalho interno da sidebar */
}

.sidebar .sidebar-header h3 {
    color: #fff;
    margin: 0;
}

.sidebar .close-sidebar {
    color: #fff;
    font-size: 30px;
    cursor: pointer;
    line-height: 1;
}

.sidebar ul {
    list-style: none;
    padding: 0;
    margin-top: 20px; /* Espaço abaixo do cabeçalho */
}

.sidebar ul li a {
    padding: 15px 25px;
    text-decoration: none;
    font-size: 18px;
    color: #fff;
    display: block;
    transition: 0.3s;
}

.sidebar ul li a:hover {
    background-color: #8B0000; /* Vermelho escuro ao passar o mouse */
}

/* Adicionado para espaçar o ícone do texto no menu */
.sidebar ul li a i {
    margin-right: 10px; /* Espaço entre o ícone e o texto */
    width: 20px; /* Garante que os ícones tenham uma largura consistente */
    text-align: center; /* Centraliza o ícone se o width for maior que o ícone */
}

/* Overlay para fechar o menu */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparente */
    z-index: 999; /* Abaixo da sidebar, acima de outros conteúdos */
    display: none; /* Inicialmente oculto */
    cursor: pointer;
}

/* --- Conteúdo Principal da Página de Delivery --- */
.delivery-main-content {
    padding: 20px 15px; /* Espaçamento interno para o conteúdo */
    background-color: #f8f8f8; /* Fundo levemente diferente para o conteúdo */
    min-height: calc(100vh - 70px - 60px); /* Altura mínima (viewport - header - footer) */
}

/* --- Barra de Pesquisa --- */
.search-bar-section {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.search-input-container {
    position: relative;
    width: 100%;
}

#search-restaurant {
    width: calc(100% - 40px); /* Ajusta para o ícone */
    padding: 12px 15px 12px 40px; /* Padding para o ícone */
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s;
}

#search-restaurant:focus {
    border-color: #195898;
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 1.1em;
}

/* --- Seção de Categorias de Delivery (Slider) --- */
.delivery-categories-slider {
    background-color: #fff;
    padding: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
    overflow: hidden;
}

.delivery-categories-slider h2 {
    color: #195898;
    margin-bottom: 20px;
    font-size: 1.8em;
    padding: 0 15px;
}

.delivery-categories-container {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 15px;
    padding: 10px 15px 20px 15px; /* Padding para scroll */
    scroll-snap-type: x mandatory;
}

.delivery-categories-container::-webkit-scrollbar {
    height: 8px;
}

.delivery-categories-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.delivery-categories-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.delivery-category-item {
    flex: 0 0 auto;
    width: 90px;
    height: 90px;
    background-color: #f0f0f0;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, background-color 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    scroll-snap-align: start;
    padding: 5px;
}

.delivery-category-item:hover {
    transform: translateY(-3px);
    background-color: #e0f2f7;
}

.delivery-category-item i {
    font-size: 2.5em;
    color: #195898;
    margin-bottom: 5px;
}

.delivery-category-item span {
    font-weight: bold;
    color: #333;
    font-size: 0.75em;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

/* --- Seções de Restaurantes (Destaque e Todos) --- */
.featured-restaurants-section,
.all-restaurants-section {
    background-color: #fff;
    padding: 20px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    text-align: center;
}

.featured-restaurants-section h2,
.all-restaurants-section h2 {
    color: #195898;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.restaurants-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* 2 colunas em mobile, mais em desktop */
    gap: 15px;
    justify-content: center;
}

.restaurant-card {
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center; /* Centraliza o conteúdo do card */
    transition: transform 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centraliza verticalmente */
    padding: 15px; /* Padding interno do card */
}

.restaurant-card:hover {
    transform: translateY(-5px);
}

.restaurant-card-logo { /* Estilo para o logo no topo do card */
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #195898;
    margin-bottom: 10px;
}

.restaurant-card-name { /* Estilo para o nome da empresa */
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%; /* Garante que o nome ocupe a largura do card */
}

.restaurant-card-button { /* Estilo para o botão "Ir para a Loja" */
    display: block;
    width: calc(100% - 20px); /* Ajusta a largura para ter um padding nas laterais */
    padding: 8px 10px;
    background-color: #8B0000; /* Vermelho */
    color: #fff;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 0.9em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
    margin-top: auto; /* Empurra o botão para o final do card */
}

.restaurant-card-button:hover {
    background-color: #700000; /* Vermelho mais escuro ao hover */
    transform: translateY(-1px);
}


/* --- Modal de Detalhes do Restaurante --- */
/* O estilo base .modal e .modal-content já está no style.css principal */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: fadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content .close-button {
    color: #aaa;
    float: right;
    font-size: 35px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    z-index: 2001;
}

.modal-content .close-button:hover,
.modal-content .close-button:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.modal-body {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
}

.restaurant-modal-body {
    display: block; /* Para empilhar elementos */
    text-align: left;
}

.restaurant-modal-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    padding-top: 50px; /* Espaço para o logo sobreposto */
}

.restaurant-modal-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #195898;
    position: absolute;
    top: -50px; /* Puxa para cima para sobrepor a borda do modal */
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    background-color: #fff;
}

.restaurant-modal-header h3 {
    font-size: 2em;
    color: #195898;
    margin-top: 10px; /* Ajusta margem após o logo */
    margin-bottom: 5px;
}

.restaurant-modal-category {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 10px;
}

.restaurant-modal-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1em;
    margin-bottom: 20px;
}

.restaurant-modal-info span {
    display: flex;
    align-items: center;
    gap: 5px;
}
.restaurant-modal-info .restaurant-modal-rating {
    color: #FFD700;
}
.restaurant-modal-info .restaurant-modal-delivery-fee {
    color: #8B0000;
    font-weight: bold;
}


.restaurant-modal-description {
    font-size: 1em;
    color: #444;
    line-height: 1.7;
    text-align: justify;
    margin-bottom: 20px;
    padding: 0 10px;
}

.restaurant-modal-menu {
    margin-bottom: 20px;
    padding: 0 10px;
}

.restaurant-modal-menu h4 {
    font-size: 1.4em;
    color: #195898;
    margin-bottom: 10px;
    text-align: center;
}

.restaurant-modal-menu ul {
    list-style: none;
    padding: 0;
}

.restaurant-modal-menu li {
    background-color: #f0f0f0;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    color: #333;
}

.restaurant-modal-menu li span:last-child {
    font-weight: bold;
    color: #8B0000;
}

.restaurant-modal-button {
    display: block;
    width: fit-content;
    margin: 20px auto 0 auto;
    padding: 15px 30px;
    background-color: #195898;
    color: #fff;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    font-size: 1.1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.restaurant-modal-button:hover {
    background-color: #144a7a;
    transform: translateY(-2px);
}


/* --- Rodapé --- */
.app-footer {
    background-color: #8B0000; /* Mesma cor do topo */
    color: #fff;
    padding: 20px;
    text-align: center;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.2); /* Sombra superior para destacar */
    z-index: 999; /* Garante que fique acima de outros conteúdos */
    position: relative; /* Para garantir que o z-index funcione corretamente */
    width: 100%; /* Ocupa 100% da largura do body */
    max-width: 480px; /* Garante que não ultrapasse a largura do body */
    left: 50%; /* Centraliza o rodapé com base na metade da tela */
    transform: translateX(-50%); /* Ajusta para centralizar perfeitamente */
}

.footer-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.social-links {
    margin-bottom: 10px;
}

.social-links a {
    color: #fff;
    font-size: 1.5em;
    margin: 0 10px;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.social-links a:hover {
    opacity: 1;
}

.app-footer p {
    margin: 0;
    font-size: 0.9em;
}


/* --- Media Queries para Responsividade --- */
@media (max-width: 768px) {
    body {
        max-width: 100%; /* Em telas menores, o body ocupa 100% da largura */
        box-shadow: none; /* Remove a sombra em telas menores */
    }

    .header-fixed, .app-footer {
        max-width: 100%; /* Ocupa 100% da largura em telas menores */
        left: 0;
        transform: translateX(0);
    }

    .sidebar {
        max-width: 100%; /* Ocupa 100% da largura em telas menores */
        left: 0;
        transform: translateX(0);
    }

    .header-fixed {
        padding: 10px 15px;
    }

    .app-title {
        font-size: 24px;
    }

    .sidebar.active {
        width: 70%;
    }

    .delivery-main-content {
        padding: 15px 10px;
    }

    .search-bar-section {
        padding: 10px;
    }
    #search-restaurant {
        padding: 10px 10px 10px 35px;
        font-size: 0.95em;
    }
    .search-icon {
        left: 10px;
        font-size: 1em;
    }

    .delivery-categories-slider h2,
    .featured-restaurants-section h2,
    .all-restaurants-section h2 {
        font-size: 1.6em;
        padding: 0 10px;
    }

    .delivery-categories-container {
        padding: 10px 10px 15px 10px;
        gap: 10px;
    }
    .delivery-category-item {
        width: 80px;
        height: 80px;
    }
    .delivery-category-item i {
        font-size: 2.2em;
    }
    .delivery-category-item span {
        font-size: 0.7em;
    }

    .restaurants-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    .restaurant-card { /* Ajuste para o card em telas menores */
        padding: 10px;
    }
    .restaurant-card-logo {
        width: 70px;
        height: 70px;
    }
    .restaurant-card-name {
        font-size: 1em;
    }
    .restaurant-card-button {
        padding: 6px 8px;
        font-size: 0.85em;
    }

    /* Modal de Detalhes do Restaurante */
    .restaurant-modal-header h3 {
        font-size: 1.8em;
    }
    .restaurant-modal-category {
        font-size: 1em;
    }
    .restaurant-modal-info {
        font-size: 0.9em;
        gap: 10px;
    }
    .restaurant-modal-description,
    .restaurant-modal-menu li {
        font-size: 0.9em;
    }
    .restaurant-modal-button {
        padding: 12px 25px;
        font-size: 1em;
    }
}

@media (max-width: 480px) {
    .header-fixed {
        padding: 8px 10px;
    }

    .app-title {
        font-size: 20px;
    }

    .menu-icon, .login-icon {
        font-size: 20px;
    }

    .sidebar.active {
        width: 85%;
    }

    .delivery-main-content {
        padding: 10px 8px;
    }

    .search-bar-section {
        padding: 8px;
    }
    #search-restaurant {
        padding: 8px 8px 8px 30px;
        font-size: 0.9em;
    }
    .search-icon {
        left: 8px;
        font-size: 0.9em;
    }

    .delivery-categories-slider h2,
    .featured-restaurants-section h2,
    .all-restaurants-section h2 {
        font-size: 1.4em;
        padding: 0 8px;
    }

    .delivery-categories-container {
        padding: 8px 8px 10px 8px;
        gap: 8px;
    }
    .delivery-category-item {
        width: 70px;
        height: 70px;
    }
    .delivery-category-item i {
        font-size: 2em;
    }
    .delivery-category-item span {
        font-size: 0.65em;
    }

    .restaurants-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
        gap: 10px;
    }
    .restaurant-card { /* Ajuste para o card em telas muito pequenas */
        padding: 8px;
    }
    .restaurant-card-logo {
        width: 60px;
        height: 60px;
    }
    .restaurant-card-name {
        font-size: 0.9em;
    }
    .restaurant-card-button {
        padding: 5px 8px;
        font-size: 0.8em;
    }

    /* Modal de Detalhes do Restaurante */
    .restaurant-modal-logo {
        width: 80px;
        height: 80px;
        top: -40px;
    }
    .restaurant-modal-header {
        padding-top: 40px;
    }
    .restaurant-modal-header h3 {
        font-size: 1.5em;
    }
    .restaurant-modal-category {
        font-size: 0.9em;
    }
    .restaurant-modal-info {
        font-size: 0.8em;
        gap: 8px;
    }
    .restaurant-modal-description,
    .restaurant-modal-menu li {
        font-size: 0.85em;
    }
    .restaurant-modal-menu h4 {
        font-size: 1.2em;
    }
    .restaurant-modal-button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}