/* ============================================================
   🎧 پشتیبانی — استایل
   ============================================================ */

/* --- دکمه شناور کاربر --- */
.support-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    box-shadow: 0 6px 24px rgba(102, 126, 234, 0.5);
    cursor: pointer;
    z-index: 9999;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s, box-shadow .2s;
}
.support-fab:hover { transform: scale(1.08); box-shadow: 0 8px 32px rgba(102,126,234,.7); }
.support-fab .support-fab-badge {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 22px; height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #f44336;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(244,67,54,.5);
}
.support-fab.hidden { display: none; }

/* --- پنل چت کاربر --- */
.support-panel {
    position: fixed;
    bottom: 96px;
    left: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    direction: rtl;
    font-family: inherit;
}
.support-panel.open { display: flex; animation: spOpen .25s ease; }
@keyframes spOpen {
    from { opacity: 0; transform: translateY(20px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.support-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.support-header h5 { margin: 0; font-size: 15px; font-weight: 700; }
.support-header small { opacity: .85; font-size: 12px; }
.support-header-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 30px; height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: background .2s;
}
.support-header-close:hover { background: rgba(255,255,255,.3); }

.support-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f7f8fc;
    scroll-behavior: smooth;
}

.support-msg {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.support-msg.user { align-self: flex-end; margin-left: auto; align-items: flex-end; }
.support-msg.admin { align-self: flex-start; margin-right: auto; align-items: flex-start; }

.support-msg-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.support-msg.user .support-msg-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.support-msg.admin .support-msg-bubble {
    background: #fff;
    color: #222;
    border: 1px solid #e6e8ef;
    border-bottom-left-radius: 4px;
}

.support-msg-time {
    font-size: 11px;
    color: #8b90a5;
    margin-top: 4px;
    padding: 0 4px;
}

.support-msg-img {
    max-width: 220px;
    max-height: 220px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 6px;
    border: 1px solid rgba(0,0,0,.08);
    transition: transform .2s;
}
.support-msg-img:hover { transform: scale(1.02); }

.support-empty {
    text-align: center;
    padding: 40px 20px;
    color: #8b90a5;
    font-size: 13px;
}
.support-empty i { font-size: 40px; opacity: .4; display: block; margin-bottom: 12px; }

.support-typing {
    display: inline-flex;
    gap: 4px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e6e8ef;
}
.support-typing span {
    width: 6px; height: 6px;
    background: #b0b6c7;
    border-radius: 50%;
    animation: spTyping 1.2s infinite;
}
.support-typing span:nth-child(2) { animation-delay: .2s; }
.support-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes spTyping {
    0%,60%,100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.support-footer {
    background: #fff;
    border-top: 1px solid #e6e8ef;
    padding: 10px 12px;
}
.support-attach-preview {
    display: none;
    position: relative;
    margin-bottom: 8px;
    width: fit-content;
}
.support-attach-preview img {
    max-width: 100px; max-height: 100px;
    border-radius: 8px;
    border: 1px solid #d8dce6;
}
.support-attach-preview button {
    position: absolute;
    top: -8px; right: -8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #f44336;
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
}
.support-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.support-input-row textarea {
    flex: 1;
    resize: none;
    border: 1px solid #d8dce6;
    border-radius: 20px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 14px;
    max-height: 100px;
    outline: none;
    transition: border-color .2s;
}
.support-input-row textarea:focus { border-color: #667eea; }

.support-btn-icon {
    background: transparent;
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    color: #667eea;
    font-size: 18px;
    cursor: pointer;
    transition: background .2s;
    display: flex; align-items: center; justify-content: center;
}
.support-btn-icon:hover { background: #eef0f7; }

.support-btn-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s, box-shadow .2s;
}
.support-btn-send:hover { transform: scale(1.06); box-shadow: 0 4px 12px rgba(102,126,234,.4); }
.support-btn-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* --- ادمین: پنل دو ستونه --- */
.admin-support-wrap {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}
.admin-support-sidebar {
    width: 320px;
    background: #f7f8fc;
    border-left: 1px solid #e6e8ef;
    overflow-y: auto;
    flex-shrink: 0;
}
.admin-support-conv {
    padding: 12px 14px;
    border-bottom: 1px solid #e6e8ef;
    cursor: pointer;
    transition: background .15s;
    position: relative;
}
.admin-support-conv:hover { background: #eef0f7; }
.admin-support-conv.active { background: #fff; border-right: 3px solid #667eea; }
.admin-support-conv-name { font-weight: 700; font-size: 14px; color: #222; margin-bottom: 3px; }
.admin-support-conv-preview { font-size: 12px; color: #8b90a5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-support-conv-time { font-size: 11px; color: #b0b6c7; margin-top: 4px; }
.admin-support-conv .badge-unread {
    position: absolute;
    top: 12px; left: 12px;
    background: #f44336; color: #fff;
    font-size: 11px; padding: 2px 8px;
    border-radius: 10px; font-weight: 700;
}
.admin-support-conv .icon-attach {
    color: #667eea;
    margin-left: 4px;
    font-size: 11px;
}
.admin-support-main { flex: 1; display: flex; flex-direction: column; }
.admin-support-main .support-header { border-radius: 0; }
.admin-support-main .support-body { background: #f7f8fc; }
.admin-support-empty {
    flex: 1; display: flex; align-items: center; justify-content: center;
    color: #8b90a5; flex-direction: column; gap: 12px;
}
.admin-support-empty i { font-size: 56px; opacity: .3; }

/* --- Lightbox برای تصاویر --- */
.support-lightbox {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.85);
    display: none; align-items: center; justify-content: center;
    z-index: 100000; cursor: zoom-out;
}
.support-lightbox.open { display: flex; }
.support-lightbox img {
    max-width: 92vw; max-height: 92vh;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0,0,0,.6);
}

/* --- موبایل --- */
@media (max-width: 768px) {
    .support-panel {
        bottom: 0; left: 0; right: 0;
        width: 100%; max-width: 100%;
        height: 100vh; max-height: 100vh;
        border-radius: 0;
    }
    .support-fab { bottom: 16px; left: 16px; }
    .admin-support-sidebar { width: 100%; position: absolute; z-index: 5; height: 100%; }
    .admin-support-sidebar.hidden { display: none; }
}