#cart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

#cart-modal.show {
    display: flex !important;
}

.cart-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.cart-modal-content {
    background: #faf8f5;
    width: 90%;
    max-width: 750px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    overflow: hidden;
}

.cart-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 3px solid #8b4513;
    background: #ffffff;
}

.cart-modal-header h2 {
    margin: 0;
    font-size: 26px;
    color: #8b4513;
    font-weight: 600;
    font-family: Georgia, serif;
}

.close-cart {
    font-size: 32px;
    color: #8b4513;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.close-cart:hover {
    color: #c27a5f;
    background: rgba(139, 69, 19, 0.1);
}

.cart-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #ffffff;
}

.cart-items-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #999;
    font-size: 16px;
}

.cart-item {
    display: grid;
    grid-template-columns: 40px 100px 1fr 80px 110px 50px;
    gap: 15px;
    align-items: center;
    padding: 18px 25px;
    border-bottom: 2px solid #d4cfc8;
    background: #ffffff;
    transition: background 0.2s ease;
}

.cart-item:hover {
    background: #faf8f5;
}

.cart-item-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #8b4513;
}

.cart-item-image {
    width: 100px;
    height: 140px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.cart-item-author {
    font-size: 12px;
    color: #666;
}

.cart-item-price {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    text-align: right;
}

.cart-item-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border: 2px solid #c27a5f;
    background: #ffffff;
    color: #c27a5f;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #c27a5f;
    color: #ffffff;
}

.qty-input {
    width: 35px;
    height: 32px;
    border: 2px solid #c27a5f;
    text-align: center;
    font-size: 14px;
    border-radius: 6px;
}

.cart-item-remove {
    width: 36px;
    height: 36px;
    background: #c27a5f;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    background: #a86348;
    transform: scale(1.05);
}

.cart-modal-footer {
    padding: 20px 25px;
    border-top: 3px solid #8b4513;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.cart-footer-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-footer-left input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #8b4513;
}

.cart-footer-left label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
    font-weight: 500;
}

.cart-footer-middle {
    flex: 1;
    text-align: center;
}

.cart-footer-middle span {
    font-size: 15px;
    color: #666;
}

.cart-footer-middle strong {
    color: #000;
    font-size: 18px;
    font-weight: 700;
}

.btn-checkout {
    padding: 12px 35px;
    background: #8b6f47;
    color: #ffffff;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-checkout:hover {
    background: #6d5637;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 111, 71, 0.3);
}

.btn-checkout:active {
    transform: translateY(0);
}

#cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
}

.carrinho {
    position: relative;
    cursor: pointer;
}

@media (max-width: 768px) {
    .cart-modal-overlay {
        align-items: flex-end;
    }

    .cart-modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
    }

    .cart-modal-header {
        padding: 18px 20px;
    }

    .cart-modal-header h2 {
        font-size: 22px;
    }

    .cart-item {
        grid-template-columns: 35px 80px 1fr 45px 80px 40px;
        gap: 10px;
        padding: 15px 18px;
    }

    .cart-item-image {
        width: 80px;
        height: 110px;
    }

    .cart-item-title {
        font-size: 13px;
    }

    .cart-item-author {
        font-size: 11px;
    }

    .cart-item-price {
        font-size: 15px;
    }

    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }

    .qty-input {
        width: 30px;
        height: 28px;
        font-size: 12px;
    }

    .cart-item-remove {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .cart-modal-footer {
        padding: 15px 18px;
        flex-direction: column;
        gap: 12px;
    }

    .cart-footer-middle {
        width: 100%;
    }

    .btn-checkout {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .cart-modal-content {
        width: 95%;
        margin: 0 auto;
    }

    .cart-item {
        grid-template-columns: 30px 1fr 35px;
        gap: 8px;
        padding: 12px 12px;
    }

    .cart-item-image {
        display: none;
    }

    .cart-item-info {
        order: 1;
    }

    .cart-item-checkbox {
        order: 0;
    }

    .cart-item-remove {
        order: 2;
    }

    .cart-item-title {
        font-size: 12px;
    }

    .cart-item-author {
        font-size: 10px;
    }

    .cart-item-price,
    .cart-item-qty {
        display: none;
    }

    .btn-checkout {
        font-size: 14px;
        padding: 10px 20px;
    }
}

@media (max-width: 360px) {
    .cart-modal-content {
        width: 98%;
    }
    
    .cart-modal-overlay {
        padding: 10px;
    }
}
