/**
 * ✅ CEAPP: Estilos da página Default.aspx
 * 
 * Funcionalidade: Estilos específicos da página principal (home)
 * - Grid responsivo de produtos
 * - Carrinho fixo lateral (desktop)
 * - Hero section
 * - Cards de produtos
 * 
 * Integração CEAPP:
 * - Estilos separados do HTML para melhor organização
 * - Facilita manutenção e reutilização
 */

* {
    box-sizing: border-box;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* Header será controlado pelo layout.css */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
    flex-wrap: wrap;
}

.header-logo img {
    max-width: 200px;
    width: 100%;
    height: auto;
    display: block;
}

.header-user-name {
    color: #1a4d2e;
    font-weight: 600;
    font-size: 14px;
    text-align: right;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.header-actions::-webkit-scrollbar {
    display: none;
}

.header-actions a {
    color: #1a4d2e;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.header-actions a:hover {
    background: #1a4d2e;
    color: #fff;
}

/* Ícone do carrinho com badge */
.carrinho-header {
    position: relative;
    display: inline-block;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.carrinho-header:hover {
    background: #1a4d2e;
}

.carrinho-header:hover i {
    color: #fff;
}

.carrinho-header i {
    font-size: 20px;
    color: #1a4d2e;
    transition: color 0.3s;
}

.carrinho-header.com-itens i {
    color: #dc3545;
}

.carrinho-header.com-itens:hover i {
    color: #fff;
}

.carrinho-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 4px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.carrinho-badge.oculto {
    display: none;
}

/* Ajustar badge para números maiores */
.carrinho-badge:not(.oculto) {
    min-width: 18px;
    padding: 0 4px;
}

/* Estilos específicos do carrinho - responsivos */
@media (max-width: 575.98px) {
    .carrinho-header i {
        font-size: 18px;
        display: inline-block !important;
    }
    .carrinho-badge {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        top: 1px;
        right: 1px;
    }
}

/* Estilos específicos da página Default */
.container-main {
    background: transparent;
    overflow: visible; /* Permitir que o carrossel saia dos limites */
}

.header-spacer {
    height: auto;
    min-height: 60px;
    width: 100%;
}

@media (min-width: 992px) {
    .header-spacer {
        min-height: 80px;
    }
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #1a4d2e 0%, #2d5a3d 100%);
    color: white;
    padding: 40px 16px;
    text-align: center;
    margin-bottom: 30px;
}

.hero-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 0;
    line-height: 1.5;
}

/* Seção de Produtos - Grid */
.produtos-section {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

@media (min-width: 992px) {
    .produtos-wrapper {
        display: flex;
        flex-direction: row;
        gap: 24px;
        height: 100vh;
        min-height: 0;
    }
    .produtos-section {
        height: 100vh;
        overflow-y: auto;
    }
}

@media (max-width: 991px) {
    .produtos-wrapper {
        display: flex;
        flex-direction: column;
        gap: 24px;
        height: auto;
    }
}

.section-title {
    display: none;
}

/* Grid de Produtos */
.produtos-grid-container {
    width: 100%;
    padding: 20px;
    background: #f8f9fa;
}

.produtos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    padding: 0;
}

@media (min-width: 576px) {
    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 768px) {
    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (min-width: 992px) {
    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (min-width: 1200px) {
    .produtos-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

.produto-card-carrossel {
    background: white;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    border: none; /* Sem bordas */
    position: relative;
    overflow: hidden;
    height: 100%;
}

.produto-card-carrossel:hover {
    box-shadow: 0 12px 30px rgba(0,0,0,0.25);
    transform: translateY(-5px);
}

.produto-imagem-carrossel-wrapper {
    position: relative;
    cursor: pointer;
    margin: 0;
    width: 100%;
    padding-top: 80%; /* Imagem ocupa 80% do card */
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.produto-imagem-carrossel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease, filter 0.3s ease;
}

.produto-imagem-carrossel-wrapper:hover .produto-imagem-carrossel {
    transform: scale(1.1);
    filter: brightness(1.05);
}

.produto-info-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 12px;
    gap: 8px;
}

.produto-preco-carrossel {
    font-size: 18px;
    font-weight: 700;
    color: #28a745;
    flex: 1;
    text-align: left;
}

.produto-preco-carrossel::before {
    content: 'R$';
    font-size: 11px;
    font-weight: 600;
    margin-right: 3px;
    vertical-align: super;
    opacity: 0.8;
}

.btn-reservar-produto {
    padding: 8px 12px;
    background: linear-gradient(135deg, #1a4d2e 0%, #2d7a4f 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 36px;
    font-size: 0; /* Esconder texto */
}

.btn-reservar-produto i {
    font-size: 16px;
}

.btn-reservar-produto:hover {
    background: linear-gradient(135deg, #2d7a4f 0%, #1a4d2e 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 77, 46, 0.4);
}

.produtos-loading,
.produtos-fim {
    text-align: center;
    padding: 40px 20px;
    grid-column: 1 / -1;
}

/* Animação da mãozinha clicando */
.maozinha-clique {
    position: absolute;
    z-index: 1000;
}

/* ✅ CEAPP: Garantir que TODOS os modais sejam interativos */
.modal {
    z-index: 1055 !important;
    pointer-events: auto !important;
}

.modal.show {
    z-index: 1055 !important;
    pointer-events: auto !important;
}

.modal .modal-dialog {
    z-index: 1056 !important;
    pointer-events: auto !important;
}

.modal .modal-content {
    pointer-events: auto !important;
}

.modal .modal-body {
    pointer-events: auto !important;
    overflow-y: auto;
}

.modal .modal-header,
.modal .modal-footer {
    pointer-events: auto !important;
}

/* Garantir que o backdrop não bloqueie a interação com o modal */
.modal-backdrop {
    z-index: 1054 !important;
}

/* Garantir que elementos dentro dos modais sejam clicáveis */
.modal .modal-content * {
    pointer-events: auto !important;
}

.maozinha-clique.visivel {
    opacity: 1;
}

.maozinha-clique i {
    font-size: 40px;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    animation: cliqueAnimacao 1.5s ease-in-out infinite;
}

@keyframes cliqueAnimacao {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(10px) scale(0.9);
    }
}

.btn-reservar-produto {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, #1a4d2e 0%, #2d5a3d 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: auto;
}

.btn-reservar-produto:hover {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a4d2e 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(26, 77, 46, 0.4);
}

.btn-reservar-produto:active {
    transform: translateY(0);
}

.btn-reservar-produto i {
    font-size: 14px;
}

/* Desktop */
@media (min-width: 992px) {
    .container-main {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    .hero-section {
        border-radius: 16px;
        margin: 0 0 40px 0;
        padding: 60px 40px;
    }
    .hero-title {
        font-size: 36px;
    }
    .hero-subtitle {
        font-size: 18px;
    }
    .produtos-wrapper {
        display: flex;
        gap: 20px;
        align-items: stretch;
        height: calc(100vh - var(--header-height) - 200px);
        min-height: 600px;
    }
    .produtos-section {
        padding: 0;
        flex: 1;
        min-width: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    .section-title {
        display: none;
    }
    .produtos-carrossel {
        height: 100%;
        min-height: 0;
    }
    .carrinho-fixo {
        position: sticky;
        top: 90px;
        background: white;
        border-radius: 12px;
        padding: 20px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        width: 320px;
        flex-shrink: 0;
        transition: all 0.3s ease;
    }
    .produtos-carrossel {
        margin: 0 -16px; /* Margem negativa em mobile para compensar padding (16px) */
        padding: 20px 16px; /* Padding apenas nas laterais internas */
        width: calc(100% + 32px); /* Largura total incluindo margens negativas (2 * 16px) */
        border-radius: 0; /* Sem bordas arredondadas */
    }
    .maozinha-clique i {
        font-size: 50px;
    }
    .carrossel-container {
        flex-wrap: wrap;
        gap: 16px;
    }
    .produto-card-carrossel {
        flex: 0 0 calc(25% - 12px);
        max-width: 200px;
    }
    .info-section {
        margin: 30px 0;
        padding: 30px !important;
    }
}

/* Estilos do carrinho fixo */
.carrinho-fixo h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

#carrinhoContainer {
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    margin-bottom: 16px;
}

#carrinhoContainer .text-muted {
    text-align: center;
    padding: 20px;
}

.total-carrinho {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
    border-top: 2px solid #1a4d2e;
}

.total-carrinho > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.total-carrinho > div:first-child > span:first-child {
    font-size: 16px;
    color: #666;
}

.total-carrinho > div:first-child > span:last-child {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.total-carrinho > div:last-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid #dee2e6;
}

.total-carrinho > div:last-child > span:first-child {
    font-size: 18px;
    font-weight: 700;
    color: #1a4d2e;
}

.total-carrinho > div:last-child > span:last-child {
    font-size: 22px;
    font-weight: 700;
    color: #1a4d2e;
}

.btn-reservar {
    background: linear-gradient(135deg, #1a4d2e 0%, #2d5a3d 100%);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    width: 100%;
    margin-top: 16px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(26, 77, 46, 0.3);
}

.btn-reservar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 77, 46, 0.4);
}

/* Elementos inicialmente ocultos (controlados por JavaScript) */
.oculto,
#headerSpacer,
#produtosLoading,
#produtosFim,
#totalContainer,
#radioGroupDatas,
#defaultPageConfig {
    display: none;
}

/* Elementos que podem ser mostrados via JavaScript */
#headerSpacer.mostrar,
#produtosLoading.mostrar,
#produtosFim.mostrar,
#totalContainer.mostrar,
#radioGroupDatas.mostrar,
#defaultPageConfig.mostrar {
    display: block;
}

/* Mensagens de produtos */
.produtos-mensagem-vazia {
    margin: 20px;
    grid-column: 1 / -1;
}

.produtos-mensagem-erro {
    margin: 20px;
}

