/**
 * Rivmedia Woo CTA Features — Frontend Styles
 * @version 2.1.0
 */

/* ================================================================
   SHARED
   ================================================================ */
.rmcta-cta {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
    z-index: 99999;
}

.rmcta-cta *, .rmcta-cta *::before, .rmcta-cta *::after {
    box-sizing: inherit;
}

.rmcta-thumb {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.08);
}

.rmcta-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--rmcta-title-colour, #222);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.rmcta-selection {
    font-size: 12px;
    color: var(--rmcta-selection-colour, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    min-height: 17px;
    display: block;
}

.rmcta-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--rmcta-price-colour, #b71c1c);
    white-space: nowrap;
    line-height: 1;
}

.rmcta-price .woocommerce-Price-amount,
.rmcta-price .amount,
.rmcta-price bdi {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
}

.rmcta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    background: var(--rmcta-btn-bg, #b71c1c);
    color: var(--rmcta-btn-text, #fff);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s ease, transform 0.15s ease;
    line-height: 1;
    font-family: inherit;
}

.rmcta-btn:hover,
.rmcta-btn:focus-visible {
    background: var(--rmcta-btn-bg-hover, #8e0000);
    transform: translateY(-1px);
    outline: none;
}

.rmcta-btn:active {
    transform: translateY(0);
}

.rmcta-btn.is-adding {
    pointer-events: none;
    opacity: 0.7;
}

/* Quantity control */
.rmcta-qty-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.rmcta-qty-btn {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
    font-family: inherit;
}

.rmcta-qty-btn:hover {
    background: #e0e0e0;
}

.rmcta-qty-value {
    width: 36px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    line-height: 32px;
    color: var(--rmcta-title-colour, #222);
}

/* Price flash animation */
@keyframes rmcta-price-flash {
    0%   { color: var(--rmcta-price-colour, #b71c1c); }
    30%  { color: #ff5722; }
    100% { color: var(--rmcta-price-colour, #b71c1c); }
}

.rmcta-price.is-updated {
    animation: rmcta-price-flash 0.5s ease;
}


/* ================================================================
   STICKY BAR
   ================================================================ */
.rmcta-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--rmcta-bar-bg, #fff);
    border-top: 2px solid var(--rmcta-bar-border, #b71c1c);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    pointer-events: none;
    will-change: transform, opacity;
}

/* Animation hidden states */
.rmcta-sticky-bar.rmcta-anim-slide_up {
    transform: translateY(100%);
    opacity: 0;
    transition: transform var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.rmcta-sticky-bar.rmcta-anim-fade {
    opacity: 0;
    transition: opacity var(--rmcta-anim-speed, 350ms) ease;
}

.rmcta-sticky-bar.rmcta-anim-slide_right {
    transform: translateX(100%);
    opacity: 0;
    transition: transform var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Visible state */
.rmcta-sticky-bar.is-visible {
    transform: translate(0, 0);
    opacity: 1;
    pointer-events: auto;
}

.rmcta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    gap: 16px;
}

.rmcta-product {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

.rmcta-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rmcta-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

/* Sticky bar responsive */
@media (max-width: 768px) {
    .rmcta-inner {
        padding: 8px 14px;
        gap: 10px;
    }
    .rmcta-thumb {
        width: 40px;
        height: 40px;
    }
    .rmcta-title { font-size: 13px; }
    .rmcta-price { font-size: 16px; }
    .rmcta-btn { padding: 10px 18px; font-size: 13px; }
}

@media (max-width: 480px) {
    .rmcta-inner {
        padding: 8px 10px;
        gap: 8px;
    }
    .rmcta-product { max-width: 45%; }
    .rmcta-sticky-bar .rmcta-thumb { display: none; }
    .rmcta-title { font-size: 12px; }
    .rmcta-selection { font-size: 11px; }
    .rmcta-price { font-size: 15px; }
    .rmcta-btn { padding: 10px 14px; font-size: 12px; }
}


/* ================================================================
   FLOATING BUTTON
   ================================================================ */
.rmcta-floating {
    position: fixed;
    bottom: 24px;
    pointer-events: none;
}

.rmcta-float-right { right: 24px; }
.rmcta-float-left  { left: 24px; }

.rmcta-float-trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--rmcta-btn-bg, #b71c1c);
    color: var(--rmcta-btn-text, #fff);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.rmcta-float-trigger:hover {
    background: var(--rmcta-btn-bg-hover, #8e0000);
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

/* Hidden states for floating button */
.rmcta-floating.rmcta-anim-slide_up .rmcta-float-trigger {
    transform: translateY(80px);
    opacity: 0;
    transition: transform var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.rmcta-floating.rmcta-anim-fade .rmcta-float-trigger {
    opacity: 0;
    transition: opacity var(--rmcta-anim-speed, 350ms) ease;
}

.rmcta-floating.rmcta-anim-slide_right .rmcta-float-trigger {
    transform: translateX(80px);
    opacity: 0;
    transition: transform var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1),
                opacity var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.rmcta-floating.is-visible .rmcta-float-trigger {
    transform: translate(0, 0);
    opacity: 1;
}

/* Popout card */
.rmcta-float-popout {
    position: absolute;
    bottom: 68px;
    background: var(--rmcta-bar-bg, #fff);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    padding: 16px;
    min-width: 260px;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s, transform 0.2s;
    visibility: hidden;
}

.rmcta-float-right .rmcta-float-popout { right: 0; }
.rmcta-float-left  .rmcta-float-popout { left: 0; }

.rmcta-float-popout.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.rmcta-float-popout-inner {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rmcta-float-popout .rmcta-btn {
    width: 100%;
    margin-top: 4px;
}


/* ================================================================
   SLIDE DRAWER
   ================================================================ */
.rmcta-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.rmcta-drawer-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.rmcta-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--rmcta-drawer-width, 380px);
    max-width: 90vw;
    background: var(--rmcta-bar-bg, #fff);
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    overflow-y: auto;
    transition: transform var(--rmcta-anim-speed, 350ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.rmcta-drawer-right {
    right: 0;
    transform: translateX(100%);
}

.rmcta-drawer-left {
    left: 0;
    transform: translateX(-100%);
}

.rmcta-drawer.is-open {
    transform: translateX(0);
}

.rmcta-drawer-inner {
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rmcta-drawer-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 4px;
    transition: color 0.15s;
}

.rmcta-drawer-close:hover { color: #222; }

.rmcta-drawer-thumb {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(0,0,0,0.06);
}

.rmcta-drawer .rmcta-title {
    font-size: 18px;
    white-space: normal;
}

.rmcta-drawer-price {
    font-size: 22px;
}

.rmcta-drawer-btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 8px;
}

/* Drawer edge tab */
.rmcta-drawer-tab {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    writing-mode: vertical-rl;
    background: var(--rmcta-btn-bg, #b71c1c);
    color: var(--rmcta-btn-text, #fff);
    border: none;
    padding: 14px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 99997;
    transition: background 0.2s, opacity var(--rmcta-anim-speed, 350ms);
    opacity: 0;
    pointer-events: none;
    font-family: inherit;
}

.rmcta-drawer-tab svg {
    transform: rotate(90deg);
}

.rmcta-drawer-tab-right {
    right: 0;
    border-radius: 6px 0 0 6px;
}

.rmcta-drawer-tab-left {
    left: 0;
    border-radius: 0 6px 6px 0;
}

.rmcta-drawer-tab:hover {
    background: var(--rmcta-btn-bg-hover, #8e0000);
}

.rmcta-drawer-tab.is-visible {
    opacity: 1;
    pointer-events: auto;
}


/* ================================================================
   PRINT
   ================================================================ */
@media print {
    .rmcta-cta,
    .rmcta-drawer-overlay,
    .rmcta-drawer-tab {
        display: none !important;
    }
}
