/**
 * Cart Page Styles
 * CSS Module for shopping cart page
 */

/* ============================================================================
   LAYOUT
   ============================================================================ */

.bw-cart-layout {
    margin-bottom: 0;
}

.bw-page-title {
    font-size: 2rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 2rem;
}

.bw-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--bw-green);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease;
}

.bw-back-link:hover {
    color: var(--bw-green-dark);
    transform: translateX(-4px);
}

.bw-back-link::before {
    content: "←";
    font-size: 1.2rem;
}

/* ============================================================================
   EMPTY CART STATE
   ============================================================================ */

.bw-empty-cart {
    background: white;
    border-radius: 12px;
    padding: 4rem 2rem;
    text-align: center;
    box-shadow: var(--bw-shadow);
}

.bw-empty-cart-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.bw-empty-cart h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ============================================================================
   CART ITEMS
   ============================================================================ */

.bw-cart-items {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.bw-cart-item {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--bw-shadow);
    transition: all 0.3s ease;
    position: relative;
}

.bw-cart-item:hover {
    box-shadow: var(--bw-shadow-hover);
}

/* Item Image */
.bw-item-image {
    width: 100px;
    flex-shrink: 0;
}

.bw-item-image img {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3;
    object-fit: cover;
    border-radius: 8px;
}

.bw-no-image {
    width: 100%;
    aspect-ratio: 2/3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bw-gray-light);
    border-radius: 8px;
    font-size: 2rem;
}

/* Item Details */
.bw-item-details {
    flex: 1;
    min-width: 0;
}

.bw-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.25rem 0;
}

.bw-item-author {
    font-size: 0.9rem;
    color: #6c757d;
    margin: 0 0 0.75rem 0;
}

.bw-item-pricing {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bw-unit-price {
    font-size: 0.9rem;
    color: #495057;
}

.bw-discount-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background-color: var(--bw-green-dark);
    border-radius: 999px;
    min-width: 3rem;
    min-height: 1.65rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.bw-discount-badge.is-visible {
    opacity: 1;
    visibility: visible;
}

/* Quantity Control */
.bw-item-quantity {
    flex-shrink: 0;
}

.bw-item-quantity label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.bw-quantity-control {
    display: flex;
    align-items: center;
    gap: 0;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.bw-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bw-gray-light);
    color: #495057;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bw-qty-btn:hover {
    background: var(--bw-green);
    color: white;
}

.bw-qty-btn:active {
    transform: scale(0.95);
}

.bw-qty-input {
    width: 60px;
    height: 36px;
    border: none;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    padding: 0;
}

.bw-qty-input:focus {
    outline: none;
    background: #f8f9fa;
}

/* Remove number input spinner buttons */
.bw-qty-input::-webkit-inner-spin-button,
.bw-qty-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.bw-qty-input[type=number] {
    -moz-appearance: textfield;
}

/* Item Total */
.bw-item-total {
    flex-shrink: 0;
    text-align: right;
    min-width: 120px;
}

.bw-total-label {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.bw-total-price {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--bw-green);
}

/* Remove Button */
.bw-item-remove {
    flex-shrink: 0;
}

.bw-remove-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #dc3545;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bw-remove-btn:hover {
    background: #dc3545;
    color: white;
    transform: scale(1.1);
}

/* ============================================================================
   CART SUMMARY SIDEBAR
   ============================================================================ */

.bw-cart-summary {
    position: sticky;
    top: 2rem;
}

.bw-cart-summary .card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--bw-shadow);
}

.bw-cart-summary .card-header {
    background: linear-gradient(135deg, var(--bw-green) 0%, var(--bw-green-light) 100%);
    color: white;
    padding: 1.25rem;
    border-bottom: none;
}

.bw-cart-summary .card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.bw-summary-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bw-gray-border);
    margin-bottom: 1rem;
}

.bw-summary-item {
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
}

.bw-summary-item-qty {
    font-weight: 600;
    color: #212529;
    flex-shrink: 0;
}

.bw-summary-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bw-summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 700;
    color: #212529;
}

.bw-total-amount {
    font-size: 1.5rem;
    color: var(--bw-green);
}


/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 1200px) {
    .bw-cart-item {
        gap: 1rem;
    }

    .bw-item-image {
        width: 80px;
    }

    .bw-item-total {
        min-width: 100px;
    }
}

@media (max-width: 992px) {
    .bw-cart-summary {
        position: static;
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .bw-cart-item {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .bw-item-image {
        width: 70px;
    }

    .bw-item-details {
        flex: 1 1 calc(100% - 90px);
    }

    .bw-item-quantity {
        flex: 0 0 auto;
        order: 4;
    }

    .bw-item-total {
        flex: 1 1 auto;
        order: 5;
        text-align: left;
        min-width: auto;
    }

    .bw-item-remove {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
}

@media (max-width: 576px) {
    .bw-page-title {
        font-size: 1.5rem;
    }

    .bw-cart-item {
        padding: 1rem;
    }

    .bw-item-image {
        width: 60px;
    }

    .bw-item-title {
        font-size: 1rem;
    }

    .bw-item-quantity,
    .bw-item-total {
        flex: 1 1 100%;
    }

    .bw-quantity-control {
        width: 100%;
    }

    .bw-qty-btn {
        flex: 1;
    }

    .bw-qty-input {
        flex: 2;
        width: auto;
    }

    .bw-total-price {
        font-size: 1.1rem;
    }
}

/* ============================================================================
   LOADING STATES & ANIMATIONS
   ============================================================================ */

.bw-cart-item.updating {
    opacity: 0.6;
    pointer-events: none;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(-20px);
    }
}

.bw-cart-item.removing {
    animation: fadeOut 0.3s ease forwards;
}