/* تعریف متغیرها برای مدیریت تم و رنگ‌بندی یکپارچه */
:root {
    --color-primary: #10b981; /* سبز درمانی */
    --color-primary-dark: #059669;
    --color-primary-light: #ecfdf5;

    --color-support: #3b82f6; /* آبی پشتیبانی */
    --color-support-dark: #2563eb;

    --color-bg-card: #ffffff;
    --color-bg-body: #f8fafc;
    --color-border-subtle: #e2e8f0;

    --color-text-main: #0f172a;
    --color-text-muted: #64748b;
    --color-disabled-bg: #f1f5f9;

    --radius-lg: 20px;
    --radius-md: 14px;
    --shadow-box: 0 20px 40px -10px rgba(15, 23, 42, 0.15);
    --shadow-btn: 0 8px 20px -6px rgba(16, 185, 129, 0.4);
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.support-chat-widget {
    position: fixed;
    left: 28px;
    bottom: 28px;
    z-index: 9999;
    direction: rtl;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

/* باکس چت اصلی */
.support-chat-box {
    position: absolute;
    bottom: 84px;
    left: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: min(560px, calc(100svh - 130px));
    background: var(--color-bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-box);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: var(--transition-smooth);
    border: 1px solid var(--color-border-subtle);
}

.support-chat-box.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* هدر چت */
.support-chat-header {
    background: linear-gradient(135deg, var(--color-support), var(--color-support-dark));
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.support-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.support-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.support-chat-meta {
    display: flex;
    flex-direction: column;
}

.support-chat-title {
    font-size: 14.5px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: #ecfdf5;
}

.support-chat-status {
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    margin-top: 2px;
}

.support-chat-actions {
    display: flex;
    gap: 8px;
}

.support-chat-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.support-chat-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

/* بدنه چت */
.support-chat-body {
    flex: 1;
    min-height: 0;
    background: var(--color-bg-body);
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
}

/* استایل خوش‌آمد گویی */
.support-chat-welcome {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.support-chat-welcome-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.support-chat-welcome h6 {
    font-weight: 800;
    font-size: 15px;
    color: var(--color-text-main);
    margin-bottom: 6px;
}

.support-chat-welcome p {
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1.8;
}

/* لیست انتخاب گزینه‌ها */
.support-choice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 15px;
}

.support-choice-card {
    width: 100%;
    border: 1px solid var(--color-border-subtle);
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: right;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.support-choice-card:hover:not(.support-choice-card--disabled) {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
    transform: translateX(-4px); /* جابجایی جزئی به سمت راست/چپ در جهت فارسی */
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.08);
}

.support-choice-card-content {
    flex: 1;
}

.support-choice-card strong {
    display: block;
    font-size: 13.5px;
    color: var(--color-text-main);
    margin-bottom: 4px;
    font-weight: 700;
}

.support-choice-card .support-chat-footer-note {
    margin: 0;
    font-size: 11.5px;
    color: var(--color-text-muted);
}

.support-choice-card::after {
    content: "←";
    font-size: 18px;
    color: var(--color-text-muted);
    transition: var(--transition-smooth);
}

.support-choice-card:hover::after {
    color: var(--color-primary);
}

/* تمایز کارت‌های مختلف بر اساس نوع انتخاب */
.support-choice-card[data-chat-type="support"] {
    border-right: 4px solid var(--color-support);
}
.support-choice-card[data-chat-type="support"]:hover {
    border-color: var(--color-support);
    background: #eff6ff;
}

.support-choice-card[data-chat-type="doctor"] {
    border-right: 4px solid #f59e0b;
}

.support-choice-card[data-chat-type="other-doctors"] {
    border-right: 4px solid var(--color-primary);
}

/* استایل کارت‌های غیرفعال */
.support-choice-card--disabled,
.support-choice-card:disabled {
    background: var(--color-disabled-bg);
    border-color: var(--color-border-subtle);
    cursor: not-allowed !important;
    opacity: 0.75;
}

.support-choice-card--disabled::after {
    display: none;
}

.support-choice-card--disabled:hover {
    transform: none !important;
    box-shadow: none !important;
    background: var(--color-disabled-bg) !important;
    border-color: var(--color-border-subtle) !important;
}

.support-choice-badge {
    padding: 4px 10px;
    background: #e2e8f0;
    color: #475569;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
}

/* فرم و اینپوت‌ها */
.support-inline-form {
    margin-top: 15px;
}

.support-chat-input {
    width: 100%;
    background: var(--color-bg-card);
    border: 1.5px solid var(--color-border-subtle);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--color-text-main);
    transition: var(--transition-smooth);
    outline: none;
}

.support-chat-input:focus {
    border-color: var(--color-support);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* دکمه‌های تایید و فرم */
.support-chat-submit-btn {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-support), var(--color-support-dark));
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.support-chat-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.3);
}

/* استایل دکمه‌های متنی */
.support-text-btn {
    background: none;
    border: none;
    color: var(--color-support);
    cursor: pointer;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 8px;
    transition: var(--transition-smooth);
}

.support-text-btn:hover {
    color: var(--color-support-dark);
    text-decoration: underline;
}

/* دکمه‌های شناور (Floating Action Group) */
.floating-action-group {
    position: fixed;
    left: 28px;
    bottom: 28px;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
}

.medical-action-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 52px;
    padding: 0 18px;
    border: none;
    border-radius: 16px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-btn);
}

.medical-action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px -4px rgba(16, 185, 129, 0.45);
}

.medical-action-btn-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.medical-action-btn-consult {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
}

.medical-action-btn-support {
    background: linear-gradient(135deg, var(--color-support), var(--color-support-dark));
    box-shadow: 0 8px 20px -6px rgba(59, 130, 246, 0.4);
}

.medical-action-btn-support:hover {
    box-shadow: 0 12px 24px -4px rgba(59, 130, 246, 0.45);
}

/* ریسپانسیو و حالت موبایل */
@media (max-width: 576px) {
    .support-chat-widget {
        left: 16px;
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    }

    .floating-action-group {
        left: 16px;
        bottom: 16px;
        width: calc(100% - 32px);
    }

    .medical-action-btn {
        width: 100%;
        justify-content: center;
    }

    .support-chat-box {
        width: 100%;
        max-width: 100%;
        bottom: 74px;
        height: calc(100svh - 96px - env(safe-area-inset-bottom, 0px));
        max-height: calc(100svh - 96px - env(safe-area-inset-bottom, 0px));
    }
}
