/* ============================================================
   Off-Canvas Cart — Styles
   Light, refined aesthetic. Avada-safe (no global resets).
   ============================================================ */

/* ----------------------------------------------------------
   Custom properties
   ---------------------------------------------------------- */
:root {
    /*
     * Mapped to Avada's global colour palette (Avada > Options > Color Palette).
     * Avada outputs --awb-color1 through --awb-color8 globally.
     * Fallbacks are safe defaults if variables are not yet defined.
     *
     * Assumed palette mapping:
     *   color1 = lightest (white/near-white)  -> drawer background
     *   color2 = light grey                   -> surfaces
     *   color3 = mid-light grey               -> borders
     *   color4 = red                          -> accent / CTA / badge
     *   color5 = mid grey                     -> soft text
     *   color6 = dark grey                    -> secondary text
     *   color7 = darker grey                  -> (available if needed)
     *   color8 = black                        -> pill bg, primary text
     */
    --occ-white:       var(--awb-color1, #ffffff);
    --occ-surface:     var(--awb-color2, #f7f8fa);
    --occ-border:      var(--awb-color3, #e0e2e6);
    --occ-border-soft: color-mix(in srgb, var(--awb-color3, #e0e2e6) 50%, transparent);

    --occ-text:        var(--awb-color8, #1a1a1a);
    --occ-text-mid:    var(--awb-color6, #5a5a5a);
    --occ-text-soft:   var(--awb-color5, #909090);

    --occ-accent:      var(--awb-color4, #cc0000);
    --occ-accent-hov:  color-mix(in srgb, var(--awb-color4, #cc0000) 80%, black);
    --occ-accent-lite: color-mix(in srgb, var(--awb-color4, #cc0000) 10%, white);

    --occ-pill-bg:     var(--awb-color8, #1a1a1a);
    --occ-pill-text:   var(--awb-color1, #ffffff);
    --occ-pill-badge:  var(--awb-color4, #cc0000);

    --occ-radius:      14px;
    --occ-radius-sm:   8px;
    --occ-shadow:      0 8px 40px rgba(0, 0, 0, 0.10);
    --occ-shadow-pill: 0 4px 20px rgba(0, 0, 0, 0.20);

    --occ-drawer-w:    380px;
    --occ-ease:        cubic-bezier(0.25, 0.8, 0.25, 1);
    --occ-ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* ----------------------------------------------------------
   Overlay
   ---------------------------------------------------------- */
#occ-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(28, 30, 42, 0.35);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--occ-ease);
}

#occ-overlay.occ-open {
    opacity: 1;
    pointer-events: auto;
}

/* ----------------------------------------------------------
   Floating pill
   ---------------------------------------------------------- */
#occ-pill {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 0;
    height: 50px;
    padding: 0;
    border: none;
    border-radius: 25px;
    background: var(--occ-pill-bg);
    box-shadow: var(--occ-shadow-pill);
    cursor: pointer;
    font-family: inherit;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.15s;
    user-select: none;
}

#occ-pill:hover {
    box-shadow: 0 6px 30px rgba(28, 30, 42, 0.32);
    transform: translateY(-1px);
}

#occ-pill:active {
    transform: scale(0.96);
}

#occ-pill:focus-visible {
    outline: 2px solid var(--occ-accent);
    outline-offset: 3px;
}

.occ-pill-left {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 16px 0 18px;
    height: 100%;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.occ-pill-icon {
    width: 17px;
    height: 17px;
    color: rgba(255, 255, 255, 0.75);
    flex-shrink: 0;
}

.occ-pill-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--occ-pill-text);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.occ-pill-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    margin: 0 11px;
    padding: 0 6px;
    border-radius: 14px;
    background: var(--occ-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    transition: transform 0.3s var(--occ-ease-spring),
                background 0.2s;
}

#occ-pill[data-empty="true"] .occ-pill-badge {
    background: rgba(255, 255, 255, 0.15);
}

/* Bounce animation when item added */
@keyframes occ-pill-bounce {
    0%   { transform: scale(1) translateY(0); }
    28%  { transform: scale(1.06) translateY(-5px); }
    55%  { transform: scale(0.97) translateY(2px); }
    75%  { transform: scale(1.02) translateY(-2px); }
    100% { transform: scale(1) translateY(0); }
}

@keyframes occ-badge-pop {
    0%   { transform: scale(1); }
    45%  { transform: scale(1.55); }
    70%  { transform: scale(0.88); }
    100% { transform: scale(1); }
}

#occ-pill.occ-bounce {
    animation: occ-pill-bounce 0.52s var(--occ-ease-spring) forwards;
}

#occ-pill.occ-bounce .occ-pill-badge {
    animation: occ-badge-pop 0.38s var(--occ-ease-spring) forwards;
}

/* ----------------------------------------------------------
   Drawer
   ---------------------------------------------------------- */
#occ-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;

    /* WordPress admin bar offsets — admin bar is 32px desktop, 46px mobile */
    width: var(--occ-drawer-w);
    max-width: 100vw;
    background: var(--occ-white);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s var(--occ-ease);
    box-shadow: -12px 0 60px rgba(28, 30, 42, 0.14);
    outline: none;
}

#occ-drawer.occ-open {
    transform: translateX(0);
}

/* Header */
.occ-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--occ-border);
    flex-shrink: 0;
    background: var(--occ-white);
}

.occ-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--occ-text);
}

.occ-drawer-title svg {
    width: 17px;
    height: 17px;
    color: var(--occ-accent);
    flex-shrink: 0;
}

.occ-drawer-badge {
    background: var(--occ-accent-lite);
    color: var(--occ-accent);
    font-size: 11px;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 8px;
    font-family: inherit;
    line-height: 1.4;
}

.occ-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--occ-border);
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    color: var(--occ-text-mid);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.occ-close svg {
    width: 14px;
    height: 14px;
}

.occ-close:hover {
    background: var(--occ-surface);
    color: var(--occ-text);
    border-color: var(--occ-text-soft);
}

.occ-close:focus-visible {
    outline: 2px solid var(--occ-accent);
    outline-offset: 2px;
}

/* Scrollable body */
.occ-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0;
}

.occ-drawer-body::-webkit-scrollbar {
    width: 4px;
}

.occ-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

.occ-drawer-body::-webkit-scrollbar-thumb {
    background: var(--occ-border);
    border-radius: 2px;
}

/* ----------------------------------------------------------
   Cart items
   ---------------------------------------------------------- */
.occ-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--occ-border-soft);
    animation: occ-item-in 0.22s ease forwards;
    position: relative;
}

@keyframes occ-item-in {
    from { opacity: 0; transform: translateX(10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.occ-item:last-child {
    border-bottom: none;
}

/* Product thumbnail */
.occ-item-thumb {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    border-radius: var(--occ-radius-sm);
    border: 1px solid var(--occ-border);
    overflow: hidden;
    background: var(--occ-surface);
}

.occ-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Item text */
.occ-item-info {
    flex: 1;
    min-width: 0;
}

.occ-item-name {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--occ-text);
    margin: 0 0 3px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.occ-item-price {
    font-size: 12px;
    color: var(--occ-text-soft);
    margin: 0 0 10px;
}

.occ-item-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Qty stepper */
.occ-qty {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--occ-surface);
    border: 1px solid var(--occ-border);
    border-radius: 20px;
    padding: 2px;
}

.occ-qty-btn {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--occ-text-mid);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.12s, color 0.12s;
}

.occ-qty-btn:hover {
    background: var(--occ-white);
    color: var(--occ-accent);
}

.occ-qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.occ-qty-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--occ-text);
    min-width: 22px;
    text-align: center;
}

.occ-item-linetotal {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--occ-text);
}

/* Remove button */
.occ-remove {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--occ-text-soft);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.12s, color 0.12s;
    padding: 0;
}

.occ-remove svg {
    width: 13px;
    height: 13px;
    pointer-events: none;
}

.occ-remove:hover {
    background: #fef0f0;
    color: #e05252;
}

/* ----------------------------------------------------------
   Empty state
   ---------------------------------------------------------- */
.occ-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px 48px;
    gap: 12px;
    text-align: center;
}

.occ-empty svg {
    width: 44px;
    height: 44px;
    color: var(--occ-border);
}

.occ-empty p {
    font-size: 14px;
    color: var(--occ-text-soft);
    margin: 0;
}

.occ-shop-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--occ-accent);
    text-decoration: none;
    border-bottom: 1px solid var(--occ-accent-lite);
    padding-bottom: 1px;
    transition: border-color 0.15s;
}

.occ-shop-link:hover {
    border-color: var(--occ-accent);
    color: var(--occ-accent-hov);
}

/* ----------------------------------------------------------
   Loading state
   ---------------------------------------------------------- */
.occ-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

@keyframes occ-spin {
    to { transform: rotate(360deg); }
}

.occ-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--occ-border);
    border-top-color: var(--occ-accent);
    border-radius: 50%;
    animation: occ-spin 0.6s linear infinite;
}

/* ----------------------------------------------------------
   Drawer footer
   ---------------------------------------------------------- */
.occ-drawer-footer {
    padding: 16px 22px 22px;
    border-top: 1px solid var(--occ-border);
    background: var(--occ-white);
    flex-shrink: 0;
}

.occ-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.occ-subtotal span {
    font-size: 13px;
    color: var(--occ-text-soft);
}

.occ-subtotal strong {
    font-size: 20px;
    font-weight: 700;
    color: var(--occ-text);
}

.occ-tax-note {
    font-size: 11px;
    color: var(--occ-text-soft);
    margin: 0 0 14px;
}

.occ-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    background: var(--occ-accent);
    color: #fff !important;
    border: none;
    border-radius: var(--occ-radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    letter-spacing: 0.02em;
}

.occ-checkout-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.occ-checkout-btn:hover {
    background: var(--occ-accent-hov);
    color: #fff !important;
    transform: translateY(-1px);
}

.occ-checkout-btn:active {
    transform: scale(0.98);
}

.occ-view-cart-link {
    display: block;
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: var(--occ-text-soft);
    text-decoration: none;
    transition: color 0.15s;
}

.occ-view-cart-link:hover {
    color: var(--occ-accent);
}

/* ----------------------------------------------------------
   WordPress admin bar offset
   WP adds .admin-bar to <body> when the bar is visible.
   Desktop bar = 32px, mobile bar = 46px (≤782px).
   ---------------------------------------------------------- */
.admin-bar #occ-drawer {
    top: 32px;
}

.admin-bar #occ-overlay {
    top: 32px;
}

@media screen and (max-width: 782px) {
    .admin-bar #occ-drawer,
    .admin-bar #occ-overlay {
        top: 46px;
    }
}

/* WP hides the admin bar entirely below 600px */
@media screen and (max-width: 600px) {
    .admin-bar #occ-drawer,
    .admin-bar #occ-overlay {
        top: 0;
    }
}

/* ----------------------------------------------------------
   Responsive — full-width drawer on small screens
   ---------------------------------------------------------- */
@media (max-width: 440px) {
    :root {
        --occ-drawer-w: 100vw;
    }

    #occ-pill {
        bottom: 20px;
        right: 16px;
    }
}

/* ----------------------------------------------------------
   Avada compatibility — reset any theme interference
   ---------------------------------------------------------- */
#occ-pill *,
#occ-drawer * {
    box-sizing: border-box;
}

#occ-drawer p {
    margin-bottom: 0;
}

#occ-drawer a {
    text-decoration: none;
}

/* WooCommerce price tag inside drawer */
#occ-drawer .woocommerce-Price-amount {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}
