/* 
 * Arquivo: /tags/frontend/assets/css/carrinho.css
 * Estilos adicionais para funcionalidade de carrinho de compras
 * VERSÃO CORRIGIDA - SEM CONFLITOS DE MODAL
 */

/* Animações e transições suaves */
.produto-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.produto-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
    transition: left 0.5s ease;
    z-index: 1;
}

.produto-card.selecionado::before {
    left: 100%;
}

/* Efeito hover nos checkboxes */
.produto-checkbox {
    transform: scale(1);
    transition: all 0.2s ease;
}

.produto-checkbox:hover {
    transform: scale(1.1);
}

.produto-checkbox:checked {
    transform: scale(1.2);
}

/* Badge de selecionado */
.campo-produto.selecionado::after {
    content: '✓ Selecionado';
    position: absolute;
    top: 15px;
    left: 15px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    z-index: 20;
    animation: bounceIn 0.3s ease;
}

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

/* Animação do botão carrinho */
.carrinho-total {
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Efeito pulsante quando há itens */
.carrinho-total.tem-itens {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 5px 20px rgba(0, 123, 255, 0.4);
    }
    50% {
        box-shadow: 0 5px 30px rgba(0, 123, 255, 0.8);
    }
    100% {
        box-shadow: 0 5px 20px rgba(0, 123, 255, 0.4);
    }
}

/* Animações do modal */
.modal-carrinho {
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

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

.modal-carrinho-content {
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Animação dos itens do carrinho */
.carrinho-item {
    animation: slideInRight 0.3s ease;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.carrinho-item:last-of-type {
    margin-bottom: 0;
}

.carrinho-item-info {
    flex: 1;
    overflow: hidden;
}

.carrinho-item-controles {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 120px;
}

.carrinho-item-quantidade {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.carrinho-item-acoes {
    display: flex;
    align-items: center;
}

@keyframes slideInRight {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Hover effects nos botões */
.carrinho-item-remover {
    transition: all 0.2s ease;
}

.carrinho-item-remover:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.btn-copy-pix-carrinho {
    transition: all 0.2s ease;
}

.btn-copy-pix-carrinho:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Responsive melhorado */
@media (max-width: 480px) {
    .produto-checkbox {
        width: 20px;
        height: 20px;
        top: 8px;
        right: 8px;
    }
    
    .campo-produto.selecionado::after {
        font-size: 10px;
        padding: 2px 6px;
        top: 10px;
        left: 10px;
    }
    
    .carrinho-total {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .modal-carrinho-content {
        padding: 20px 15px;
    }
    
    .carrinho-acoes {
        flex-direction: column;
    }
    
    .carrinho-acoes button {
        margin-bottom: 10px;
    }
    
    .carrinho-acoes button:last-child {
        margin-bottom: 0;
    }
}

/* Estados de loading */
.carrinho-loading {
    opacity: 0.7;
    pointer-events: none;
}

.carrinho-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Indicador visual de sucesso */
.success-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 3000;
    animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s;
}

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

/* Melhorias na aparência do PIX */
.carrinho-pix-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    position: relative;
}

.carrinho-pix-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #28a745, #20c997);
}

.pix-chave {
    background: white;
    border: 2px dashed #28a745;
    position: relative;
}

.pix-chave::before {
    content: 'PIX';
    position: absolute;
    top: -8px;
    left: 10px;
    background: #28a745;
    color: white;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .modal-carrinho-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .carrinho-item {
        background: #4a5568;
        border-color: #718096;
    }
    
    .carrinho-total-modal {
        background: #2b6cb0;
        border-color: #3182ce;
    }
    
    .carrinho-pix-info {
        background: #4a5568;
        border-color: #718096;
    }
    
    .pix-chave {
        background: #2d3748;
        border-color: #68d391;
        color: #e2e8f0;
    }
}

/* ================================
   MODAL CARRINHO CORRIGIDO PARA MOBILE
   ================================ */

/* Estilos básicos do modal - compatível com desktop */
.modal-carrinho {
    backdrop-filter: blur(5px);
}

/* Remove estilos conflitantes do modal no mobile */
@media (max-width: 767px) {
    /* Remove regras que estavam causando conflito */
    .modal-carrinho,
    .modal-carrinho-content,
    .lista-carrinho,
    .sua-lista {
        /* Reset das propriedades problemáticas */
        left: unset !important;
        top: unset !important;
        transform: unset !important;
        width: unset !important;
        max-width: unset !important;
        height: unset !important;
        max-height: unset !important;
        border-radius: unset !important;
        box-shadow: unset !important;
        overflow: unset !important;
        z-index: unset !important;
    }

    /* Permite que o CSS do index.php tenha controle total */
    .modal-carrinho.show,
    .modal-carrinho.show .modal-carrinho-content {
        /* Não força propriedades específicas - deixa o CSS principal controlar */
    }

    /* Mantém apenas as regras de backdrop que não conflitam */
    .modal-backdrop.show {
        opacity: 0.6 !important;
        backdrop-filter: blur(2px) !important;
    }
}

/* Estilos para elementos internos do carrinho que não conflitam */
.carrinho-item-titulo {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.carrinho-item-preco {
    font-size: 14px;
    color: #28a745;
    font-weight: 500;
}

.carrinho-resumo {
    border-top: 2px solid #f8f9fa;
    padding-top: 15px;
    margin-top: 15px;
}

.carrinho-total-valor {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

/* Botões do carrinho */
.btn-carrinho {
    transition: all 0.2s ease;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-carrinho:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-carrinho-primario {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn-carrinho-secundario {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.btn-carrinho-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

/* Animações suaves para interações */
.carrinho-item-fade-out {
    animation: fadeOutSlide 0.3s ease-out forwards;
}

@keyframes fadeOutSlide {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

/* Responsividade para textos */
@media (max-width: 480px) {
    .carrinho-item-titulo {
        font-size: 14px;
    }
    
    .carrinho-item-preco {
        font-size: 13px;
    }
    
    .carrinho-total-valor {
        font-size: 18px;
    }
    
    .btn-carrinho {
        font-size: 14px;
        padding: 10px 15px;
    }
}