.suggest-doc-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.suggest-doc-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 1400px;
    min-height: 90vh;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin: auto;
}

.suggest-doc-modal-header {
    padding: 30px 40px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(to bottom, #f8f9fa, #fff);
}

.suggest-doc-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.4;
}

.suggest-doc-modal-header .header-description {
    margin-top: 8px;
    font-size: 14px;
    color: #666;
    font-weight: 400;
}

.suggest-doc-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.suggest-doc-modal-close:hover {
    color: #000;
}

.suggest-doc-modal-body {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
    background: #f8f9fa;
}

.suggest-doc-layout {
    display: flex;
    gap: 30px;
    min-height: 500px;
    align-items: flex-start;
}

.suggest-doc-answer-section {
    flex: 1;
    min-width: 0;
}

.suggest-doc-answer-section h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggest-doc-answer-section .ai-icon {
    font-size: 20px;
}

.suggest-doc-articles-section {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.suggest-doc-articles-section h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
}

.suggest-doc-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.suggest-doc-content {
    margin-top: 10px;
}

.suggest-doc-item {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s;
    background: #fff;
    position: relative;
}

.suggest-doc-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #28a745;
    transform: translateY(-2px);
}

.suggest-doc-item.most-relevant {
    border-color: #28a745;
    background: #f0f9f4;
}

.suggest-doc-item.most-relevant::before {
    content: 'مرتبط ترین مقاله';
    position: absolute;
    top: 15px;
    left: 15px;
    background: #28a745;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    z-index: 1;
}

.suggest-doc-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.suggest-doc-item-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    flex: 1;
    line-height: 1.4;
}

.suggest-doc-item-subtitle {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

.suggest-doc-item-title a {
    color: #0066cc;
    text-decoration: none;
}

.suggest-doc-item-title a:hover {
    text-decoration: underline;
}

.suggest-doc-item-score {
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    color: #666;
    margin-right: 10px;
}

.suggest-doc-item-answer {
    margin-top: 10px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
    font-size: 14px;
    color: #555;
    line-height: 1.6;
}

.suggest-doc-modal-footer {
    padding: 30px 40px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    background: #fff;
}

.suggest-doc-articles-section .footer-button {
    margin-top: auto;
    padding-top: 20px;
}

.suggest-doc-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    min-width: 150px;
}

.suggest-doc-btn-primary {
    background: #0066cc;
    color: #fff;
}

.suggest-doc-btn-primary:hover {
    background: #0052a3;
}

.suggest-doc-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.suggest-doc-btn-secondary:hover {
    background: #e0e0e0;
}

.suggest-doc-btn-success {
    background: #28a745;
    color: #fff;
}

.suggest-doc-btn-success:hover {
    background: #218838;
}

.suggest-doc-btn-warning {
    background: #ffc107;
    color: #333;
}

.suggest-doc-btn-warning:hover {
    background: #e0a800;
}

.suggest-doc-answer {
    margin-top: 20px;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #0066cc;
    border-radius: 6px;
}

.suggest-doc-answer h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #0066cc;
}

.suggest-doc-answer-content-wrap {
    max-height: 320px;
    overflow-y: auto;
    background: #2c3e50;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.suggest-doc-answer-content {
    font-size: 15px;
    color: #2c3e50;
    line-height: 1.8;
    padding: 30px;
    color: #fff;
    border: none;
    min-height: 200px;
    position: relative;
}

.suggest-doc-answer-content p {
    margin: 0 0 15px 0;
    color: #fff;
    line-height: 1.8;
}

.suggest-doc-answer-content p:last-child {
    margin-bottom: 0;
}

.suggest-doc-answer-content p:first-child {
    margin-top: 0;
}

.suggest-doc-answer-placeholder {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
}

/* AI answer loading state: title + shimmer bars */
.suggest-doc-answer-loading {
    padding: 20px 0;
}

.suggest-doc-answer-loading-title {
    margin: 0 0 24px 0;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.85);
    text-align: right;
}

.suggest-doc-shimmer-bars {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.suggest-doc-shimmer-line {
    height: 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    position: relative;
    overflow: hidden;
}

.suggest-doc-shimmer-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 30%,
    rgba(255, 255, 255, 0.35) 50%,
    rgba(255, 255, 255, 0.2) 70%,
    transparent 100%);
    animation: suggest-doc-shimmer 1.6s ease-in-out infinite;
}

@keyframes suggest-doc-shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(250%);
    }
}

.suggest-doc-answer-feedback {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding-right: 4px;
}

.suggest-doc-feedback-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.suggest-doc-feedback-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.08);
}

.suggest-doc-feedback-btn.selected {
    background: rgba(76, 175, 80, 0.9);
    border-color: rgba(76, 175, 80, 1);
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.4);
    transform: scale(1.1);
}

.suggest-doc-feedback-btn[data-feedback="down"].selected {
    background: rgba(244, 67, 54, 0.9);
    border-color: rgba(244, 67, 54, 1);
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.4);
}

.suggest-doc-feedback-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.suggest-doc-btn-submit {
    background: #0066cc;
    color: #fff;
    opacity: 1;
}

.suggest-doc-btn-submit:hover {
    background: #0052a3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.suggest-doc-btn-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.suggest-doc-btn-submit:disabled:hover {
    background: #0066cc;
    transform: none;
    box-shadow: none;
}

.suggest-doc-btn-edit {
    background: #fff;
    color: #333;
    border: 2px solid #e0e0e0;
}

.suggest-doc-btn-edit:hover {
    background: #f8f9fa;
    border-color: #ccc;
}

#ticket-ai-modal .modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    font-family: inherit;
}

#ticket-ai-modal .modal-header {
    border-bottom: 1px solid #eee;
    padding: 20px 25px;
    background: #fff;
    border-radius: 12px 12px 0 0;
}

#ticket-ai-modal .modal-title {
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

#ticket-ai-modal .modal-subtitle {
    font-size: 13px;
    color: #777;
    margin-top: 5px;
}

#ticket-ai-modal .modal-body {
    padding: 0;
    background: #f9f9f9;
    display: flex;
    flex-wrap: wrap;
}

/* Ø³ØªÙˆÙ† Ø±Ø§Ø³Øª */
.ai-sidebar {
    width: 30%;
    background: #fff;
    border-left: 1px solid #eee;
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.ai-sidebar-title {
    font-size: 14px;
    font-weight: bold;
    color: #555;
    margin-bottom: 15px;
}

.ai-doc-item {
    display: block;
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.2s;
    text-decoration: none !important;
    color: #444;
    background: #fff;
}

.ai-doc-item:hover {
    border-color: #007bff;
    background: #f0f9ff;
}

.ai-doc-item.active {
    border: 1px solid #28a745;
    background: #f6fff8;
}

.ai-doc-title {
    font-weight: bold;
    font-size: 13px;
    display: block;
    margin-bottom: 4px;
}

.ai-doc-desc {
    font-size: 11px;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.badge-related {
    background: #28a745;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    float: left;
}

.ai-content-area {
    width: 70%;
    padding: 25px;
    position: relative;
    background: #fff;
}

.ai-header-badge {
    display: inline-block;
    background: #28a745;
    color: #fff;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 12px;
    margin-bottom: 10px;
    vertical-align: top;
}

#ai-status-badge {
    transition: opacity 0.45s ease;
}

.ai-main-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
}

.ai-response-box {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px;
    font-size: 13px;
    line-height: 1.8;
    color: #444;
    max-height: 450px;
    overflow-y: auto;
    min-height: 150px;
}

.ai-response-box pre {
    direction: ltr;
    text-align: left;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-response-box code {
    background: #f3f4f6;
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 12px;
}

.ai-response-box ul {
    margin: 8px 0;
    padding-right: 18px;
}

.ai-response-box h3,
.ai-response-box h4,
.ai-response-box h5 {
    margin: 10px 0 6px;
    font-weight: 700;
}

.ai-response-box.skeleton-loading {
    background: #f3f3f3 !important;
    border-color: #d2d1d1;
}

/* Skeleton Loading Animation */
.skeleton-line {
    height: 12px;
    margin-bottom: 10px;
    border-radius: 4px;

    background: linear-gradient(
            110deg,
            #eeeeee 0%,
            #f5f5f5 20%,
            #eeeeee 40%,
            #eeeeee 100%
    );

    background-size: 220% 100%;
    animation: skeleton-shine 1.8s ease-in-out infinite;
}

.ai-response-box.skeleton-loading .skeleton-line {
    background: linear-gradient(
            110deg,
            #e7e7e7 0%,
            #f1f1f1 22%,
            #e7e7e7 45%,
            #e7e7e7 100%
    );

    background-size: 220% 100%;
}


.skeleton-line.short {
    width: 60%;
}

.skeleton-line.medium {
    width: 80%;
}

.skeleton-line.full {
    width: 100%;
}

@keyframes skeleton-shine {
    to {
        background-position-x: -200%;
    }
}

/* Feedback & Footer */
.ai-feedback-section {
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-feedback-btns button {
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    padding: 5px 12px;
    border-radius: 6px;
    margin-left: 5px;
}

.ai-feedback-btns button.active-up {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.ai-feedback-btns button.active-down {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

#ticket-ai-modal .modal-footer {
    background: #fff;
    border-top: 1px solid #eee;
    padding: 5px 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center;
    border-radius: 0 0 12px 12px;
    direction: ltr;
    width: 100%;
    box-sizing: border-box;
}

#ticket-ai-modal .footer-actions-left {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    padding: 20px;
}

#ticket-ai-modal .footer-actions-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    justify-content: flex-end;
    padding: 0 20px;
}

.btn-solved {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
    padding: 8px 20px;
    border-radius: 6px;
}

.btn-submit-real {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
    padding: 8px 20px;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-submit-real:disabled {
    background-color: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
    opacity: 0.7;
}

.btn-edit-ticket {
    background-color: #fff;
    border: 1px solid #ccc;
    color: #555;
    padding: 8px 20px;
    border-radius: 6px;
}

/* ÙÙ‚Ø· Ù…Ù‚Ø§Ù„Ø§Øª (Ø¨Ø¯ÙˆÙ† Ù¾Ø§Ø³Ø® AI) â€” Ø³ØªÙˆÙ† AI Ù…Ø®ÙÛŒØŒ Ù„ÛŒØ³Øª Ù…Ù‚Ø§Ù„Ø§Øª ØªÙ…Ø§Ù… Ø¹Ø±Ø¶ */
#ticket-ai-modal .modal-body.articles-only .ai-content-area {
    display: none !important;
}

#ticket-ai-modal .modal-body.articles-only .ai-sidebar {
    width: 100%;
    max-width: 100%;
    flex: 1 1 100%;
    border-left: none;
    max-height: min(70vh, 620px);
}

@media (max-width: 768px) {

    .ai-sidebar,
    .ai-content-area {
        width: 100%;
        border-left: none;
    }

    .ai-sidebar {
        border-bottom: 1px solid #eee;
        max-height: 200px;
    }

    #ticket-ai-modal .modal-body.articles-only .ai-sidebar {
        border-bottom: none;
        max-height: min(70vh, 620px);
    }
}

.ticket-ai-suggest-form-wrap {
    position: relative;
}

.ticket-ai-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    box-sizing: border-box;
    direction: rtl;
    background: rgba(248, 249, 250, 0.78);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    border-radius: 6px;
}

.ticket-ai-form-overlay.is-visible {
    display: flex;
}

.ticket-ai-form-overlay__card {
    width: 100%;
    max-width: min(95vw, 780px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    text-align: right;
}

.ticket-ai-form-overlay__head {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 32px 36px 20px 36px;
    min-width: 0;
}

.ticket-ai-form-overlay__head .ticket-ai-form-overlay__spinner {
    flex-shrink: 0;
    font-size: 2rem;
    color: #2c3e50;
    line-height: 1;
}

.ticket-ai-form-overlay__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.55;
}

.ticket-ai-form-overlay__sub {
    font-size: 1.2rem;
    color: #5c636a;
    margin: 0 36px 22px 36px;
    line-height: 1.65;
}

.ticket-ai-form-overlay__divider {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 0;
}

.ticket-ai-form-overlay__note {
    font-size: 1.1rem;
    color: #6c757d;
    line-height: 1.7;
    margin: 0;
    padding: 22px 36px 32px 36px;
    background: #fafbfc;
}

#btn-suggest-doc-submit.ticket-ai-submit-loading {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #fff !important;
    opacity: 1 !important;
    cursor: wait !important;
}

.ticket-ai-btn-loading-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-direction: row;
    direction: ltr;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
}

.ticket-ai-btn-loading-inner .fa-spinner {
    font-size: 1.15rem;
    color: #fff;
}

.ai-submit-progress-btn {
    position: relative;
    overflow: hidden;
}

.ai-submit-progress-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: rgba(255, 255, 255, 0.25);
    transition: width 0.08s linear;
    pointer-events: none;
}

.ai-submit-progress-text {
    position: relative;
    z-index: 2;
}

.ai-progress-button {
    position: relative;
    overflow: hidden;
    min-width: 180px;
    height: 38px;
    border: none;
    border-radius: 6px;
    background: #e5e7eb;
    color: #111;
    cursor: not-allowed;
}

.ai-progress-button:not(:disabled) {
    cursor: pointer;
}

.ai-progress-button .progress-fill {
    position: absolute;
    top: 0;
    right: 0;
    /* برای RTL بهتر از right شروع شود */
    height: 100%;
    width: 0%;
    background: #2563eb;
    transition: width 0.12s linear;
    z-index: 1;
}

.ai-progress-button .button-text {
    position: relative;
    z-index: 2;
    color: #111;
}

.ai-progress-button:not(:disabled) .button-text {
    color: #fff;
}
.ai-progress-button.is-ready .button-text {
    color: #fff;
}

.ai-progress-button.is-ready .progress-fill {
    width: 100%;
}

.ai-progress-button.is-ready .progress-fill {
    width: 100% !important;
}

.ai-progress-button.is-ready .button-text {
    color: #fff;
}