/**
 * PEDIDO MANAGER - Estilos Mobile-First
 * Modais de resumo, feedback e componentes
 */

/* ========================================
   1. MODAL DE RESUMO DO PEDIDO
   ======================================== */

.modal-resumo-pedido {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    pointer-events: none;
}

.modal-resumo-pedido.active {
    display: block;
    pointer-events: all;
}

/* Overlay escuro */
.modal-resumo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    animation: fadeIn 0.3s ease;
}

/* Conteúdo do modal - Bottom Sheet no mobile */
.modal-resumo-content {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Header do modal */
.modal-resumo-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-resumo-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1e7e7e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-fechar-resumo {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.btn-fechar-resumo:hover {
    background: #f0f0f0;
    color: #333;
}

/* Body do modal - área scrollável */
.modal-resumo-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Lista de itens */
.lista-itens-pedido {
    margin-bottom: 20px;
}

.item-pedido {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 10px;
    position: relative;
}

.item-info {
    flex: 1;
    min-width: 0;
}

.item-nome {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 5px;
}

.item-detalhes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.item-marca,
.item-tamanho,
.item-qtd {
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.item-preco {
    font-weight: 700;
    font-size: 16px;
    color: #1e7e7e;
    white-space: nowrap;
}

.btn-remover-item {
    background: #ff4444;
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-remover-item:hover {
    background: #cc0000;
    transform: scale(1.1);
}

/* Total do pedido */
.total-pedido {
    background: #1e7e7e;
    color: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 18px;
}

.total-pedido strong {
    font-size: 24px;
    font-weight: 700;
}

/* Aviso de pré-venda */
.aviso-pre-venda {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.aviso-pre-venda i {
    color: #ff9800;
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.aviso-pre-venda p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #856404;
}

.aviso-pre-venda strong {
    color: #333;
}

/* Ações do resumo */
.acoes-resumo {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-block {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

/* Pedido vazio */
.pedido-vazio {
    text-align: center;
    padding: 40px 20px;
}

.pedido-vazio i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
    display: block;
}

.pedido-vazio p {
    font-size: 16px;
    color: #999;
    margin-bottom: 20px;
}

/* ========================================
   2. FEEDBACK TOAST (Notificações)
   ======================================== */

.feedback-toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 11000;
    font-weight: 600;
    font-size: 15px;
    max-width: 90%;
    transition: bottom 0.3s ease;
}

.feedback-toast.show {
    bottom: 30px;
}

.feedback-toast.feedback-success {
    border: 2px solid #4caf50;
}

.feedback-toast.feedback-success i {
    color: #4caf50;
    font-size: 20px;
}

.feedback-toast.feedback-error {
    border: 2px solid #f44336;
}

.feedback-toast.feedback-error i {
    color: #f44336;
    font-size: 20px;
}

/* ========================================
   3. BADGE DO CARRINHO (Header)
   ======================================== */

.carrinho-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: #1e7e7e;
    color: white;
    border-radius: 50%;
    margin-right: 15px;
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
}

.carrinho-link:hover {
    background: #156666;
    transform: scale(1.05);
}

.carrinho-link i {
    font-size: 20px;
}

.carrinho-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: pulse 0.6s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* ========================================
   4. AJUSTES NOS MODAIS DE PRODUTO
   ======================================== */

/* Hierarquia de botões no modal */
.modal-acoes-produto {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

/* CTA Principal */
.btn-cta-principal {
    background: #1e7e7e;
    color: white;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-cta-principal:hover {
    background: #156666;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 126, 126, 0.3);
}

/* CTA Secundário */
.btn-cta-secundario {
    background: #9acd32;
    color: white;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-cta-secundario:hover {
    background: #8bb82b;
    transform: translateY(-1px);
}

/* Ação Terciária */
.btn-terciario {
    background: transparent;
    color: #1e7e7e;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border: 2px solid #1e7e7e;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-terciario:hover {
    background: #f0f8f8;
}

/* ========================================
   5. RESPONSIVO - Desktop
   ======================================== */

@media (min-width: 768px) {
    /* Modal vira centralizado no desktop */
    .modal-resumo-content {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        right: auto;
        transform: translate(-50%, -50%);
        width: 90%;
        max-width: 600px;
        max-height: 85vh;
        border-radius: 20px;
        animation: zoomIn 0.3s ease;
    }
    
    @keyframes zoomIn {
        from {
            opacity: 0;
            transform: translate(-50%, -50%) scale(0.9);
        }
        to {
            opacity: 1;
            transform: translate(-50%, -50%) scale(1);
        }
    }
    
    /* Botões lado a lado no desktop */
    .acoes-resumo {
        flex-direction: row;
    }
    
    .btn-block {
        flex: 1;
    }
    
    /* Feedback mais centralizado */
    .feedback-toast {
        max-width: 500px;
    }
}

/* ========================================
   6. AJUSTES ESPECÍFICOS MOBILE
   ======================================== */

@media (max-width: 767px) {
    /* Garante que modal ocupa toda largura */
    .modal-resumo-content {
        border-radius: 20px 20px 0 0;
        max-height: 85vh;
    }
    
    /* Header mais compacto */
    .modal-resumo-header h2 {
        font-size: 18px;
    }
    
    /* Itens mais compactos */
    .item-pedido {
        padding: 12px;
    }
    
    .item-nome {
        font-size: 14px;
    }
    
    .item-preco {
        font-size: 14px;
    }
    
    /* Total menor */
    .total-pedido {
        font-size: 16px;
    }
    
    .total-pedido strong {
        font-size: 20px;
    }
    
    /* Botões com altura fixa */
    .btn-block {
        padding: 14px;
        font-size: 15px;
    }
}

/* ========================================
   7. ACESSIBILIDADE
   ======================================== */

/* Foco visível */
.btn-fechar-resumo:focus,
.btn-remover-item:focus,
.btn-block:focus,
.btn-cta-principal:focus,
.btn-cta-secundario:focus,
.btn-terciario:focus {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .modal-resumo-content {
        border: 3px solid #000;
    }
    
    .btn-cta-principal,
    .btn-cta-secundario {
        border: 2px solid #000;
    }
}

/* Redução de movimento */
@media (prefers-reduced-motion: reduce) {
    .modal-resumo-overlay,
    .modal-resumo-content,
    .feedback-toast {
        animation: none !important;
        transition: none !important;
    }
}

/* ========================================
   7. FAB CARRINHO FLUTUANTE (FIX 07)
   ======================================== */

.carrinho-fab {
    position: fixed !important;
    bottom: 90px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #1e7e7e;
    color: #fff;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 22px;
    z-index: 9900;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,.25);
    transition: transform .2s, box-shadow .2s;
}

.carrinho-fab:not(.oculto) {
    display: flex !important;
}

.carrinho-fab.oculto {
    display: none !important;
}

.carrinho-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,.35);
}

.carrinho-fab .carrinho-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
