/* FILE: static/css/fab.css */
/* ═══════════════════════════════════════════════════════════
   FAB — Floating Action Button
   دکمه‌ی شناور اکشن‌های سریع
   ═══════════════════════════════════════════════════════════ */

.fab-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1035;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
}

/* ═══ Backdrop ═══ */
.fab-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: -1;
}
.fab-container.open .fab-backdrop {
    opacity: 1;
    visibility: visible;
}

/* ═══ Menu ═══ */
.fab-menu {
    position: absolute;
    bottom: 60px;
    left: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}

.fab-container.open .fab-menu {
    pointer-events: auto;
}

/* ═══ Item ═══ */
.fab-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px 5px 5px;
    background: #fff;
    border-radius: 50px;
    text-decoration: none;
    color: #111827;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.15);
    border: 1px solid #e8edf4;
    transition: all 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: calc(var(--i, 0) * 0.05s);
    transform: translateY(20px) scale(0.85);
    opacity: 0;
    font-size: 12.5px;
    font-weight: 800;
    direction: ltr;
    white-space: nowrap;
    align-self: flex-start;
    cursor: pointer;
}

.fab-container.open .fab-item {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.fab-item:hover {
    background: #f8fafc;
    transform: translateX(4px) scale(1.02);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.2);
    color: #111827;
}

.fab-item-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-size: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fab-item-label {
    direction: rtl;
    padding-left: 8px;
    color: #111827;
    font-weight: 800;
}

/* ═══ Main Button ═══ */
.fab-button {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    font-size: 18px;
    box-shadow:
        0 8px 24px rgba(79, 70, 229, 0.4),
        0 4px 10px rgba(15, 23, 42, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.fab-button:hover {
    transform: scale(1.08);
    box-shadow:
        0 12px 32px rgba(79, 70, 229, 0.5),
        0 6px 14px rgba(15, 23, 42, 0.2);
}

.fab-button:active {
    transform: scale(0.95);
}

.fab-button .fab-icon-plus,
.fab-button .fab-icon-close {
    position: absolute;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.fab-button .fab-icon-plus {
    opacity: 1;
    transform: rotate(0deg);
}

.fab-button .fab-icon-close {
    opacity: 0;
    transform: rotate(-90deg);
}

.fab-container.open .fab-button .fab-icon-plus {
    opacity: 0;
    transform: rotate(90deg);
}

.fab-container.open .fab-button .fab-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

.fab-container.open .fab-button {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow:
        0 8px 24px rgba(239, 68, 68, 0.45),
        0 4px 10px rgba(15, 23, 42, 0.15);
}

/* ═══ Pulse Animation ═══ */
@keyframes fabPulse {
    0%, 100% {
        box-shadow:
            0 8px 24px rgba(79, 70, 229, 0.4),
            0 0 0 0 rgba(79, 70, 229, 0.4);
    }
    50% {
        box-shadow:
            0 8px 24px rgba(79, 70, 229, 0.4),
            0 0 0 12px rgba(79, 70, 229, 0);
    }
}

.fab-button:not(.fab-container.open .fab-button) {
    animation: fabPulse 2.5s ease-in-out infinite;
}

.fab-container.open .fab-button {
    animation: none;
}

/* ═══ Hide back-to-top when FAB is present ═══ */
body:has(.fab-container) #backToTop {
    display: none !important;
}

/* ═══ Mobile ═══ */
@media (max-width: 767px) {
    .fab-container {
        bottom: 84px;
        left: 14px;
    }
    .fab-button {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    .fab-menu {
        bottom: 54px;
        gap: 8px;
    }
    .fab-item {
        padding: 4px 12px 4px 4px;
        font-size: 12px;
    }
    .fab-item-icon {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

/* ═══ Reduced motion ═══ */
@media (prefers-reduced-motion: reduce) {
    .fab-item,
    .fab-button,
    .fab-button .fab-icon-plus,
    .fab-button .fab-icon-close {
        transition: opacity 0.1s ease;
    }
    .fab-button {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   PRINT — مخفی کردن FAB هنگام چاپ
   ═══════════════════════════════════════════════════════════ */
@media print {
    .fab-container,
    .fab-backdrop,
    .fab-menu,
    .fab-button,
    .fab-item {
        display: none !important;
        visibility: hidden !important;
    }
}