/* static/css/cart.css – modern cart page styling */

:root {
    --primary: #ff5722;
    --bg: #fafafa;
    --text: #333;
    --muted: #777;
    --border: #e5e5e5;
    --radius: 12px;
}

/* ---------------------- Page layout ---------------------- */
body {
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", sans-serif;
    line-height: 1.5;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    margin-bottom: 2rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 600;
}

.page-header a {
    font-size: 0.95rem;
    color: var(--primary);
    text-decoration: none;
    transition: opacity 0.2s;
}

.page-header a:hover {
    opacity: 0.75;
}

/* ---------------------- Main container ------------------- */
/* backdrop */
.cart-modal {
    position: fixed;
    right: 0;
    display: flex;
    width: 325px;
    height: 100%;
    background: #fff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, .15);
    /* keeps layout even while hidden */
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .35s ease;
    z-index: 2000;
}


.cart-modal.open {
    transform: translateX(0)
}


/* when open */
.cart-modal.open {
    opacity: 1;
    pointer-events: auto;
    /* clickable again */
}

/* slide-left for the dialog itself */
.cart-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem 1rem;
    transform: translateX(100%);
    transition: transform .35s ease;
    overflow: scroll;
}

.cart-modal.open .cart-modal-content {
    transform: translateY(0);
}

.cart-container {
    width: min(820px, 92%);
    margin: 0 auto 4rem;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.cart-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem 1rem;
    gap: 1.25rem;

}

.cart-footer {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    gap: 1rem;
}


.cart-close {
    font-size: 1.8rem;
    margin-left: auto;
    cursor: pointer
}


/* ---------------------- Cart rows ------------------------ */
.cart-item {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.25s ease;
    align-items: start;
}

.cart-item-info {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
}

.cart-item:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

/* -- left side (name / qty) -- */
.item-info h4 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
}

.item-info .qty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

/* -- right side (actions) -- */
.item-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.line-total {
    font-weight: 600;
}

/* ----------  Quantity control  ---------- */
.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.qty-control button {
    all: unset;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.2s, color 0.2s;
}

.qty-control button:hover {
    background: var(--primary);
    color: #fff;
}

.qty-control input {
    width: 42px;
    height: 34px;
    border: none;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: center;
    font-size: 0.95rem;
    outline: none;
}

.qty-value {
    width: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Remove button */
.remove-btn {
    color: white;
    background-color: red;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.85rem;
    width: fit-content;
    align-self: flex-end;
}


/* ---------------------- Summary / buttons ---------------- */
.cart-summary {
    margin-left: auto;
    text-align: right;
}

.cart-summary h3 {
    margin: 0 0 0.65rem;
    font-size: 1.3rem;
    font-weight: 500;
}

.cart-btn {
    display: inline-block;
    border: none;
    padding: 0.7rem 1.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.25s, transform 0.25s;
}

.cart-btn.primary {
    background: var(--primary);
    color: #fff;
}

.cart-btn.primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.cart-btn.secondary {
    background: #eee;
    color: var(--text);
}

.cart-btn.secondary:hover {
    background: #ddd;
}

#cart-total {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

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

/* ---------------------- Empty state ---------------------- */
#cart-items p {
    text-align: center;
    color: var(--muted);
}

/* ---------------------- Responsive ----------------------- */
@media (max-width: 540px) {
    .item-actions {
        flex-direction: column;
        align-items: flex-end;
        gap: 0.5rem;
    }

    .cart-item {
        grid-template-columns: 1fr;
    }
}