/* =============================================
   DPC Support - support-style.css
   ============================================= */

/* ── متغیرها ── */
:root {
    --dpc-primary:      #4f46e5;
    --dpc-primary-dark: #3730a3;
    --dpc-success:      #16a34a;
    --dpc-danger:       #dc2626;
    --dpc-bg:           #f8fafc;
    --dpc-border:       #e2e8f0;
    --dpc-radius:       12px;
    --dpc-shadow:       0 2px 12px rgba(0,0,0,.08);
    --dpc-me-bg:        #4f46e5;
    --dpc-me-text:      #ffffff;
    --dpc-other-bg:     #f1f5f9;
    --dpc-other-text:   #1e293b;
    --dpc-font:         'Vazirmatn', 'Tahoma', sans-serif;
}

/* ── ریست پایه ── */
.dpc-support-chat-wrap *,
.dpc-agent-panel *,
.dpc-modal-box *,
#dpc-ticket-form * {
    box-sizing: border-box;
    font-family: var(--dpc-font);
}

/* ==============================================
   ۱. هشدار / Alert
   ============================================== */
.dpc-alert {
    background: #fef9c3;
    border: 1px solid #fde047;
    color: #713f12;
    padding: 12px 16px;
    border-radius: var(--dpc-radius);
    font-size: 14px;
    text-align: center;
}

/* ==============================================
   ۲. Wrapper اصلی چت کاربر
   ============================================== */
.dpc-support-chat-wrap {
    max-width: 680px;
    margin: 0 auto;
    background: #fff;
    border-radius: var(--dpc-radius);
    box-shadow: var(--dpc-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── هدر چت ── */
.dpc-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--dpc-primary);
    color: #fff;
    flex-wrap: wrap;
}

.dpc-chat-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    flex: 1;
}

.dpc-ticket-status {
    font-size: 12px;
    background: rgba(255,255,255,.2);
    padding: 3px 10px;
    border-radius: 20px;
}

.dpc-refresh-btn {
    background: rgba(255,255,255,.15);
    border: 1px solid rgba(255,255,255,.4);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: background .2s;
}
.dpc-refresh-btn:hover {
    background: rgba(255,255,255,.3);
}

/* ── ناحیه پیام‌ها ── */
.dpc-messages-area {
    height: 420px;
    overflow-y: auto;
    padding: 16px;
    background: var(--dpc-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
}

/* اسکرول‌بار سفارشی */
.dpc-messages-area::-webkit-scrollbar { width: 5px; }
.dpc-messages-area::-webkit-scrollbar-track { background: transparent; }
.dpc-messages-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* ==============================================
   ۳. ردیف پیام
   ============================================== */
.dpc-msg-row {
    display: flex;
    max-width: 75%;
}

.dpc-msg-me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.dpc-msg-other {
    align-self: flex-start;
}

/* ── حباب پیام ── */
.dpc-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.7;
    word-break: break-word;
    position: relative;
}

.dpc-msg-me .dpc-bubble {
    background: var(--dpc-me-bg);
    color: var(--dpc-me-text);
    border-bottom-right-radius: 4px;
}

.dpc-msg-other .dpc-bubble {
    background: var(--dpc-other-bg);
    color: var(--dpc-other-text);
    border-bottom-left-radius: 4px;
}

.dpc-bubble-text {
    margin: 0 0 4px;
}

.dpc-bubble-time {
    display: block;
    font-size: 10px;
    opacity: .65;
    text-align: left;
    margin-top: 4px;
}

/* ── تصویر پیوست در حباب ── */
.dpc-msg-image {
    margin-top: 6px;
}

.dpc-chat-img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: block;
    cursor: zoom-in;
    transition: opacity .2s;
}
.dpc-chat-img:hover { opacity: .85; }

/* ── فایل پیوست در حباب ── */
.dpc-msg-file {
    margin-top: 6px;
}

.dpc-msg-file a,
.dpc-msg-me .dpc-msg-file a {
    color: #c7d2fe;
    font-size: 12px;
    text-decoration: underline;
}
.dpc-msg-other .dpc-msg-file a {
    color: var(--dpc-primary);
}

/* ==============================================
   ۴. فرم ارسال پیام (کاربر)
   ============================================== */
.dpc-chat-form {
    padding: 12px 16px;
    border-top: 1px solid var(--dpc-border);
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dpc-chat-form textarea {
    width: 100%;
    resize: none;
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: var(--dpc-font);
    outline: none;
    transition: border-color .2s;
    direction: rtl;
}
.dpc-chat-form textarea:focus {
    border-color: var(--dpc-primary);
}

.dpc-chat-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── لیبل فایل ── */
.dpc-file-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    color: var(--dpc-primary);
    background: #eef2ff;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background .2s;
    white-space: nowrap;
}
.dpc-file-label:hover { background: #e0e7ff; }
.dpc-file-label input[type="file"] { display: none; }

/* ── نام فایل انتخاب‌شده ── */
.dpc-file-name {
    font-size: 11px;
    color: #64748b;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── دکمه ارسال ── */
.dpc-send-btn {
    margin-right: auto;
    background: var(--dpc-primary);
    color: #fff;
    border: none;
    padding: 8px 22px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--dpc-font);
    font-weight: 600;
    transition: background .2s, transform .1s;
}
.dpc-send-btn:hover  { background: var(--dpc-primary-dark); }
.dpc-send-btn:active { transform: scale(.97); }
.dpc-send-btn:disabled {
    background: #a5b4fc;
    cursor: not-allowed;
}

/* ==============================================
   ۵. فرم ثبت تیکت
   ============================================== */
#dpc-ticket-form {
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    padding: 28px 24px;
    border-radius: var(--dpc-radius);
    box-shadow: var(--dpc-shadow);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

#dpc-ticket-form input[type="text"],
#dpc-ticket-form textarea,
#dpc-ticket-form select {
    width: 100%;
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: var(--dpc-font);
    outline: none;
    direction: rtl;
    transition: border-color .2s;
}
#dpc-ticket-form input:focus,
#dpc-ticket-form textarea:focus,
#dpc-ticket-form select:focus {
    border-color: var(--dpc-primary);
}

#dpc-ticket-form textarea { resize: vertical; min-height: 100px; }

.dpc-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

#dpc-ticket-form button[type="submit"] {
    background: var(--dpc-primary);
    color: #fff;
    border: none;
    padding: 10px 28px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-family: var(--dpc-font);
    font-weight: 700;
    align-self: flex-end;
    transition: background .2s;
}
#dpc-ticket-form button[type="submit"]:hover {
    background: var(--dpc-primary-dark);
}

/* ── لیست تیکت‌ها ── */
.dpc-ticket-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.dpc-ticket-list li {
    background: #fff;
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #334155;
}

/* ==============================================
   ۶. پنل پشتیبان (Agent)
   ============================================== */
.dpc-agent-panel {
    max-width: 860px;
    margin: 0 auto;
    font-family: var(--dpc-font);
}

.dpc-agent-panel h3 {
    font-size: 16px;
    color: #1e293b;
    margin-bottom: 12px;
}

#dpc-ticket-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#dpc-ticket-list li {
    background: #fff;
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow .2s;
}
#dpc-ticket-list li:hover { box-shadow: var(--dpc-shadow); }

.dpc-open-ticket {
    display: block;
    padding: 10px 16px;
    color: #1e293b;
    text-decoration: none;
    font-size: 13px;
    transition: background .15s;
}
.dpc-open-ticket:hover { background: #f1f5f9; }

/* ── ناحیه چت پشتیبان ── */
#agent-chat-area {
    background: #fff;
    border-radius: var(--dpc-radius);
    padding: 18px;
    box-shadow: var(--dpc-shadow);
}

#agent-chat-area h4 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #475569;
}

.dpc-agent-chat-box {
    height: 320px;
    overflow-y: auto;
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    padding: 12px;
    background: var(--dpc-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    margin-bottom: 12px;
}
.dpc-agent-chat-box::-webkit-scrollbar { width: 5px; }
.dpc-agent-chat-box::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

#agent-reply {
    width: 100%;
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: var(--dpc-font);
    resize: none;
    outline: none;
    direction: rtl;
    transition: border-color .2s;
}
#agent-reply:focus { border-color: var(--dpc-primary); }

.send-agent-reply {
    background: var(--dpc-primary) !important;
    color: #fff !important;
    border: none !important;
    padding: 8px 22px !important;
    border-radius: 20px !important;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--dpc-font);
    font-weight: 600;
    transition: background .2s;
    margin-right: auto;
}
.send-agent-reply:hover  { background: var(--dpc-primary-dark) !important; }
.send-agent-reply:disabled {
    background: #a5b4fc !important;
    cursor: not-allowed;
}

/* ==============================================
   ۷. مودال نمایش تصویر بزرگ
   ============================================== */
.dpc-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,.82);
    justify-content: center;
    align-items: center;
}
/* وقتی JS آن را نمایش می‌دهد */
.dpc-modal[style*="display: block"],
.dpc-modal[style*="display:block"] {
    display: flex !important;
}

.dpc-modal-content {
    max-width: 90vw;
    max-height: 88vh;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,.5);
    object-fit: contain;
    animation: dpcZoomIn .2s ease;
}

@keyframes dpcZoomIn {
    from { transform: scale(.85); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.dpc-modal-close {
    position: fixed;
    top: 18px;
    left: 22px;
    color: #fff;
    font-size: 34px;
    cursor: pointer;
    line-height: 1;
    opacity: .8;
    transition: opacity .2s;
    z-index: 100000;
}
.dpc-modal-close:hover { opacity: 1; }

/* ==============================================
   ۸. مودال درخواست کد شارژ
   ============================================== */
#dpc-recharge-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99998;
    background: rgba(0,0,0,.55);
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.dpc-modal-box {
    background: #fff;
    border-radius: var(--dpc-radius);
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    padding: 28px 24px 22px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: dpcZoomIn .2s ease;
    direction: rtl;
}

.dpc-modal-box h3 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    font-weight: 700;
}

.dpc-modal-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.7;
}

/* ── فیلدهای مودال ── */
.dpc-modal-box label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    font-weight: 600;
}

.dpc-modal-box input[type="number"],
.dpc-modal-box input[type="text"] {
    border: 1px solid var(--dpc-border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    font-family: var(--dpc-font);
    outline: none;
    transition: border-color .2s;
    direction: ltr;
    text-align: right;
}
.dpc-modal-box input[type="number"]:focus,
.dpc-modal-box input[type="text"]:focus {
    border-color: var(--dpc-primary);
}

/* ── آپلود رسید ── */
.dpc-modal-box input[type="file"] {
    font-size: 12px;
    font-family: var(--dpc-font);
    cursor: pointer;
}

.dpc-file-hint {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 2px;
}

/* ── پیام خطا ── */
#dpc-recharge-error {
    font-size: 12px;
    color: var(--dpc-danger);
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 8px 12px;
    display: none;
}
#dpc-recharge-error:not(:empty) { display: block; }

/* ── دکمه‌های مودال ── */
.dpc-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 4px;
}

#dpc-recharge-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid var(--dpc-border);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--dpc-font);
    transition: background .2s;
}
#dpc-recharge-cancel:hover { background: #e2e8f0; }

#dpc-recharge-submit {
    background: var(--dpc-primary);
    color: #fff;
    border: none;
    padding: 8px 22px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--dpc-font);
    font-weight: 700;
    transition: background .2s;
}
#dpc-recharge-submit:hover    { background: var(--dpc-primary-dark); }
#dpc-recharge-submit:disabled {
    background: #a5b4fc;
    cursor: not-allowed;
}

/* ==============================================
   ۹. دکمه درخواست کد شارژ (inbox)
   ============================================== */
#dpc-recharge-btn,
.dpc-recharge-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--dpc-success);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--dpc-font);
    font-weight: 600;
    transition: background .2s, transform .1s;
}
#dpc-recharge-btn:hover  { background: #15803d; }
#dpc-recharge-btn:active { transform: scale(.97); }

/* ==============================================
   ۱۰. ریسپانسیو
   ============================================== */
@media (max-width: 600px) {
    .dpc-support-chat-wrap { border-radius: 0; }
    .dpc-messages-area     { height: 340px; }
    .dpc-msg-row           { max-width: 90%; }
    .dpc-chat-header       { padding: 10px 12px; }
    .dpc-chat-header h3    { font-size: 13px; }
    .dpc-modal-box         { padding: 20px 16px 16px; }
    .dpc-modal-actions     { flex-direction: column-reverse; }
    #dpc-recharge-cancel,
    #dpc-recharge-submit   { width: 100%; text-align: center; }
    .dpc-agent-chat-box    { height: 240px; }
}






        /* ─── قفل اسکرول بدنه هنگام باز بودن مودال ─── */
        .dpc-modal-body-lock {
            overflow: hidden;
        }

        /* ─── لیست تیکت‌ها ─── */
        .dpc-ticket-list { list-style: none; padding: 0; margin: 0; }
        .dpc-ticket-item {
            border: 1px solid #ddd;
            margin-bottom: 10px;
            padding: 12px;
            border-radius: 8px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: #fff;
            flex-wrap: wrap;
            gap: 8px;
        }
        .dpc-ticket-info strong { display: block; font-size: 1.1em; }
        .dpc-ticket-status { font-size: 0.85em; color: #555; margin-right: 10px; }
        .dpc-ticket-actions button {
            margin-right: 8px;
            padding: 6px 12px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .dpc-view-ticket-btn   { background: #2271b1; color: #fff; }
        .dpc-delete-ticket-btn { background: #d63638; color: #fff; }

        /* ─── اورلی مودال ─── */
        .dpc-modal {
            display: none;
            position: fixed;
            z-index: 99999;
            inset: 0;                          /* top/right/bottom/left: 0 */
            background-color: rgba(0,0,0,0.55);
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            /* متغیر CSS برای ارتفاع نوار ناوبری — مقدار پیش‌فرض ۰ */
            --dpc-navbar-height: 0px;
        }
        .dpc-modal.dpc-modal--open {
            display: flex;
            align-items: flex-start;
            justify-content: center;
        }

        /* ─── محتوای مودال ─── */
        .dpc-modal-content {
            position: relative;
            background: #fff;
            border-radius: 12px;
            padding: 20px;
            width: 90%;
            max-width: 700px;
            /* فاصله از بالا: ارتفاع نوار + ۱۶px فضای تنفس */
            margin-top: calc(var(--dpc-navbar-height) + 16px);
            margin-bottom: 24px;
            box-sizing: border-box;
        }

        /* ─── هدر مودال ─── */
        .dpc-modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #eee;
            padding-bottom: 10px;
            margin-bottom: 0;
        }
        .dpc-modal-header h3 { margin: 0; font-size: 1.1em; }
        .dpc-modal-close {
            cursor: pointer;
            font-size: 28px;
            color: #d63638;
            line-height: 1;
            padding: 0 4px;
        }

        /* ─── باکس پیام‌ها ─── */
        .dpc-modal-messages {
            height: 300px;
            overflow-y: auto;
            border: 1px solid #ddd;
            padding: 10px;
            margin: 15px 0;
            background: #fafafa;
            border-radius: 8px;
            -webkit-overflow-scrolling: touch;
        }
        .dpc-no-msg { text-align: center; color: #888; padding: 20px 0; }

        /* ─── فرم ارسال پیام ─── */
        .dpc-modal-reply-form {
            display: none;
            margin-bottom: 15px;
            border-top: 1px solid #eee;
            padding-top: 15px;
        }
        .dpc-reply-textarea {
            width: 100%;
            box-sizing: border-box;
            margin-bottom: 10px;
            padding: 8px;
            border-radius: 4px;
            border: 1px solid #ccc;
            resize: vertical;
        }
        .dpc-reply-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
        }
        .dpc-file-label { cursor: pointer; color: #555; white-space: nowrap; }
        .dpc-file-input { display: none; }
        .dpc-filename   { font-size: 12px; color: #888; flex: 1; text-align: center; }
        .dpc-submit-btn {
            background: #2271b1;
            color: #fff;
            border: none;
            padding: 8px 15px;
            border-radius: 4px;
            cursor: pointer;
            white-space: nowrap;
        }
        .dpc-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

        /* ─── دکمه بستن پایین ─── */
        .dpc-modal-close-btn {
            width: 100%;
            margin-top: 10px;
            padding: 10px;
            background: #f1f1f1;
            border: 1px solid #ccc;
            border-radius: 4px;
            cursor: pointer;
            font-weight: bold;
        }

        /* ─── حباب‌های چت ─── */
        .dpc-msg-row    { display: flex; margin-bottom: 12px; }
        .dpc-msg-me     { justify-content: flex-end; }
        .dpc-msg-other  { justify-content: flex-start; }
        .dpc-bubble {
            max-width: 70%;
            background: #e9ecef;
            padding: 8px 12px;
            border-radius: 18px;
        }
        .dpc-msg-me .dpc-bubble { background: #007bff; color: #fff; }
        .dpc-bubble-text  { margin: 0; }
        .dpc-bubble-time  { font-size: 0.7em; opacity: 0.7; display: block; margin-top: 4px; }
        .dpc-msg-image img {
            max-width: 200px;
            max-height: 200px;
            border-radius: 8px;
            margin-top: 6px;
            display: block;
        }

        /* ─── موبایل ─── */
        @media (max-width: 600px) {
            .dpc-modal-content {
                width: 96%;
                padding: 14px;
                border-radius: 8px;
                /* روی موبایل فاصله کمتری از نوار کافی است */
                margin-top: calc(var(--dpc-navbar-height) + 8px);
                margin-bottom: 12px;
            }
            .dpc-modal-messages {
                /* ارتفاع پویا: کل صفحه منهای نوار ناوبری، هدر، فرم و دکمه */
                height: calc(100svh - var(--dpc-navbar-height) - 280px);
                min-height: 120px;
            }
            .dpc-ticket-item {
                flex-direction: column;
                align-items: flex-start;
            }
            .dpc-reply-actions {
                flex-direction: column;
                align-items: stretch;
            }
            .dpc-submit-btn { width: 100%; text-align: center; }
            .dpc-filename   { text-align: right; }
        }



/* استایل پایه برای تمام دکمه‌ها */
.button {
    padding: 10px 20px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px; /* گوشه‌های گرد */
    border: none;
    cursor: pointer;
    transition: all 0.3s ease; /* انیمیشن نرم برای تغییرات */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* استایل اختصاصی برای دکمه اصلی (Primary) */
.button-primary {
    background-color: #3b82f6; /* رنگ آبی جذاب */
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* افکت هنگام بردن موس روی دکمه */
.button-primary:hover {
    background-color: #2563eb; /* تیره شدن رنگ هنگام هاور */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px); /* کمی بالا آمدن */
}

/* افکت هنگام کلیک */
.button-primary:active {
    transform: translateY(0);
    background-color: #1d4ed8;
}



        