/* PPL Agro - Cart Sidebar Styling */

.cart-sidebar {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: stretch;
    justify-content: flex-end;
}

.cart-sidebar.is-open {
    display: flex;
}

.cart-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    cursor: pointer;
}

.cart-sidebar > .cart-content {
    position: relative;
    z-index: 1;
    width: min(420px, 100vw);
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 18px rgba(0, 0, 0, 0.16);
    animation: slideIn 0.25s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.cart-header h3 {
    margin: 0;
    font-size: 20px;
    color: #16351f;
    font-weight: 700;
}

.cart-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.cart-close:hover {
    background: #f5f5f5;
    color: #333;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.cart-item:last-child {
    border-bottom: none;
}

.item-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-details h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #16351f;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.item-unit-price {
    margin: 0;
    font-size: 12px;
    color: #888;
}

.item-price {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1f6f48;
}

.item-quantity {
    font-size: 12px;
    color: #666;
}

.item-remove {
    position: absolute;
    top: 0;
    right: 0;
    background: #fff2f2;
    border: 1px solid #ffcccc;
    color: #a33b3b;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.item-remove:hover {
    background: #ff4444;
    color: #fff;
    border-color: #ff4444;
}

.cart-empty-state {
    padding: 40px 20px;
    text-align: center;
}

.cart-empty-state p {
    margin: 0 0 20px;
    font-size: 14px;
    color: #666;
}

.cart-summary {
    border-top: 1px solid #eee;
    padding: 16px 20px;
    flex-shrink: 0;
    background: #f9f9f9;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    font-size: 13px;
    color: #666;
}

.summary-row.total {
    font-size: 15px;
    font-weight: 700;
    color: #16351f;
    padding: 12px 0;
    border-top: 1px solid #ddd;
    margin-top: 8px;
}

.cart-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 20px;
    flex-shrink: 0;
    border-top: 1px solid #eee;
}

.btn {
    padding: 12px 16px;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-outline {
    background: #fff;
    color: #16351f;
    border: 1px solid #16351f;
}

.btn-outline:hover {
    background: #16351f;
    color: #fff;
}

.btn-primary {
    background: #1f6f48;
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: #16351f;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

/* Cart icon badge */
.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
}

.cart-icon-active {
    color: #1f6f48;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cart-sidebar {
        max-width: 100%;
    }

    .cart-header h3 {
        font-size: 18px;
    }

    .item-image {
        width: 70px;
        height: 70px;
    }

    .cart-item {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }
}

@media (max-width: 480px) {
    .cart-header {
        padding: 16px;
    }

    .cart-items {
        padding: 16px;
    }

    .cart-summary {
        padding: 12px 16px;
    }

    .cart-buttons {
        padding: 12px 16px;
        gap: 8px;
    }

    .item-image {
        width: 60px;
        height: 60px;
    }

    .item-details h4 {
        font-size: 13px;
    }

    .item-unit-price,
    .item-quantity {
        font-size: 11px;
    }

    .item-price {
        font-size: 13px;
    }

    .summary-row {
        font-size: 12px;
    }

    .summary-row.total {
        font-size: 14px;
    }
}
