/* ==========================================================================
   Cart bottom sheet — cs- (2026-11-25)
   Markup: theme-views/layouts/partials/_cart-sheet.blade.php, logic: js/cart-sheet.js.
   The body inside is the cart page partial, styled by cart-page.css (loaded on first open);
   only sheet chrome, skeleton and in-sheet overrides live here.
   Mirror to public/themes/theme_aster/public/assets/css/ after editing.
   ========================================================================== */

#cartSheet {
    /* same palette as .ct-root so the skeleton matches before cart-page.css arrives */
    --cs-bg: #f6f2ec;
    --cs-surface: #fff;
    --cs-sunken: #efe7dc;
    --cs-shine: #f9f5ef;
    --cs-line: #ece4d9;
    --cs-ink: #1d1712;
    --cs-ink-3: #958878;
    --cs-brand: #4a2e1c;
    --cs-ease: cubic-bezier(.22, 1, .36, 1);
    position: fixed;
    inset: 0;
    z-index: 1046; /* over app top bar / tab bar / drawer (1045), under bootstrap modals (1050+) */
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
#cartSheet[hidden] { display: none; }
[theme="dark"] #cartSheet {
    --cs-bg: #15110d;
    --cs-surface: #1f1913;
    --cs-sunken: #2a221a;
    --cs-shine: #352b21;
    --cs-line: #2f271f;
    --cs-ink: #f3ece2;
    --cs-ink-3: #8e806f;
    --cs-brand: #e3b877;
}

.cs-scrim {
    position: absolute;
    inset: 0;
    background: rgba(18, 12, 8, .46);
    opacity: 0;
    transition: opacity .28s ease;
}
#cartSheet.is-open .cs-scrim { opacity: 1; }

.cs-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    inline-size: 100%;
    max-inline-size: 1180px;
    max-block-size: 92vh;
    max-block-size: 92dvh;
    min-block-size: min(62dvh, 560px);
    background: var(--cs-bg);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 50px -12px rgba(18, 12, 8, .35);
    overflow: hidden;
    outline: none;
    transform: translateY(100%);
    transition: transform .42s var(--cs-ease);
    will-change: transform;
}
#cartSheet.is-open .cs-panel { transform: translateY(0); }
#cartSheet.is-dragging .cs-panel { transition: none; }

.cs-top {
    position: relative;
    flex: none;
    block-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    cursor: grab;
}
.cs-grab {
    inline-size: 42px;
    block-size: 5px;
    border-radius: 99px;
    background: color-mix(in srgb, var(--cs-ink) 22%, transparent);
}
.cs-close {
    position: absolute;
    inset-block-start: 10px;
    inset-inline-end: 12px;
    z-index: 2;
    inline-size: 36px;
    block-size: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--cs-line);
    border-radius: 50%;
    background: var(--cs-surface);
    color: var(--cs-ink);
    font-size: 14px;
    cursor: pointer;
    transition: transform .15s;
}
.cs-close:active { transform: scale(.92); }

.cs-scroll {
    flex: 1 1 auto;
    min-block-size: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--cs-bg);
    /* .ct-root page padding is too tall for a sheet */
    padding-block: 0 20px !important;
}

/* ---------- states ---------- */
#cartSheet .cs-body { display: none; }
#cartSheet[data-state="ready"] .cs-body { display: block; animation: cs-in .32s var(--cs-ease); }
#cartSheet[data-state="ready"] .cs-skel,
#cartSheet[data-state="error"] .cs-skel { display: none; }
#cartSheet[data-state="error"] .cs-error { display: flex; }
@keyframes cs-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- skeleton (mirrors the ct- layout) ---------- */
.cs-skel .container, #cartSheet .cs-body .container { max-inline-size: none; inline-size: 100%; padding-inline: 18px; }
.cs-skel-head { display: flex; flex-direction: column; gap: 10px; padding-block: 4px 16px; padding-inline-end: 44px; }
.cs-skel-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.cs-skel-card {
    background: var(--cs-surface);
    border: 1px solid var(--cs-line);
    border-radius: 16px;
    padding: 14px 16px;
}
.cs-skel-row {
    display: grid;
    grid-template-columns: 20px 82px minmax(0, 1fr);
    gap: 12px;
    padding-block: 14px;
    border-block-start: 1px solid var(--cs-line);
}
.cs-skel-lines { display: flex; flex-direction: column; gap: 9px; min-inline-size: 0; }
.cs-skel-foot { display: flex; justify-content: space-between; align-items: center; margin-block-start: auto; }
.cs-skel-kv { display: flex; justify-content: space-between; margin-block: 10px; }
.cs-skel-kv .cs-sh { block-size: 14px; }

.cs-sh {
    display: block;
    border-radius: 7px;
    background: linear-gradient(90deg, var(--cs-sunken) 0%, var(--cs-sunken) 35%, var(--cs-shine) 50%, var(--cs-sunken) 65%, var(--cs-sunken) 100%);
    background-size: 300% 100%;
    animation: cs-shimmer 1.3s linear infinite;
}
[dir="rtl"] .cs-sh { animation-direction: reverse; }
.cs-sh-chk { inline-size: 20px; block-size: 20px; border-radius: 6px; margin-block-start: 44px; }
.cs-sh-cover { inline-size: 82px; block-size: 122px; border-radius: 4px 9px 9px 4px; }
@keyframes cs-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

@media (min-width: 992px) {
    .cs-skel-grid { grid-template-columns: minmax(0, 1fr) 330px; }
    .cs-skel .container, #cartSheet .cs-body .container { padding-inline: 26px; }
}
@media (prefers-reduced-motion: reduce) {
    .cs-sh { animation: none; }
    .cs-panel { transition-duration: .01s; }
}

/* ---------- error ---------- */
.cs-error {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 48px 20px;
    color: var(--cs-ink-3);
}
.cs-error > i { font-size: 38px; color: var(--cs-brand); }
.cs-error p { margin: 0 0 6px; font-size: 15px; color: var(--cs-ink); }
.cs-error-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.cs-error .ct-btn {
    display: inline-flex; align-items: center; min-block-size: 44px; padding: 0 18px;
    border-radius: 12px; border: 1px solid var(--cs-line); font-weight: 700; text-decoration: none;
    background: var(--cs-surface); color: var(--cs-ink);
}
.cs-error .ct-btn-primary { background: var(--cs-brand); border-color: var(--cs-brand); color: #fff; }

/* ---------- the cart page body inside the sheet ---------- */
#cartSheet .ct-head { padding-inline-end: 44px; } /* room for the close button */
#cartSheet .ct-side { top: 8px; }                  /* sticky inside the sheet, not under the site header */
#cartSheet .ct-root,
#cartSheet .cs-scroll { --ct-appbar: 0px !important; }
/* phone checkout bar: pinned to the sheet's bottom edge (there is no tab bar under the sheet) */
#cartSheet .ct-sticky { bottom: env(safe-area-inset-bottom, 0px) !important; }
body.app-design #cartSheet .ct-sticky { bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important; }
@media (max-width: 767.98px) {
    .cs-panel { border-radius: 20px 20px 0 0; }
    #cartSheet .cs-scroll:has(.ct-sticky) { padding-block-end: 96px !important; }
}

/* page behind the sheet */
html.cs-lock, html.cs-lock body { overflow: hidden !important; }
html.cs-lock .social-chat-icons,
html.cs-lock #lt-help-card { visibility: hidden; }
