/* =============================================================================
   style-support.css — صفحه‌ی گفتگوی پشتیبانی (/support)
   متغیرهای رنگ از style.css خوانده می‌شوند؛ اگر نبودند، جایگزین به کار می‌رود.
   ========================================================================== */
.sup-wrap {
    --sup-primary: var(--primary, #ef3a4b);
    --sup-primary-dark: var(--primary-dark, #d12e3e);
    --sup-text: var(--dark, #2d3436);
    --sup-gray: var(--gray, #6b7a83);
    --sup-line: rgba(0, 0, 0, .08);
    --sup-bg: #eceff1;
    --sup-in: #ffffff;
    --sup-out: #dcf3d7;

    max-width: 820px;
    margin: 18px auto;
    padding: 0 12px;
}

.sup-card {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 150px);
    min-height: 460px;
    background: var(--sup-in);
    border: 1px solid var(--sup-line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 6px 26px rgba(0, 0, 0, .08);
    position: relative;
}

/* --- سربرگ --- */
.sup-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 15px;
    background: var(--sup-primary);
    color: var(--sup-gray);
    flex-shrink: 0;
}

.sup-head-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    color: var(--sup-gray);
}

.sup-head-info { flex: 1; min-width: 0; }
    .sup-head-info h4 {
        font-size: 15px;
        margin: 0;
        color: var(--sup-gray);
    }
.sup-online {
    font-size: 11px;
    opacity: .92;
    color: var(--sup-gray);
}
.sup-online i { font-size: 8px; color: var(--sup-gray); margin-inline-end: 3px; }

.sup-head-close {
    width: 34px; height: 34px;
    border-radius: 9px;
    color: var(--sup-gray); background: rgba(255, 255, 255, .33);
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none; transition: .18s;
}
.sup-head-close:hover { background: rgba(255, 255, 255, .28); }

/* --- دروازه‌ی مهمان --- */
.sup-gate {
    position: absolute;
    inset: 68px 0 0 0;
    z-index: 5;
    background: var(--sup-bg);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.sup-gate[hidden] { display: none; }

.sup-gate-box {
    width: 100%; max-width: 360px;
    background: #fff;
    border: 1px solid var(--sup-line);
    border-radius: 16px;
    padding: 26px 22px;
    text-align: center;
    box-shadow: 0 4px 18px rgba(0, 0, 0, .06);
}

.sup-gate-icon {
    width: 60px; height: 60px; margin: 0 auto 12px;
    border-radius: 50%;
    background: rgba(239, 58, 75, .1);
    color: var(--sup-primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}

.sup-gate-box h3 { font-size: 17px; color: var(--sup-text); margin: 0 0 8px; }
.sup-gate-box p { font-size: 12.5px; color: var(--sup-gray); line-height: 2; margin: 0 0 16px; }

.sup-gate-btn {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 11px;
    background: var(--sup-primary);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}
.sup-gate-btn:hover { background: var(--sup-primary-dark); }

.sup-gate-register {
    display: inline-block;
    margin-top: 14px;
    font-size: 12px;
    color: var(--sup-primary);
    text-decoration: none;
}

/* --- بدنه‌ی پیام‌ها --- */
.sup-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--sup-bg);
    background-image: radial-gradient(rgba(0, 0, 0, .035) 1px, transparent 1px);
    background-size: 18px 18px;
    scroll-behavior: smooth;
}

.sup-date {
    align-self: center;
    background: rgba(255, 255, 255, .9);
    border: 1px solid var(--sup-line);
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 10.5px;
    color: var(--sup-gray);
    margin: 4px 0;
}

.sup-sys {
    align-self: center;
    max-width: 82%;
    text-align: center;
    background: #fff6d8;
    border-radius: 10px;
    padding: 7px 13px;
    font-size: 11.5px;
    color: #8a6d1f;
    line-height: 1.9;
}

.sup-msg { max-width: 76%; display: flex; flex-direction: column; gap: 3px; }
.sup-msg.in { align-self: flex-start; }
.sup-msg.out { align-self: flex-end; }

.sup-bubble {
    padding: 9px 12px;
    border-radius: 14px;
    background: var(--sup-in);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    font-size: 13px;
    line-height: 2;
    word-break: break-word;
    white-space: pre-wrap;
}
.sup-msg.in .sup-bubble { border-start-start-radius: 4px; }
.sup-msg.out .sup-bubble { background: var(--sup-out); border-start-end-radius: 4px; }

.sup-media {
    display: block;
    max-width: 260px; max-height: 280px;
    border-radius: 12px;
    overflow: hidden;
}
.sup-media img, .sup-media { width: 100%; border-radius: 12px; object-fit: cover; }
video.sup-media { background: #000; }

.sup-audio { max-width: 240px; height: 40px; }

.sup-file {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 11px;
    border-radius: 12px;
    background: var(--sup-in);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    text-decoration: none;
    color: var(--sup-text);
    min-width: 210px;
}
.sup-msg.out .sup-file { background: var(--sup-out); }
.sup-file-icon { font-size: 20px; color: var(--sup-primary); }
.sup-file-info { flex: 1; min-width: 0; }
.sup-file-info b { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-file-info span { font-size: 10.5px; color: var(--sup-gray); }

.sup-time {
    display: flex; align-items: center; gap: 5px;
    font-size: 10px; color: var(--sup-gray);
    padding-inline: 4px;
}
.sup-msg.out .sup-time { justify-content: flex-end; }
.sup-ticks { color: #a9b6bd; transition: color .2s; }
.sup-ticks.seen { color: #2d9cdb; }

.sup-delete {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--sup-gray);
    cursor: pointer;
    font-size: 10px;
    transition: .18s;
}
.sup-delete:hover { background: rgba(239, 58, 75, .1); color: var(--sup-primary); }

.sup-preview-trigger { cursor: pointer; }
.sup-media.sup-preview-trigger { border: 0; padding: 0; background: transparent; }
.sup-video-thumb {
    position: relative;
    width: 260px;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #101416;
    cursor: pointer;
}
.sup-video-thumb video {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    pointer-events: none;
}
.sup-video-thumb::after {
    content: "\f144";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: "Font Awesome 6 Free";
    font-size: 42px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .45);
    pointer-events: none;
}
.sup-file.sup-preview-trigger {
    width: 100%;
    border: 0;
    font-family: inherit;
    font-size: inherit;
    text-align: start;
    cursor: pointer;
}

/* --- مدال پیش‌نمایش، هشدار و تأیید --- */
body.sup-modal-open { overflow: hidden; }
.sup-modal {
    --sup-primary: var(--primary, #ef3a4b);
    --sup-primary-dark: var(--primary-dark, #d12e3e);
    --sup-text: var(--dark, #2d3436);
    --sup-gray: var(--gray, #6b7a83);
    --sup-line: rgba(0, 0, 0, .08);
    --sup-in: #fff;
    position: fixed;
    inset: 0;
    z-index: 11000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.sup-modal[hidden] { display: none; }
.sup-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 16, 20, .72);
    backdrop-filter: blur(3px);
}
.sup-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 560px);
    max-height: min(92vh, 760px);
    overflow: hidden;
    border-radius: 16px;
    background: var(--sup-in);
    box-shadow: 0 16px 50px rgba(0, 0, 0, .28);
}
.sup-preview-dialog { width: min(100%, 900px); }
.sup-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid var(--sup-line);
    background: var(--sup-in);
}
.sup-modal-head h3 {
    margin: 0;
    color: var(--sup-text);
    font-size: 14px;
}
.sup-modal-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 9px;
    background: #f0f2f4;
    color: var(--sup-gray);
    cursor: pointer;
    transition: .18s;
}
.sup-modal-close:hover { background: #e6e9ec; color: var(--sup-text); }
.sup-preview-content {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    max-height: calc(92vh - 70px);
    padding: 14px;
    overflow: auto;
    background: #15191c;
}
.sup-preview-content img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 105px);
    object-fit: contain;
    border-radius: 9px;
}
.sup-preview-content video {
    display: block;
    width: min(100%, 820px);
    max-height: calc(92vh - 105px);
    border-radius: 9px;
    background: #000;
}
.sup-preview-content iframe {
    display: block;
    width: min(100%, 820px);
    height: min(78vh, 680px);
    border: 0;
    border-radius: 9px;
    background: #fff;
}
.sup-alert-dialog, .sup-confirm-dialog { padding-bottom: 15px; }
.sup-alert-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 20px auto 10px;
    border-radius: 50%;
    background: rgba(239, 58, 75, .1);
    color: var(--sup-primary);
    font-size: 22px;
}
.sup-alert-text, .sup-confirm-text {
    margin: 0;
    padding: 0 22px;
    color: var(--sup-text);
    font-size: 13px;
    line-height: 2;
    text-align: center;
    white-space: pre-line;
}
.sup-modal-primary, .sup-modal-secondary, .sup-modal-danger {
    min-width: 115px;
    min-height: 40px;
    margin: 18px auto 0;
    padding: 8px 16px;
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}
.sup-modal-primary {
    display: block;
    background: var(--sup-primary);
    color: #fff;
}
.sup-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 9px;
    margin-top: 18px;
}
.sup-confirm-actions button { margin: 0; }
.sup-modal-secondary { background: #f0f2f4; color: var(--sup-gray); }
.sup-modal-danger { background: var(--sup-primary); color: #fff; }
.sup-modal-primary:hover, .sup-modal-danger:hover { background: var(--sup-primary-dark); }
.sup-modal-secondary:hover { background: #e6e9ec; }

/* --- «در حال نوشتن» --- */
.sup-typing { display: none; gap: 4px; padding: 0 20px 6px; }
.sup-typing.show { display: flex; }
.sup-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--sup-gray); animation: supBounce 1s infinite; }
.sup-typing i:nth-child(2) { animation-delay: .15s; }
.sup-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes supBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }

.sup-closed {
    display: flex; align-items: center; gap: 8px;
    padding: 11px 15px;
    background: #fdecea; color: #b0392f;
    font-size: 12px;
    border-top: 1px solid var(--sup-line);
}
.sup-closed.hidden { display: none; }

/* --- کادر نوشتن --- */
.sup-foot {
    display: flex; align-items: flex-end; gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid var(--sup-line);
    flex-shrink: 0;
    position: relative;
}
.sup-foot[hidden] { display: none; }

.sup-btn {
    width: 42px; height: 42px;
    flex-shrink: 0;
    border: none; border-radius: 50%;
    background: #f0f2f4; color: var(--sup-gray);
    font-size: 15px; cursor: pointer;
    transition: .18s;
    display: inline-flex; align-items: center; justify-content: center;
}
.sup-btn:hover { background: #e6e9ec; }
.sup-send { background: var(--sup-primary); color: #fff; }
.sup-send:hover { background: var(--sup-primary-dark); }

.sup-input {
    flex: 1;
    min-height: 42px; max-height: 96px;
    padding: 11px 14px;
    border: 1px solid var(--sup-line);
    border-radius: 21px;
    background: #f7f9fa;
    font-family: inherit; font-size: 13px; line-height: 1.7;
    color: var(--sup-text);
    resize: none; outline: none;
}
.sup-input:focus { border-color: var(--sup-primary); background: #fff; }

.sup-attach-menu {
    position: absolute;
    bottom: 62px; inset-inline-start: 12px;
    background: #fff;
    border: 1px solid var(--sup-line);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
    padding: 6px;
    display: none;
    flex-direction: column;
    min-width: 160px;
    z-index: 6;
}
.sup-attach-menu.show { display: flex; }
.sup-attach-menu button {
    display: flex; align-items: center; gap: 9px;
    padding: 9px 11px;
    border: none; background: transparent;
    font-family: inherit; font-size: 12.5px; color: var(--sup-text);
    border-radius: 8px; cursor: pointer; text-align: start;
}
.sup-attach-menu button:hover { background: #f2f5f6; }
.sup-attach-menu i { color: var(--sup-primary); width: 18px; }

/* --- نوار ضبط صدا --- */
.sup-rec {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid var(--sup-line);
    flex-shrink: 0;
}
.sup-rec.hidden { display: none; }
.sup-rec-label { font-size: 12.5px; color: var(--sup-text); flex: 1; }
.sup-rec-time { font-size: 13px; color: var(--sup-primary); font-weight: 700; }
.sup-rec-dot { width: 11px; height: 11px; border-radius: 50%; background: #e0393b; animation: supPulse 1s infinite; }
@keyframes supPulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.sup-rec-cancel, .sup-rec-send {
    width: 40px; height: 40px;
    border: none; border-radius: 50%;
    cursor: pointer; font-size: 14px;
    display: inline-flex; align-items: center; justify-content: center;
}
.sup-rec-cancel { background: #f0f2f4; color: var(--sup-gray); }
.sup-rec-send { background: var(--sup-primary); color: #fff; }

/* --- موبایل --- */
@media (max-width: 767px) {
    body.support-page {
        max-width: none;
        padding-bottom: 0;
        overflow: hidden;
    }
    .support-page .sup-wrap {
        position: fixed;
        inset: 0;
        z-index: 4000;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        padding: 0;
        max-width: none;
    }
    .support-page .sup-card {
        width: 100%;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }
    .support-page .sup-head {
        padding-top: calc(12px + env(safe-area-inset-top));
    }
    .support-page .sup-gate {
        inset-block-start: calc(68px + env(safe-area-inset-top));
    }
    .support-page .sup-foot {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
    .support-page .sup-rec {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}
