/* Q"CTA Frontend — Modern Floating CTA v2.1 */

/* ── CSS Variables (overridden inline by PHP) ────────────── */
:root {
    --qcta-btn-bg:  #ffffff;
    --qcta-accent:  #6C63FF;
    --qcta-mob-b:   65px;
    --qcta-dsk-b:   20px;
}

/* ── Container ───────────────────────────────────────────── */
.qcta-fab {
    position: fixed;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    /* Inherit font from theme — no override */
    font-family: inherit;
    direction: rtl;

    /* Default: bottom-right */
    bottom: var(--qcta-dsk-b);
    right:  20px;
    left:   auto;
    top:    auto;
}

/* Position variants applied by JS via data-pos attribute */
.qcta-fab[data-pos="bottom-left"] {
    right: auto;
    left:  20px;
    align-items: flex-start;
}
.qcta-fab[data-pos="top-right"] {
    bottom: auto;
    top:    var(--qcta-dsk-b);
    flex-direction: column-reverse;
}
.qcta-fab[data-pos="top-left"] {
    bottom: auto;
    top:    var(--qcta-dsk-b);
    right:  auto;
    left:   20px;
    align-items: flex-start;
    flex-direction: column-reverse;
}

/* ── FAB Button ──────────────────────────────────────────── */
.qcta-fab-btn {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    border: none;
    background: var(--qcta-btn-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 20px rgba(0,0,0,.15),
        0 0 0 0 var(--qcta-accent);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1),
                box-shadow .3s ease;
    animation: qcta-pulse 2.8s ease-in-out infinite;
    position: relative;
    flex-shrink: 0;
}

@keyframes qcta-pulse {
    0%   { box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 0 0 0   color-mix(in srgb, var(--qcta-accent) 50%, transparent); }
    60%  { box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 0 0 12px color-mix(in srgb, var(--qcta-accent) 0%,  transparent); }
    100% { box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 0 0 0   color-mix(in srgb, var(--qcta-accent) 0%,  transparent); }
}

/* Fallback pulse for older browsers */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
    @keyframes qcta-pulse {
        0%   { box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 0 0 0   rgba(108,99,255,.45); }
        60%  { box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 0 0 12px rgba(108,99,255,0); }
        100% { box-shadow: 0 4px 20px rgba(0,0,0,.15), 0 0 0 0   rgba(108,99,255,0); }
    }
}

.qcta-fab-btn:hover { transform: scale(1.1); }
.qcta-fab-btn:active { transform: scale(.93); }

/* ── Button Icon: + → × ──────────────────────────────────── */
.qcta-fab-icon {
    position: relative;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Two bars that form + and rotate to × */
.qcta-bar {
    position: absolute;
    width: 22px;
    height: 2.5px;
    background: #333;
    border-radius: 3px;
    transition: transform .35s cubic-bezier(.68,-.55,.27,1.55),
                opacity .2s ease;
}
.qcta-bar-h { transform: rotate(0deg); }
.qcta-bar-v { transform: rotate(90deg); }

/* Open state: + → × */
.qcta-fab.is-open .qcta-bar-h { transform: rotate(45deg); }
.qcta-fab.is-open .qcta-bar-v { transform: rotate(135deg); }
.qcta-fab.is-open .qcta-fab-btn {
    animation: none;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
}

/* ── Menu ────────────────────────────────────────────────── */
.qcta-fab-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(14px) scale(.94);
    pointer-events: none;
    transition: opacity .26s ease, transform .26s cubic-bezier(.34,1.2,.64,1);
    transform-origin: bottom right;
}

.qcta-fab[data-pos="bottom-left"] .qcta-fab-menu,
.qcta-fab[data-pos="top-left"]    .qcta-fab-menu {
    transform-origin: bottom left;
}
.qcta-fab[data-pos="top-right"]   .qcta-fab-menu,
.qcta-fab[data-pos="top-left"]    .qcta-fab-menu {
    transform-origin: top right;
}

.qcta-fab.is-open .qcta-fab-menu {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Menu Items ──────────────────────────────────────────── */
.qcta-fab-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    color: #1a1a2e;
    text-decoration: none;
    padding: 10px 16px 10px 12px;
    border-radius: 50px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;         /* ← تم فونت */
    box-shadow: 0 3px 14px rgba(0,0,0,.11);
    border: 1.5px solid rgba(0,0,0,.05);
    transition: transform .2s ease, box-shadow .2s ease;
    direction: rtl;
    line-height: 1.4;
}

.qcta-fab-item:hover {
    transform: translateX(-4px) scale(1.02);
    box-shadow: 0 6px 22px rgba(0,0,0,.14);
    text-decoration: none;
    color: #1a1a2e;
}

/* Left-side mirror */
.qcta-fab[data-pos="bottom-left"] .qcta-fab-item:hover,
.qcta-fab[data-pos="top-left"]    .qcta-fab-item:hover {
    transform: translateX(4px) scale(1.02);
}

/* Staggered entry delay */
.qcta-fab.is-open .qcta-fab-item:nth-child(1) { transition-delay: .03s; }
.qcta-fab.is-open .qcta-fab-item:nth-child(2) { transition-delay: .06s; }
.qcta-fab.is-open .qcta-fab-item:nth-child(3) { transition-delay: .09s; }
.qcta-fab.is-open .qcta-fab-item:nth-child(4) { transition-delay: .12s; }
.qcta-fab.is-open .qcta-fab-item:nth-child(5) { transition-delay: .15s; }

.qcta-fab-item-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qcta-fab-item-icon svg { width: 36px; height: 36px; display: block; }

/* ── Backdrop ────────────────────────────────────────────── */
.qcta-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.22);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: -1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease;
}
.qcta-fab.is-open .qcta-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .qcta-fab                   { bottom: var(--qcta-mob-b); right: 14px; }
    .qcta-fab[data-pos="bottom-left"] { right: auto; left: 14px; }
    .qcta-fab[data-pos="top-right"]   { bottom: auto; top: var(--qcta-mob-b); right: 14px; }
    .qcta-fab[data-pos="top-left"]    { bottom: auto; top: var(--qcta-mob-b); right: auto; left: 14px; }

    .qcta-fab-btn               { width: 56px; height: 56px; }
    .qcta-fab-item              { font-size: 13px; padding: 9px 14px 9px 10px; }
    .qcta-fab-item-icon,
    .qcta-fab-item-icon svg     { width: 30px; height: 30px; }
    .qcta-bar                   { width: 20px; }
}
