/* Estilos do Carrinho */

/* Botão do Carrinho Flutuante */
.cart-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    z-index: 999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cart-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.cart-button .cart-icon {
    font-size: 28px;
    color: white;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* Modal do Carrinho */
.cart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cart-modal.active {
    display: flex;
}

.cart-content {
    background: white;
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-header {
    padding: 20px;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-header h2 {
    margin: 0;
    font-size: 20px;
}

.cart-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.cart-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.cart-empty-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 15px;
    display: flex;
    gap: 15px;
    position: relative;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    font-size: 14px;
}

.cart-item-price {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.cart-item-opcionais {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.cart-item-observacao {
    font-size: 12px;
    color: #888;
    font-style: italic;
    margin-bottom: 10px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
}

.cart-item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.cart-item-remove:hover {
    transform: scale(1.1);
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    background: white;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.cart-total-label {
    font-weight: 600;
    color: #666;
}

.cart-total-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
}

.cart-actions {
    display: flex;
    gap: 10px;
}

.btn-continue {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-continue:hover {
    background: #f8f9fa;
}

.btn-checkout {
    flex: 2;
    padding: 12px;
    border: none;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-checkout:hover {
    background: #e55a2b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

/* Modal de Opcionais */
.opcionais-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.opcionais-section h4 {
    margin-bottom: 15px;
    color: #333;
    font-size: 16px;
}

.opcional-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.opcional-item:hover {
    background: #e9ecef;
}

.opcional-item.selected {
    background: #fff5f2;
    border: 2px solid var(--primary-color);
}

.opcional-item.obrigatorio {
    border-left: 3px solid #e67e22;
}

.opcional-item.opcional-erro {
    border: 2px solid #dc3545;
    background: #fff5f5;
    animation: shakeItem 0.4s ease;
}

/* ===== Estilos de Grupo de Complementos ===== */
.grupo-section {
    margin-bottom: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.grupo-section.grupo-erro {
    border: 2px solid #dc3545;
    animation: shakeItem 0.4s ease;
}

.grupo-section.grupo-erro .grupo-header {
    background: #fff0f0;
}

.grupo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-wrap: wrap;
}

.grupo-header.grupo-obrigatorio {
    background: #fff8f0;
    border-bottom-color: #fdd;
}

.grupo-nome {
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
}

.grupo-regras-info {
    font-size: 0.78rem;
    color: #888;
    margin-left: auto;
}

.grupo-section .opcional-item {
    border-radius: 0;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    margin: 0;
}

.grupo-section .opcional-item:last-child {
    border-bottom: none;
}

.grupo-section .opcional-item.selected {
    border: none;
    border-bottom: 1px solid #f0f0f0;
    background: #f0fff0;
}

@keyframes shakeItem {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.badge-obrigatorio {
    display: inline-block;
    background: #e67e22;
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.opcional-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.opcional-image {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.opcional-details {
    flex: 1;
}

.opcional-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.opcional-price {
    font-size: 14px;
    color: var(--primary-color);
}

.opcional-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
}

.opcional-quantidade-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.opcional-quantidade {
    width: 50px;
    height: 32px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
}

.btn-qty {
    width: 32px;
    height: 32px;
    border: 1px solid var(--primary-color);
    background: var(--white);
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-qty:hover {
    background: var(--primary-color);
    color: var(--white);
}

.opcional-item.quantidade {
    cursor: default;
}

/* Modal de Checkout */
.checkout-modal .cart-content {
    max-width: 600px;
}

.checkout-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Banner de tempo de entrega */
.tempo-entrega-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tempo-entrega-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tempo-entrega-icon {
    font-size: 24px;
}

.tempo-entrega-titulo {
    font-weight: 600;
    font-size: 16px;
}

.tempo-entrega-valor {
    font-size: 14px;
    opacity: 0.95;
    margin-top: 2px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

/* Container de busca de CEP */
.cep-search-container {
    display: flex;
    gap: 10px;
}

.cep-search-container input {
    flex: 1;
}

.btn-buscar-cep {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-buscar-cep:hover {
    background: #5568d3;
}

/* Grid de endereço (2 colunas) */
.endereco-grid-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 10px;
}

.endereco-grid-2:has(#cidade) {
    grid-template-columns: 3fr 1fr;
}

/* Card de informações do cliente */
.cliente-info-card {
    display: none;
    margin-top: 10px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    color: white;
}

.cliente-info-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.cliente-info-text {
    flex: 1;
}

.cliente-stats {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 3px;
}

.btn-limpar-dados {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: white;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: all 0.3s;
}

.btn-limpar-dados:hover {
    background: rgba(255, 255, 255, 0.3);
}

.payment-methods {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.payment-method {
    padding: 8px 5px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    background: white;
}

.payment-method:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.payment-method.selected {
    border-color: var(--primary-color);
    background: #fff5f2;
}

.payment-method-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.payment-method-name {
    font-size: 10px;
    font-weight: 600;
    color: #333;
}

.troco-field {
    display: none;
}

.troco-field.active {
    display: block;
}

.vr-info {
    display: none;
    padding: 10px;
    background: #e7f3ff;
    border-radius: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: #004e89;
}

.vr-info.active {
    display: block;
}

.order-summary {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
}

.summary-line strong {
    font-size: 15px;
    color: var(--primary-color);
}

@media (max-width: 600px) {
    .cart-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .checkout-modal .cart-content {
        padding: 0;
    }
    
    .cart-body {
        padding: 15px;
    }
    
    .cart-header h2 {
        font-size: 18px;
    }
    
    /* Banner de tempo de entrega */
    .tempo-entrega-banner {
        padding: 12px;
        margin-bottom: 15px;
    }
    
    .tempo-entrega-icon {
        font-size: 20px;
    }
    
    .tempo-entrega-titulo {
        font-size: 14px;
    }
    
    .tempo-entrega-valor {
        font-size: 13px;
    }
    
    /* Forçar inputs a ocuparem largura total no mobile */
    .form-group input,
    .form-group textarea,
    .form-group select {
        width: 100%;
        box-sizing: border-box;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 14px;
    }
    
    /* Container de busca de CEP ajustado */
    .cep-search-container {
        gap: 8px;
    }
    
    .btn-buscar-cep {
        padding: 10px 15px;
        font-size: 13px;
        white-space: nowrap;
    }
    
    /* Grids de 2 colunas devem empilhar no mobile */
    .endereco-grid-2 {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    
    .endereco-grid-2 .form-group {
        width: 100%;
    }
    
    /* Card de cliente info ajustado */
    .cliente-info-card {
        padding: 10px;
    }
    
    .cliente-info-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .btn-limpar-dados {
        width: 100%;
        padding: 10px;
    }
    
    /* Métodos de pagamento */
    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .payment-method {
        padding: 10px 5px;
    }
    
    .payment-method-icon {
        font-size: 20px;
    }
    
    .payment-method-name {
        font-size: 10px;
    }
    
    /* Ajustes dos botões de ação */
    .cart-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn-continue,
    .btn-checkout {
        width: 100%;
        padding: 14px !important;
        font-size: 16px !important;
    }
    
    /* Order summary */
    .order-summary {
        padding: 15px;
        margin-top: 20px;
    }
    
    .summary-line {
        font-size: 14px;
    }
    
    .summary-line strong {
        font-size: 16px;
    }
}

/* Tablet ajustes */
@media (min-width: 601px) and (max-width: 768px) {
    .checkout-modal .cart-content {
        max-width: 90%;
    }
    
    .payment-methods {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Animações para notificações */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* ===== TAXA DE ENTREGA POR DISTÂNCIA ===== */

.taxa-pendente {
    color: #f39c12;
    font-size: 12px;
    font-weight: 500;
}

.taxa-pendente i {
    margin-right: 4px;
}

.taxa-calculando {
    color: var(--primary-color);
    font-size: 12px;
    font-weight: 500;
}

.taxa-calculando i {
    margin-right: 4px;
}

.taxa-calculada {
    color: var(--success-color, #28a745);
    font-weight: 600;
}

.taxa-fora-area {
    color: #dc3545;
    font-size: 12px;
    font-weight: 600;
}

.taxa-fora-area i {
    margin-right: 4px;
}

.distancia-info-line {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 0;
    font-size: 11px;
    color: #666;
    border-top: 1px dashed #e0e0e0;
}

.distancia-info-line i {
    color: var(--primary-color);
    font-size: 13px;
}

.fora-area-aviso {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    color: #856404;
    font-size: 13px;
    font-weight: 500;
    margin-top: 10px;
}

.fora-area-aviso i {
    font-size: 18px;
    color: #e67e22;
}
