/* cart.css - Only styling changes to match main page */

/* Main container styling to match main page */
.cart-wrapper {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Header styling */
.cart-wrapper h1 {
    font-size: 2.5rem;
    color: var(--tech-blue);
    margin-bottom: .5rem;
    font-weight: 700;
    margin-top: 0.2rem; 
}

/* Back button styling to match main page buttons */
.back-to-home button {
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-to-home button:hover {
    background-color: var(--primary-dark);
}


/* Mobile only */
@media (max-width: 768px) {
  .back-to-home button {
    padding: 6px 12px;     /* smaller button */
    font-size: 13px;       /* smaller text */
    border-radius: 6px;
  }

  .back-to-home button i {
    font-size: 12px;       /* smaller icon */
    margin-right: 4px;
  }
}



.cart-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #ddd;
    gap: 15px;
    flex-wrap: wrap;
}

.cart-details {
    flex: 1;
    min-width: 150px;
}

.cart-price {
    margin-top: 5px;
    font-size: 14px;
    color: #333;
    display: flex;
    flex-wrap: nowrap;
}

.cart-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.qty-selector {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 30px;
    height: 30px;
    font-size: 18px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

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

.qty-display {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
}

.remove-btn {
    padding: 6px 12px;
    font-size: 14px;
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s;
}

.remove-btn:hover {
    background-color: #e60000;
}

.cart-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 4px;
    background-color: #f5f5f5;
    margin-right: 1.5rem;
}

.cart-item-details {
    flex-grow: 1;
}

.cart-item-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
    font-size: 1.1rem;
}

.cart-item-price {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
    .cart-item-price {
        font-size: 12px;
        margin-bottom: 0;
        font-weight: 600;
    }
}


.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quantity-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid var(--gray);
    background-color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.quantity-btn:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.quantity-value {
    min-width: 30px;
    text-align: center;
}

.remove-item {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: var(--transition);
}

.remove-item:hover {
    text-decoration: underline;
}

/* Cart summary styling */
.cart-summary {
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.cart-summary h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--tech-blue);
    border-bottom: 1px solid var(--gray);
    padding-bottom: 0.5rem;
}

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

.summary-row.total {
    font-weight: 700;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray);
}

#checkout-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 1.5rem;
}

#checkout-btn:hover {
    background-color: var(--primary-dark);
}

@media (max-width: 768px) {

    /* Summary container */
    .cart-summary {
        padding: 0.8rem;
        border-radius: 6px;
    }

    /* Order Summary heading */
    .cart-summary h2 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
        padding-bottom: 0.3rem;
    }

    /* Rows */
    .summary-row {
        font-size: 13px;
        margin-bottom: 0.6rem;
    }

    .summary-row.total {
        font-size: 14px;
        margin-top: 0.6rem;
        padding-top: 0.6rem;
    }

    /* Payment dropdown */
    .payment-select {
        padding: 6px 8px;
        font-size: 12px;
        border-radius: 4px;
    }

    /* Checkout button */
    #checkout-btn {
        padding: 0.6rem;
        font-size: 0.9rem;
        margin-top: 1rem;
    }
}


/* Responsive design */
@media (max-width: 768px) {
    .cart-wrapper {
        padding: 0 1rem;
    }
    
    .cart-item {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .cart-item-image {
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .cart-item-image {
        width: 38px;
        height: 38px;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
}


@media (max-width: 480px) {
    .cart-wrapper h1 {
        font-size: 1rem;
        margin-top: 0;
    }
}

.cart-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.qty-btn {
    width: 32px;
    height: 32px;
    font-size: 18px;
    background-color: #f1f1f1;
    border: 1px solid #ccc;
    color: #333;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

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

.qty-display {
    min-width: 24px;
    text-align: center;
    font-weight: bold;
    font-size: 16px;
}

.remove-btn {
    padding: 6px 12px;
    font-size: 14px;
    background-color: #ff4d4d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.remove-btn:hover {
    background-color: #e60000;
}

@media (max-width: 768px) {

    /* Quantity buttons (- / +) */
    .qty-btn {
        width: 22px;
        height: 22px;
        font-size: 14px;
        border-radius: 3px;
    }

    /* Quantity number */
    .qty-display {
        min-width: 16px;
        font-size: 12px;
        font-weight: 600;
    }

    /* Remove button */
    .remove-btn {
        padding: 4px 8px;
        font-size: 11px;
        border-radius: 3px;
    }
}

@media (max-width: 768px) {

    .remove-btn {
        font-size: 0;                 /* hide text */
        padding: 6px;
        width: 28px;
        height: 28px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .remove-btn::before {
        content: "🗑️";               /* trash icon */
        font-size: 14px;
        line-height: 1;
    }
}




@media (max-width: 768px) {
    .cart-details h4 {
        font-size: 11px;      /* reduce text size */
        line-height: 1.2;
        margin: 0;
    }
}


.cart-item a {
    display: inline-flex;
}


.cart-image-link {
    display: inline-block;
    border-radius: 6px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cart-image-link img {
    transition: transform 0.12s cubic-bezier(.4,0,.2,1);
}

/* Press / deep effect */
.cart-image-link:active img {
    transform: scale(0.92);
}

/* Optional: slight shadow pop on tap */
.cart-image-link:active {
    box-shadow: 0 2px 6px rgba(0,0,0,0.2) inset;
}


@media (max-width: 768px) {

    /* Base row */
    .cart-item {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    /* 1️⃣ Image first */
    .cart-item a {
        order: 1;
        flex-shrink: 0;
    }

    /* 2️⃣ Product details (name + price) */
    .cart-details {
        order: 2;
        flex: 1;
        min-width: 0;
    }

    /* Product name */
    .cart-details h4 {
        font-size: 11px;
        line-height: 1.2;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Price below name (still compact) */
    .cart-price {
        font-size: 11px;
        margin-top: 2px;
    }

    /* 3️⃣ Quantity + remove AFTER name */
    .cart-actions {
        order: 3;
        display: flex;
        align-items: center;
        gap: 4px;
        margin: 0;
        flex-shrink: 0;
    }
}


@media (max-width: 768px) {

    .stock-warning {
        order: 99;                /* always last */
        margin-top: 6px;
        font-size: 11px;
        line-height: 1.2;
    }
}


/* Fix stock warning breaking mobile layout */
.stock-warning {
    width: 100%;
    flex-basis: 100%;
}




.cart-item.out-of-stock {
    opacity: 0.45;
    background: #fff5f5;
}

.cart-item .stock-db-warning {
    font-size: 12px;
    color: #c0392b;
    margin-top: 6px;
    font-weight: 600;
}
