/**
 * استایل‌های دکمه شناور پشتیبانی
 *
 * @package Floating_Support
 * @since   1.0.0
 */

/* =========================================
   ۱. متغیرهای CSS (Fallback)
   مقادیر اصلی از طریق inline style تزریق می‌شوند
   ========================================= */
:root {
    --fs-main-color: #009688;
    --fs-button-size: 60px;
    --fs-icon-size: 30px;
    --fs-font-size: 12px;
    --fs-panel-width: 200px;
    --fs-white: #ffffff;
    --fs-dark: #333333;
    --fs-gray: #f5f5f5;
    --fs-border: #e0e0e0;
    --fs-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --fs-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --fs-radius: 12px;
}

/* =========================================
   ۲. کانتینر اصلی
   ========================================= */
#floating-support-container {
    position: fixed;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    direction: rtl;
}

/* موقعیت‌های مختلف */
.fs-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.fs-position-bottom-left {
    bottom: 20px;
    left: 20px;
    align-items: flex-start;
}

.fs-position-top-right {
    top: 20px;
    right: 20px;
}

.fs-position-top-left {
    top: 20px;
    left: 20px;
    align-items: flex-start;
}

/* =========================================
   ۳. دکمه اصلی
   ========================================= */
.floating-support-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: var(--fs-button-size);
    height: var(--fs-button-size);
    padding: 8px 16px;
    border: none;
    border-radius: 50px;
    background-color: var(--fs-main-color);
    color: var(--fs-white);
    cursor: pointer;
    box-shadow: var(--fs-shadow);
    transition: transform var(--fs-transition),
                box-shadow var(--fs-transition),
                background-color var(--fs-transition);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.floating-support-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.floating-support-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.floating-support-btn:focus-visible {
    outline: 3px solid var(--fs-main-color);
    outline-offset: 2px;
}

/* اگر متن دکمه خالی بود، دکمه گرد شود */
.floating-support-btn .fs-btn-text:empty {
    display: none;
}

/* دکمه بدون متن - کاملاً گرد */
.floating-support-btn:has(.fs-btn-text:empty),
.floating-support-btn .fs-btn-text:only-child:empty {
    padding: 8px;
    border-radius: 50%;
}

/* آیکن دکمه */
.fs-btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--fs-icon-size);
    height: var(--fs-icon-size);
    flex-shrink: 0;
}

.fs-btn-icon svg {
    width: 100%;
    height: 100%;
}

/* متن دکمه */
.fs-btn-text {
    font-size: var(--fs-font-size);
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
}

/* =========================================
   ۴. پنل گزینه‌ها
   ========================================= */
.floating-support-panel {
    display: none;
    width: var(--fs-panel-width);
    background-color: var(--fs-white);
    border-radius: var(--fs-radius);
    box-shadow: var(--fs-shadow);
    overflow: hidden;
    animation: fs-slide-up 0.3s ease;
    direction: rtl;
}

.floating-support-panel.active {
    display: block;
}

/* انیمیشن باز شدن */
@keyframes fs-slide-up {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   ۵. هدر پنل
   ========================================= */
.fs-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--fs-main-color);
    color: var(--fs-white);
}

.fs-panel-title {
    font-size: 14px;
    font-weight: 600;
}

.fs-panel-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: var(--fs-white);
    cursor: pointer;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.fs-panel-close:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.fs-panel-close svg {
    width: 14px;
    height: 14px;
}

/* =========================================
   ۶. بدنه پنل (گزینه‌ها)
   ========================================= */
.fs-panel-body {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 4px;
}

/* هر گزینه */
.fs-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--fs-dark);
    transition: background-color 0.2s ease,
                transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.fs-option:hover {
    background-color: var(--fs-gray);
    transform: translateX(-2px);
}

.fs-option:active {
    transform: scale(0.98);
}

.fs-option:focus-visible {
    outline: 2px solid var(--fs-main-color);
    outline-offset: 1px;
}

/* آیکن گزینه */
.fs-option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fs-option-icon svg {
    width: 22px;
    height: 22px;
}

.fs-option-phone .fs-option-icon {
    background-color: #e8f5e9;
    color: #4caf50;
}

.fs-option-sms .fs-option-icon {
    background-color: #e3f2fd;
    color: #2196f3;
}

.fs-option-bale .fs-option-icon {
    background-color: #fce4ec;
    color: #e91e63;
}

/* متن گزینه */
.fs-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fs-option-text strong {
    font-size: 13px;
    font-weight: 600;
}

.fs-option-text small {
    font-size: 11px;
    color: #888888;
}

/* =========================================
   ۷. فوتر پنل
   ========================================= */
.fs-panel-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--fs-border);
    text-align: center;
}

.fs-footer-text {
    font-size: 11px;
    color: #999999;
}

/* =========================================
   ۸. حالت ریسپانسیو (موبایل)
   ========================================= */
@media screen and (max-width: 480px) {
    #floating-support-container {
        bottom: 15px !important;
        right: 15px !important;
        left: auto !important;
        top: auto !important;
    }

    .floating-support-panel {
        position: fixed;
        bottom: 15px;
        right: 15px;
        left: 15px;
        width: auto;
        max-width: 350px;
        margin: 0 auto;
    }

    .floating-support-btn {
        min-width: 50px;
        height: 50px;
        padding: 6px 14px;
    }
}

/* =========================================
   ۹. کاهش حرکت (ترجیح کاربر)
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    .floating-support-btn,
    .floating-support-panel,
    .fs-option {
        animation: none;
        transition: none;
    }
}

/* =========================================
   ۱۰. حالت چاپ (مخفی کردن)
   ========================================= */
@media print {
    #floating-support-container {
        display: none !important;
    }
}

/* =========================================
   ۱۱. پشتیبانی از RTL (راست‌چین)
   ========================================= */
.rtl .floating-support-btn {
    direction: rtl;
}

.rtl .fs-option:hover {
    transform: translateX(2px);
}