/* Estilos para o carrinho */

/* Feedback de adição ao carrinho */
.cart-feedback {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4CAF50;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    font-size: 13px;
    text-align: center;
    min-width: 150px;
    max-width: 250px;
    opacity: 0;
    transform: translate(-50%, -20px);
    transition: opacity 0.3s, transform 0.3s;
}

.cart-feedback.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.cart-feedback.error {
    background-color: #f44336;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }

    10% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    90% {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
}

/* Botão de adição rápida */
.quick-add-btn {
    position: relative;
    overflow: hidden;
}

.quick-add-btn.adding::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(76, 175, 80, 0.3);
    animation: pulse 1s ease-in-out;
}

@keyframes pulse {
    0% {
        transform: scale(0);
        opacity: 0.8;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Contador do carrinho */
.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: #f44336;
    color: white;
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 rgba(244, 67, 54, 0.4);
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    padding: 0;
}

/* Animação de destaque para o contador do carrinho */
.cart-count.highlight {
    animation: cart-pulse 1s ease-out;
}

@keyframes cart-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
        transform: scale(1.5);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
        transform: scale(1);
    }
}

/* Link do carrinho */
.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.cart-link .cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    font-size: 10px;
    width: 18px;
    height: 18px;
    font-weight: bold;
}

/* Botões do carrinho */
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    height: 32px;
    width: 70px;
    /* Adicionado largura para reduzir o tamanho do container */
}

.quantity-btn {
    background-color: #f5f5f5;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quantity-btn:hover {
    background-color: #e0e0e0;
}

.update-cart-quantity {
    width: 30px;
    /* Aumentado conforme solicitado */
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    padding: 5px 0;
    box-sizing: border-box;
    -moz-appearance: textfield;
    /* Remove setas no Firefox */
    font-size: 14px;
    /* Tamanho da fonte normal */
    height: 22px;
    /* Altura ajustada para melhor visualização */
}

/* Remove setas nos navegadores WebKit */
.update-cart-quantity::-webkit-outer-spin-button,
.update-cart-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.remove-from-cart {
    background-color: transparent;
    border: none;
    color: #f44336;
    cursor: pointer;
    transition: color 0.2s;
}

.remove-from-cart:hover {
    color: #d32f2f;
}

/* Tabela do carrinho */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
}

table th {
    text-align: left;
    padding: 10px;
    border-bottom: 2px solid #eee;
    font-weight: 600;
    color: #333;
}

table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cart-item-info img {
    max-width: 60px;
    border-radius: 4px;
}

.cart-item-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.cart-summary {
    background-color: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
    max-width: 400px;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.summary-row.total {
    font-weight: 700;
    font-size: 18px;
    color: #16a34a;
    border-top: 2px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.checkout-btn {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 15px;
    padding: 12px;
    background-color: #16a34a;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s;
}

.checkout-btn:hover {
    background-color: #15803d;
}

.empty-cart {
    text-align: center;
    padding: 40px 0;
}

.empty-cart p {
    font-size: 18px;
    color: #666;
    margin-bottom: 20px;
}

/* Responsividade */
@media (max-width: 768px) {

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        border: 1px solid #eee;
        margin-bottom: 15px;
        border-radius: 4px;
    }

    td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 50%;
    }

    td:before {
        position: absolute;
        top: 12px;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
    }

    td:nth-of-type(1):before {
        content: "Produto";
    }

    td:nth-of-type(2):before {
        content: "Preço";
    }

    td:nth-of-type(3):before {
        content: "Quantidade";
    }

    td:nth-of-type(4):before {
        content: "Total";
    }

    .cart-item-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .cart-summary {
        max-width: 100%;
        margin: 0;
    }
}