/* ==========================================================================
   RT SlideCart Lite - frontend styles.
   Everything is namespaced .rtcl-* and driven by CSS custom properties that
   src/Assets.php writes from the design settings, so the admin can restyle the
   whole drawer without a single line of custom CSS.
   ========================================================================== */

#rtcl-root {
    position: fixed;
    inset: 0;
    z-index: 10500;
    pointer-events: none;
    visibility: hidden;
    font-family: var(--rtcl-font, inherit);
}

#rtcl-root.is-open {
    pointer-events: auto;
    visibility: visible;
}

#rtcl-root[data-rtcl="off"] { display: none !important; }

/* --- backdrop ------------------------------------------------------------ */

.rtcl-backdrop {
    position: absolute;
    inset: 0;
    background: var(--rtcl-backdrop, rgba(0, 0, 0, .45));
    backdrop-filter: blur(var(--rtcl-backdrop-blur, 0px));
    -webkit-backdrop-filter: blur(var(--rtcl-backdrop-blur, 0px));
    opacity: 0;
    transition: opacity var(--rtcl-anim, 280ms) ease;
}

#rtcl-root.is-open .rtcl-backdrop { opacity: 1; }

/* --- panel --------------------------------------------------------------- */

.rtcl-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: var(--rtcl-width, 420px);
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--rtcl-bg, #fff);
    color: var(--rtcl-text, #111827);
    font-size: var(--rtcl-font-size, 15px);
    line-height: 1.45;
    box-shadow: var(--rtcl-shadow, 0 10px 40px rgba(0, 0, 0, .18));
    transition: transform var(--rtcl-anim, 280ms) cubic-bezier(.22, .61, .36, 1),
                opacity var(--rtcl-anim, 280ms) ease;
    outline: none;
}

.rtcl-panel.rtcl-right {
    right: 0;
    transform: translateX(100%);
    border-top-left-radius: var(--rtcl-radius, 12px);
    border-bottom-left-radius: var(--rtcl-radius, 12px);
}

.rtcl-panel.rtcl-left {
    left: 0;
    transform: translateX(-100%);
    border-top-right-radius: var(--rtcl-radius, 12px);
    border-bottom-right-radius: var(--rtcl-radius, 12px);
}

#rtcl-root.is-open .rtcl-panel { transform: translateX(0); }

/* animation styles */
#rtcl-root.rtcl-anim-fade .rtcl-panel { transform: none; opacity: 0; }
#rtcl-root.rtcl-anim-fade.is-open .rtcl-panel { opacity: 1; }

#rtcl-root.rtcl-anim-scale .rtcl-panel { transform: scale(.96); opacity: 0; transform-origin: right center; }
#rtcl-root.rtcl-anim-scale .rtcl-panel.rtcl-left { transform-origin: left center; }
#rtcl-root.rtcl-anim-scale.is-open .rtcl-panel { transform: scale(1); opacity: 1; }

.rtcl-panel.is-busy { opacity: .6; pointer-events: none; }

html.rtcl-no-scroll,
html.rtcl-no-scroll body { overflow: hidden; }

/* --- areas --------------------------------------------------------------- */

.rtcl-top { flex: 0 0 auto; border-bottom: var(--rtcl-divider, 1px solid var(--rtcl-border)); }

.rtcl-body {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: var(--rtcl-pad, 12px 16px);
    display: flex;
    flex-direction: column;
    gap: var(--rtcl-gap, 12px);
}

.rtcl-foot {
    flex: 0 0 auto;
    border-top: 1px solid var(--rtcl-border, #e5e7eb);
    padding: var(--rtcl-pad, 12px 16px);
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--rtcl-bg, #fff);
}

/* --- header -------------------------------------------------------------- */

.rtcl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: var(--rtcl-pad, 12px 16px);
}

.rtcl-panel.rtcl-head-filled .rtcl-header {
    background: var(--rtcl-accent, #111827);
    color: var(--rtcl-accent-txt, #fff);
}

.rtcl-panel.rtcl-head-filled .rtcl-close { color: var(--rtcl-accent-txt, #fff); }

.rtcl-panel.rtcl-head-filled .rtcl-count {
    background: var(--rtcl-accent-txt, #fff);
    color: var(--rtcl-accent, #111827);
}

.rtcl-title {
    font-weight: var(--rtcl-heading-weight, 600);
    font-size: var(--rtcl-heading-size, 17px);
}

.rtcl-count {
    display: inline-block;
    min-width: 22px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--rtcl-badge-bg, #111827);
    color: var(--rtcl-badge-txt, #fff);
    font-size: .75em;
    text-align: center;
    line-height: 22px;
    font-weight: 600;
}

.rtcl-close {
    border: 0;
    background: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--rtcl-muted, #6b7280);
    padding: 0 4px;
}

.rtcl-close:hover { color: var(--rtcl-text, #111827); }

.rtcl-announce {
    padding: 8px 16px;
    font-size: .9em;
    text-align: center;
}

.rtcl-countdown {
    padding: 7px 16px;
    font-size: .85em;
    color: var(--rtcl-muted, #6b7280);
    text-align: center;
    background: var(--rtcl-surface-alt, #f9fafb);
}

.rtcl-countdown b {
    color: var(--rtcl-text, #111827);
    font-variant-numeric: tabular-nums;
}

/* --- items --------------------------------------------------------------- */

.rtcl-items { list-style: none; margin: 0; padding: 0; }

.rtcl-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: var(--rtcl-item-pad, 12px) 0;
    border-bottom: var(--rtcl-divider, 1px solid var(--rtcl-border));
}

.rtcl-item:last-child { border-bottom: 0; }

.rtcl-panel.rtcl-items-card .rtcl-items { display: flex; flex-direction: column; gap: var(--rtcl-gap, 12px); }

.rtcl-panel.rtcl-items-card .rtcl-item {
    border: 1px solid var(--rtcl-border, #e5e7eb);
    border-radius: var(--rtcl-radius, 12px);
    padding: var(--rtcl-item-pad, 12px);
    background: var(--rtcl-bg, #fff);
}

.rtcl-item.is-gift { background: var(--rtcl-surface-alt, #f9fafb); }

.rtcl-thumb {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    display: block;
    border-radius: var(--rtcl-img-radius, 8px);
    overflow: hidden;
    background: var(--rtcl-surface-alt, #f3f4f6);
}

.rtcl-thumb img,
.rtcl-upsell img {
    width: 100%;
    height: 100%;
    object-fit: var(--rtcl-img-fit, contain);
    display: block;
}

.rtcl-thumb-ph {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--rtcl-surface-alt, #f3f4f6);
}

.rtcl-item-main { flex: 1 1 auto; min-width: 0; }

.rtcl-item-name {
    display: -webkit-box;
    color: inherit;
    text-decoration: none;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.rtcl-item-name:hover { color: var(--rtcl-accent, #111827); }

.rtcl-vars { font-size: .82em; color: var(--rtcl-muted, #6b7280); margin-top: 2px; }
.rtcl-var + .rtcl-var::before { content: " · "; }

.rtcl-gift-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: .75em;
    background: var(--rtcl-success, #16a34a);
    color: #fff;
}

.rtcl-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    gap: 8px;
}

.rtcl-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--rtcl-border, #e5e7eb);
    border-radius: var(--rtcl-btn-radius, 8px);
    overflow: hidden;
}

.rtcl-qty-btn {
    border: 0;
    background: none;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: var(--rtcl-text, #111827);
}

.rtcl-qty-btn:hover { background: var(--rtcl-surface-alt, #f9fafb); }

.rtcl-qty-input {
    width: 42px;
    height: 30px;
    border: 0;
    text-align: center;
    font-size: .9em;
    background: none;
    color: inherit;
}

.rtcl-qty-static { border: 0; color: var(--rtcl-muted, #6b7280); }

.rtcl-item-price {
    font-weight: var(--rtcl-price-weight, 600);
    color: var(--rtcl-price, #111827);
    white-space: nowrap;
}

.rtcl-remove {
    position: absolute;
    top: 8px;
    right: 0;
    border: 0;
    background: none;
    color: var(--rtcl-muted, #6b7280);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 4px;
}

.rtcl-remove:hover { color: var(--rtcl-danger, #dc2626); }

.rtcl-panel.rtcl-items-card .rtcl-remove { right: 6px; }

.rtcl-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--rtcl-muted, #6b7280);
}

.rtcl-empty .rtcl-btn { margin-top: 16px; }

/* --- footer -------------------------------------------------------------- */

.rtcl-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.05em;
    margin-bottom: 4px;
}

.rtcl-subtotal b { color: var(--rtcl-price, #111827); font-weight: var(--rtcl-price-weight, 600); }

.rtcl-taxnote {
    font-size: .78em;
    color: var(--rtcl-muted, #6b7280);
    margin-bottom: 10px;
}

.rtcl-actions { display: flex; flex-direction: column; gap: 8px; }

.rtcl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: var(--rtcl-btn-radius, 8px);
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    font-size: .95em;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.rtcl-btn-primary {
    background: var(--rtcl-accent, #111827);
    color: var(--rtcl-accent-txt, #fff);
}

.rtcl-btn-primary:hover { background: var(--rtcl-accent-hover, #1f2937); color: var(--rtcl-accent-txt, #fff); }

.rtcl-btn-ghost {
    background: transparent;
    border-color: var(--rtcl-border, #e5e7eb);
    color: var(--rtcl-text, #111827);
}

.rtcl-btn-ghost:hover { background: var(--rtcl-surface-alt, #f9fafb); color: var(--rtcl-text, #111827); }

.rtcl-btn-small { padding: 6px 12px; font-size: .82em; }

/* button styles */
.rtcl-panel.rtcl-btn-outline .rtcl-btn-primary {
    background: transparent;
    color: var(--rtcl-accent, #111827);
    border-color: var(--rtcl-accent, #111827);
}

.rtcl-panel.rtcl-btn-outline .rtcl-btn-primary:hover {
    background: var(--rtcl-accent, #111827);
    color: var(--rtcl-accent-txt, #fff);
}

.rtcl-panel.rtcl-btn-pill .rtcl-btn { border-radius: 999px; }

.rtcl-link {
    border: 0;
    background: none;
    color: var(--rtcl-muted, #6b7280);
    text-decoration: underline;
    cursor: pointer;
    font-size: .88em;
    font-family: inherit;
    padding: 4px;
}

.rtcl-link:hover { color: var(--rtcl-text, #111827); }

/* --- notices ------------------------------------------------------------- */

.rtcl-notices { padding: 8px 16px 0; }

.rtcl-notice {
    padding: 8px 10px;
    border-radius: var(--rtcl-btn-radius, 8px);
    font-size: .85em;
    margin-bottom: 6px;
}

.rtcl-notice-error   { background: color-mix(in srgb, var(--rtcl-danger, #dc2626) 12%, transparent); color: var(--rtcl-danger, #dc2626); }
.rtcl-notice-warning { background: #fef3c7; color: #92400e; }
.rtcl-notice-success { background: color-mix(in srgb, var(--rtcl-success, #16a34a) 14%, transparent); color: var(--rtcl-success, #16a34a); }

.rtcl-custom,
.rtcl-trust { font-size: .85em; }

/* --- mobile -------------------------------------------------------------- */

@media (max-width: 767px) {
    .rtcl-panel {
        width: var(--rtcl-width-mobile, 100%);
    }

    #rtcl-root.rtcl-mob-sheet .rtcl-panel {
        top: auto;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 88vh;
        transform: translateY(100%);
        border-radius: var(--rtcl-radius, 12px) var(--rtcl-radius, 12px) 0 0;
    }

    #rtcl-root.rtcl-mob-sheet.is-open .rtcl-panel { transform: translateY(0); }

    #rtcl-root.rtcl-mob-sheet .rtcl-panel::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 999px;
        background: var(--rtcl-border, #e5e7eb);
    }

    #rtcl-root.rtcl-mob-sheet .rtcl-header { padding-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .rtcl-panel,
    .rtcl-backdrop,
    .rtcl-bar-fill,
    .rtcl-sticky { transition: none; }
}

/* a long list at the bottom must never push the cart items out of view: the footer scrolls itself */
.rtcl-foot { max-height: 45%; overflow-y: auto; }


/* ---- free-shipping progress (one goal, light version) ----------------------------------------- */
.rtcl-free { padding: 0 16px 14px; }
.rtcl-free[hidden] { display: none; }
.rtcl-free-text { margin-bottom: 8px; font-size: .86em; font-weight: 600; color: var(--rtcl-text); }
.rtcl-free.is-reached .rtcl-free-text { color: var(--rtcl-progress, #16a34a); }
.rtcl-free-track { height: var(--rtcl-progress-h, 8px); border-radius: 999px; background: var(--rtcl-progress-track, #e5e7eb); overflow: hidden; }
.rtcl-free-fill { display: block; height: 100%; border-radius: 999px; background: var(--rtcl-progress, #16a34a); transition: width var(--rtcl-anim, 280ms) ease; }
@media (prefers-reduced-motion: reduce) { .rtcl-free-fill { transition: none; } }
