/* Cart page (pages/cart.php), drawn on the Cart page of the prototype. Page chrome, background and heading in page.css.
   Sizes in px: the theme sets html to 15px. */

.courseshop-cart .cs-cart-grid {
    display: grid;
    gap: 32px;
}

/* Courses. */

.courseshop-cart .cs-cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.courseshop-cart .cs-cart-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: var(--cs-shadow-md);
}

.courseshop-cart .cs-cart-item-media {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    overflow: hidden;
    border-radius: 6px;
    background-color: var(--cs-slate-100);
}

.courseshop-cart .cs-cart-item-media img {
    display: block;
    width: 64px;
    height: 64px;
    max-width: none;
    object-fit: cover;
}

.courseshop-cart .cs-cart-item-body {
    flex: 1;
    min-width: 0;
}

.courseshop-cart .cs-cart-item-category {
    color: var(--cs-primary);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.courseshop-cart .cs-cart-item-title {
    display: block;
    color: var(--cs-slate-900);
    font-family: var(--cs-font-heading);
    font-weight: 700;
    text-decoration: none;
}

.courseshop-cart .cs-cart-item-title:hover,
.courseshop-cart .cs-cart-item-title:focus {
    color: var(--cs-slate-900);
    text-decoration: none;
}

.courseshop-cart .cs-cart-item-price {
    color: var(--cs-slate-500);
    font-size: 14px;
    line-height: 20px;
}

.courseshop-cart .cs-cart-item-remove {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: var(--cs-slate-400);
    font-size: 14px;
    text-decoration: none;
    transition: background-color .15s ease;
}

.courseshop-cart .cs-cart-item-remove:hover,
.courseshop-cart .cs-cart-item-remove:focus {
    background-color: var(--cs-accent);
    color: var(--cs-slate-400);
    text-decoration: none;
}

/* Empty cart. */

.courseshop-cart .cs-cart-empty {
    max-width: 448px;
    margin: 0 auto;
    padding: 40px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: var(--cs-shadow-md);
    text-align: center;
}

.courseshop-cart .cs-cart-empty-icon {
    display: block;
    margin: 0 auto;
    color: #cbd5e1;
}

.courseshop-cart .cs-cart-empty-text {
    margin-top: 16px;
    color: var(--cs-slate-500);
}

.courseshop-cart .cs-cart-empty-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    margin-top: 24px;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: var(--cs-primary);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
    color: hsl(210 60% 99%);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease;
}

.courseshop-cart .cs-cart-empty-link:hover,
.courseshop-cart .cs-cart-empty-link:focus {
    background-color: hsl(211 90% 42% / .9);
    color: hsl(210 60% 99%);
    text-decoration: none;
}

/* Order summary. */

.courseshop-cart .cs-cart-summary {
    height: fit-content;
    padding: 24px;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: var(--cs-shadow-lg);
}

.courseshop-cart .cs-cart-summary-title {
    color: var(--cs-slate-900);
    font-family: var(--cs-font-heading);
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    letter-spacing: .025em;
    text-transform: uppercase;
}

.courseshop-cart .cs-cart-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    font-size: 14px;
    line-height: 20px;
}

.courseshop-cart .cs-cart-row {
    display: flex;
    justify-content: space-between;
    color: var(--cs-slate-500);
}

.courseshop-cart .cs-cart-strike {
    text-decoration: line-through;
}

.courseshop-cart .cs-cart-strong {
    color: var(--cs-slate-900);
    font-weight: 600;
}

.courseshop-cart .cs-cart-row-discount {
    color: var(--cs-emerald-600);
}

.courseshop-cart .cs-cart-row-total {
    padding-top: 12px;
    border-top: 1px solid var(--cs-slate-100);
    color: var(--cs-slate-900);
    font-family: var(--cs-font-heading);
    font-size: 18px;
    font-weight: 700;
    line-height: 28px;
}

.courseshop-cart .cs-cart-vat {
    color: var(--cs-slate-500);
    font-size: 12px;
    line-height: 16px;
}

.courseshop-cart .cs-cart-next {
    margin-top: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: var(--cs-emerald-50);
    box-shadow: 0 0 0 1px var(--cs-emerald-200);
    color: var(--cs-emerald-700);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
}

.courseshop-cart .cs-cart-request {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 36px;
    margin-top: 24px;
    padding: 8px 16px;
    border-radius: 6px;
    background-color: var(--cs-teal-600);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
    color: hsl(210 60% 99%);
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color .15s ease;
}

.courseshop-cart .cs-cart-request:hover,
.courseshop-cart .cs-cart-request:focus {
    background-color: var(--cs-teal-700);
    color: hsl(210 60% 99%);
    text-decoration: none;
}

@media (min-width: 1024px) {
    .courseshop-cart .cs-cart-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .courseshop-cart .cs-cart-items {
        grid-column: span 2 / span 2;
    }

    .courseshop-cart .cs-cart-summary {
        position: sticky;
        top: 96px;
    }
}

/* On a phone the order summary of a cart with one course sits at the bottom of the screen, where the toast
   of a removal would cover the total: here the toast goes at the top, below the header (54px) and its cart,
   like the toasts of the prototype on narrow screens. */
@media (max-width: 639.98px) {
    #page-local-courseshop-pages-cart .local-courseshop-toasts {
        top: 54px;
        bottom: auto;
    }
}
