/* Layout geral e estilos da página */
body {
    padding-top: 80px;
}

.main-header {
    position: fixed !important;
    left: 0;
    right: 0;
}

.main-header {
    top: 0;
}

.cart-main {
    width: 95%;
    max-width: 1200px;
    justify-content: center;
    min-height: 85%;
    margin: 30px auto;
    padding: 20px;
    display: flex;
    align-items: center;
    flex-direction: row;
    gap: 30px;
    background: var(--glasmorphism-bg);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cart-container,
.cart-summary {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Container principal do carrinho (lista de produtos) */
.center-generic {
    font-family: var(--font-main);
    color: var(--text-primary);
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2vh;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    padding: 40px;
    border-radius: 20px;
}

.center-generic h4 {
    font-size: 1.5rem;
}

.center-generic .cta-button {
    width: max-content;
}

.cart-container {
    height: 100%;
    width: 100%;
    padding: 30px;
    border-radius: 20px;
    overflow-y: auto;
}

.cart-header h1 {
    font-family: var(--font-main);
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.cart-items {
    border-top: 1px solid var(--border-color);
}

/* Itens individuais do carrinho */
.cart-item,
.cart-buy {
    display: grid;
    grid-template-columns: 100px 2fr 1fr 1fr 1fr 50px;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-buy {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

.cart-buy-product {
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
}

.product-list {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    height: 100%;
    gap: 100px;
}

.cart-buy-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.cart-buy-product {
    display: flex;
    flex-direction: row;
    height: 100%;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

.cart-buy-meta span {
    color: var(--danger-color);
}

.product-image {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-details h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.product-details p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qtd-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.qtd-btn:hover {
    background: var(--accent-color);
    color: white;
}

.quantity-display {
    font-weight: 500;
    font-size: 1.1rem;
}

.product-price,
.product-total {
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
}

.remove-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.remove-btn:hover {
    color: var(--danger-color);
}

/* Resumo do pedido */
.cart-summary {
    padding: 30px;
    border-radius: 20px;
    align-self: center;
    width: 100%;
    max-width: 400px;
}

.cart-summary h2 {
    font-family: var(--font-main);
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 1rem;
}

.summary-row span:first-child {
    color: var(--text-muted);
}

.summary-row.total {
    font-size: 1.3rem;
    font-weight: 600;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
    margin-top: 10px;
}

.cart-summary .cta-button {
    width: 100%;
    margin-top: 20px;
}

#cancel-cart {
    background-image: linear-gradient(to right, #e03a3a 0%, #d35050 50%, #e91d27 100%);
    box-shadow: 0 4px 15px 0 rgba(233, 29, 29, 0.25);
}

/* Responsividade */
@media (max-width: 1200px) {
    .cart-main {
        width: 95%;
        max-width: 900px;
    }

    .cart-item {
        grid-template-columns: 80px 2fr 1fr 1fr 1fr 40px;
        gap: 15px;
    }
}

@media (max-width: 900px) {
    body {
        padding-top: 8vh;
    }

    .cart-buy {
        flex-direction: column;
    }

    .cart-buy-product {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .cart-main {
        flex-direction: column;
        height: auto;
        margin: 20px auto;
        width: 95%;
        padding: 15px;
    }

    .center-generic h4 {
        font-size: 2rem;
    }

    .center-generic .cta-button {
        font-size: 1.2rem;
    }

    .cart-summary {
        align-self: center;
        width: 100%;
        max-width: none;
        padding: 20px;
    }

    .cart-container {
        padding: 20px;
    }

    .cart-item {
        grid-template-columns: 80px 1fr 50px;
        grid-template-rows: auto auto auto;
        gap: 10px 15px;
    }

    .product-image {
        grid-row: 1 / 4;
        width: 80px;
        height: 80px;
    }

    .product-details {
        grid-column: 2 / 3;
    }

    .quantity-control,
    .product-price,
    .product-total {
        grid-column: 2 / 3;
        justify-content: flex-start;
        text-align: left;
    }

    .product-price::before,
    .product-total::before {
        content: attr(data-label);
        font-weight: normal;
        color: var(--text-muted);
        margin-right: 10px;
    }

    .product-price,
    .product-total {
        display: flex;
    }

    .remove-btn {
        grid-column: 3 / 4;
        grid-row: 1 / 2;
        justify-self: end;
    }
}

@media (max-width: 767px) {
    .cart-container.glasmorphism,
    .cart-summary.glasmorphism {
        background-color: var(--bg-secondary);
    }
}

@media (max-width: 480px) {
    .cart-header h1 {
        font-size: 2rem;
    }

    .center-generic {
        margin-top: 3vh;
    }

    .center-generic h4 {
        font-size: 1.4rem;
    }

    .center-generic .cta-button {
        font-size: 1rem;
    }

    .cart-item {
        grid-template-columns: 60px 1fr 40px;
    }

    .product-image {
        width: 60px;
        height: 60px;
    }

    .product-details h3 {
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    .center-generic h4 {
        font-size: 1rem;
    }

    .center-generic .cta-button {
        font-size: 0.8rem;
    }
}