.cart-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cart-page__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-end;
}

.cart-page__head h1 {
    font-size: 1.55rem;
    font-weight: 800;
}

.cart-page__head p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.cart-page__code {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
}

.cart-lines {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.cart-line {
    display: grid;
    grid-template-columns: 88px 1fr auto;
    gap: 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem;
    position: relative;
}

.cart-line__cover {
    width: 88px;
    aspect-ratio: 3/4;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}

.cart-line__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-line__body h3 {
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.cart-line__meta {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-bottom: 0.65rem;
}

.cart-line__form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.65rem;
    align-items: end;
}

.cart-line__field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cart-line__field span {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.cart-line__field select,
.cart-line__field input[type="number"] {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    padding: 0.45rem 0.55rem;
    font-size: 0.84rem;
}

.qty-control {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.2rem;
}

.qty-control__btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    cursor: pointer;
    font-size: 1rem;
}

.qty-control input {
    width: 42px;
    text-align: center;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
}

.cart-line__price {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cart-line__price--total strong {
    color: var(--red-400);
}

.cart-line__actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.cart-line__actions .btn--ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.cart-line__actions .btn--ghost:hover {
    background: rgba(220, 38, 38, 0.12);
    border-color: rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.cart-line__remove {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(220, 38, 38, 0.12);
    color: #fecaca;
    cursor: pointer;
    font-size: 1.2rem;
}

.cart-summary {
    position: sticky;
    bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(42, 10, 18, 0.96), rgba(20, 6, 8, 0.98));
    border: 1px solid rgba(248, 113, 113, 0.18);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.cart-summary > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.cart-summary > div span {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.cart-summary strong {
    color: #fecaca;
    font-size: 1.1rem;
    font-weight: 800;
}

.cart-summary .btn--ghost {
    flex: 0 0 auto;
}

.cart-summary .btn--primary {
    flex: 1 1 180px;
    min-width: 160px;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.cart-empty {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.cart-empty__icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.cart-empty__error {
    color: #fecaca;
    margin-bottom: 0.75rem;
}

.header-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: background 0.2s, color 0.2s;
}

.header-cart:hover,
.header-cart.nav-link--active {
    background: rgba(220, 38, 38, 0.15);
    color: var(--text);
    border-color: rgba(220, 38, 38, 0.25);
}

.header-cart__badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--red-600), var(--red-400));
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bookstore-edition__footer {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn--cart {
    width: 100%;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9), rgba(239, 68, 68, 0.85));
    color: white;
    border: none;
}

.cart-toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 6, 8, 0.95);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: #bbf7d0;
    padding: 0.65rem 1rem;
    border-radius: 999px;
    z-index: 300;
    font-size: 0.84rem;
}

@media (max-width: 768px) {
    .cart-line {
        grid-template-columns: 72px 1fr;
    }

    .cart-line__remove-form {
        position: absolute;
        top: 0.65rem;
        left: 0.65rem;
    }

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