:root {
    --cart-primary: #4a6cf7;
    --cart-primary-dark: #3a5bd9;
    --cart-text: #2d3748;
    --cart-secondary: #718096;
    --cart-bg: #f5f7fa;
    --cart-border: #e2e8f0;
    --cart-border-light: #f0f4f8;
    --cart-section-bg: #f8fafc;
    --cart-danger: #e53e3e;
    --cart-danger-dark: #c53030;
    --cart-white: #ffffff;
    --cart-transition: all 0.2s ease;
}

* {
    box-sizing: border-box;
}

/* ===========================
   PAGE WRAPPER
   =========================== */

.cart-page {
    width: 100%;
    min-height: 100vh;
    background-color: var(--cart-bg);
    padding-top: 24px;
    padding-bottom: 60px;
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.cart-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 16px;
}

/* ===========================
   PAGE TITLE
   =========================== */

.cart-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--cart-text);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-title i {
    color: var(--cart-primary);
}

/* ===========================
   LOADING STATE
   =========================== */

.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--cart-secondary);
    font-size: 16px;
    gap: 12px;
}

.cart-loading i {
    font-size: 28px;
    color: var(--cart-primary);
}

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

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    gap: 12px;
}

.cart-empty i {
    color: #cbd5e0;
    margin-bottom: 16px;
}

.cart-empty h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--cart-text);
    margin: 0;
}

.cart-empty p {
    color: var(--cart-secondary);
    margin: 0;
    font-size: 15px;
}

.cart-browse-btn {
    display: inline-block;
    margin-top: 16px;
    padding: 12px 24px;
    background-color: var(--cart-primary);
    color: var(--cart-white);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: var(--cart-transition);
}

.cart-browse-btn:hover {
    background-color: var(--cart-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

/* ===========================
   STORE SECTION
   =========================== */

.cart-store-section {
    border: 1px solid var(--cart-border);
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
    background-color: var(--cart-white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.cart-store-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--cart-section-bg);
    border-bottom: 1px solid var(--cart-border);
}

.cart-store-name {
    font-weight: 600;
    color: var(--cart-text);
    font-size: 15px;
}

.cart-store-item-count {
    color: var(--cart-secondary);
    font-size: 14px;
}

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

.cart-items-list {
    display: flex;
    flex-direction: column;
}

.cart-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cart-border-light);
    gap: 16px;
    transition: background-color 0.15s ease;
}

.cart-item:last-of-type {
    border-bottom: none;
}

.cart-item:hover {
    background-color: #fafbff;
}

.cart-item-image {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    background-color: var(--cart-border-light);
    flex-shrink: 0;
}

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-name {
    font-weight: 500;
    color: var(--cart-text);
    margin-bottom: 4px;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-price {
    color: var(--cart-secondary);
    font-size: 14px;
}

/* ===========================
   QUANTITY CONTROLS
   =========================== */

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--cart-border);
    border-radius: 6px;
    background-color: var(--cart-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cart-text);
    font-size: 11px;
    transition: var(--cart-transition);
    padding: 0;
}

.qty-btn:hover:not(:disabled) {
    background-color: var(--cart-bg);
    border-color: var(--cart-primary);
    color: var(--cart-primary);
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-value {
    min-width: 28px;
    text-align: center;
    font-weight: 500;
    color: var(--cart-text);
    font-size: 15px;
}

/* ===========================
   SUBTOTAL + REMOVE
   =========================== */

.cart-item-subtotal {
    font-weight: 600;
    color: var(--cart-text);
    min-width: 80px;
    text-align: right;
    font-size: 15px;
    flex-shrink: 0;
}

.cart-item-remove {
    color: var(--cart-danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
    transition: var(--cart-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-item-remove:hover {
    color: var(--cart-danger-dark);
    background-color: rgba(229, 62, 62, 0.08);
}

/* ===========================
   STORE FOOTER
   =========================== */

.cart-store-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background-color: var(--cart-section-bg);
    border-top: 1px solid var(--cart-border);
}

.cart-store-subtotal {
    font-weight: 600;
    color: var(--cart-text);
    font-size: 15px;
}

.cart-checkout-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: var(--cart-primary);
    color: var(--cart-white);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: var(--cart-transition);
}

.cart-checkout-btn:hover {
    background-color: var(--cart-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 108, 247, 0.3);
}

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

@media (max-width: 768px) {
    .cart-container {
        padding: 20px 12px;
    }

    .cart-title {
        font-size: 20px;
    }

    .cart-item {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }

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

    .cart-item-details {
        /* take up remaining space on first row alongside image */
        flex: 1;
    }

    .cart-item-controls {
        /* push controls to second row, after image+details */
        order: 3;
        margin-left: calc(56px + 12px); /* align with details */
    }

    .cart-item-subtotal {
        order: 4;
        min-width: auto;
        text-align: left;
    }

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

    .cart-store-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .cart-checkout-btn {
        width: 100%;
        justify-content: center;
    }

    .cart-store-header {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .cart-item-name {
        font-size: 14px;
        white-space: normal;
    }

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

    .cart-item-subtotal {
        font-size: 14px;
    }

    .cart-title {
        font-size: 18px;
        margin-bottom: 16px;
    }
}
