/**
 * Mazraeh Chat Widget Styles
 * Version: 11.0 - Fixed mobile nav conflict
 */

/* ========================================
   BASE WIDGET - فقط به اندازه آیکون فضا بگیرد
======================================== */
.mz-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Vazirmatn', sans-serif;
    /* ✅ FIX: ویجت فقط به اندازه محتوا فضا بگیرد */
    width: auto;
    height: auto;
    /* ✅ FIX: خود ویجت کلیک نگیرد، فقط فرزندانش */
    pointer-events: none;
}

/* ✅ آیکون چت - قابل کلیک */
.mz-chat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2D5A27 0%, #D4A853 100%);
    box-shadow: 0 4px 20px rgba(45, 90, 39, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    animation: mzChatPulse 2s infinite;
    border: 3px solid #fef7ec;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* ✅ FIX: آیکون قابل کلیک باشد */
    pointer-events: auto;
}

.mz-chat-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(45, 90, 39, 0.5);
}

.mz-chat-icon.active {
    animation: none;
    transform: rotate(45deg);
}

@keyframes mzChatPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 20px rgba(45, 90, 39, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 6px 30px rgba(45, 90, 39, 0.6); }
}

/* ========================================
   CHAT WINDOW - پنجره چت
======================================== */
.mz-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: mzChatSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(212, 168, 83, 0.2);
    /* ✅ پنجره چت قابل کلیک باشد */
    pointer-events: auto;
}

.mz-chat-window.active {
    display: flex;
}

@keyframes mzChatSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========================================
   HEADER
======================================== */
.mz-chat-header {
    background: linear-gradient(135deg, #2D5A27 0%, #1a3d16 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid rgba(212, 168, 83, 0.3);
    flex-shrink: 0;
}

.mz-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.mz-chat-header-text {
    flex: 1;
    min-width: 0;
}

.mz-chat-header-text h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.mz-chat-header-text p {
    font-size: 0.72rem;
    opacity: 0.9;
    margin: 2px 0 0;
    transition: color 0.3s;
}

/* ========================================
   AVATARS
======================================== */
.mz-chat-admin-avatars {
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    margin-left: 12px;
    flex-shrink: 0;
    padding: 4px 8px 4px 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    position: relative;
}

.mz-admin-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #D4A853, #8b5a2b);
    color: #fff;
    font-size: 0.85rem;
    position: relative;
    transition: all 0.25s ease;
    flex-shrink: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    margin-left: -10px;
}

.mz-admin-avatar:first-child {
    margin-left: 0;
}

.mz-admin-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
    position: relative;
    z-index: 2;
    pointer-events: none;
    -webkit-user-drag: none;
}

.mz-admin-avatar i {
    font-size: 1rem;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
    z-index: 3;
    pointer-events: none;
}

.mz-admin-avatar.has-image i {
    display: none !important;
}

.mz-admin-avatar.has-image {
    background: transparent !important;
}

.mz-admin-avatar:hover {
    transform: scale(1.2);
    z-index: 20 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
    margin-left: -2px;
}

.mz-admin-avatar:nth-child(1) { z-index: 5; }
.mz-admin-avatar:nth-child(2) { z-index: 4; }
.mz-admin-avatar:nth-child(3) { z-index: 3; }
.mz-admin-avatar:nth-child(4) { z-index: 2; }
.mz-admin-avatar:nth-child(5) { z-index: 1; }
.mz-admin-avatar:nth-child(n+6) { z-index: 0; }

.mz-admin-avatar.small {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
    margin-left: -9px;
}

.mz-admin-avatar.small:first-child {
    margin-left: 0;
}

.mz-admin-avatar.tiny {
    width: 26px;
    height: 26px;
    font-size: 0.65rem;
    margin-left: -8px;
}

.mz-admin-avatar.tiny:first-child {
    margin-left: 0;
}

.mz-admin-avatar.bot-avatar {
    background: linear-gradient(135deg, #D4A853, #8b5a2b);
}

.mz-admin-avatar.bot-avatar i {
    font-size: 1.1rem;
}

.mz-admin-avatar.default-avatar {
    background: linear-gradient(135deg, #94a3b8, #64748b);
}

.mz-admin-avatar.default-avatar i {
    font-size: 0.95rem;
}

.mz-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mz-chat-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

/* ========================================
   MESSAGES
======================================== */
.mz-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    scroll-behavior: smooth;
}

.mz-chat-messages::-webkit-scrollbar { width: 6px; }
.mz-chat-messages::-webkit-scrollbar-thumb { background: #e2d5c1; border-radius: 10px; }
.mz-chat-messages::-webkit-scrollbar-track { background: transparent; }

.mz-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    animation: mzMessageSlide 0.3s ease;
    word-wrap: break-word;
    user-select: text;
    -webkit-user-select: text;
    transition: background 0.3s;
}

@keyframes mzMessageSlide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.mz-message.user {
    background: linear-gradient(135deg, #2D5A27 0%, #1a3d16 100%);
    color: #fff;
    margin-left: auto;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.2);
}

.mz-message.bot,
.mz-message.admin {
    background: linear-gradient(135deg, #fef7ec 0%, #fdf3e0 100%);
    color: #2c2a24;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(212, 168, 83, 0.15);
    border: 1px solid rgba(212, 168, 83, 0.3);
}

.mz-message-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.mz-message.bot .mz-message-header { color: #8b5a2b; }
.mz-message.admin .mz-message-header { color: #2D5A27; }

.mz-sender-name {
    font-weight: 700;
    font-size: 0.75rem;
    opacity: 0.9;
}

.mz-message-text {
    font-size: 0.85rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.mz-message-time {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.mz-message-ticks { font-size: 0.7rem; opacity: 0.8; }
.mz-message-ticks.read { color: #4CAF50; }

.mz-message-text::selection { background: rgba(212, 168, 83, 0.4); color: #2c2a24; }
.mz-message.user .mz-message-text::selection { background: rgba(255, 255, 255, 0.3); color: #fff; }

/* ========================================
   REPLY BUBBLES
======================================== */
.mz-reply-bubble {
    background: rgba(0, 0, 0, 0.12);
    padding: 6px 10px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.95);
    border-right: 3px solid rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background 0.2s;
}

.mz-reply-bubble:hover { background: rgba(0, 0, 0, 0.2); }
.mz-reply-bubble i { font-size: 0.7rem; opacity: 0.8; flex-shrink: 0; }
.mz-reply-bubble span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

.mz-reply-bubble-admin {
    background: rgba(45, 90, 39, 0.08);
    padding: 8px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 0.78rem;
    border-right: 3px solid #D4A853;
    cursor: pointer;
    transition: background 0.2s;
    max-width: 100%;
    color: #1a3d16;
}

.mz-reply-bubble-admin:hover { background: rgba(45, 90, 39, 0.15); }

.mz-reply-bubble-label {
    font-weight: 700;
    font-size: 0.7rem;
    margin-bottom: 3px;
    color: #D4A853;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mz-reply-bubble-label i { font-size: 0.65rem; }

.mz-reply-bubble-text {
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.95;
    font-size: 0.78rem;
    color: #F7E8DB;
    line-height: 1.4;
    max-height: 40px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mz-swipe-reply-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #D4A853, #8b5a2b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    pointer-events: none;
}

/* ========================================
   VOICE PLAYER
======================================== */
.mz-voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    max-width: 280px;
    padding: 4px 0;
}

.mz-voice-player .mz-voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4A853, #8b5a2b);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mz-voice-player .mz-voice-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(212,168,83,0.4);
}

.mz-voice-player.playing .mz-voice-play-btn {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    animation: voicePulse 1.5s infinite;
}

@keyframes voicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.mz-voice-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mz-voice-progress {
    height: 6px;
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: height 0.2s;
    direction: ltr;
}

.mz-voice-progress:hover { height: 8px; }

.mz-message.admin .mz-voice-progress,
.mz-message.bot .mz-voice-progress { background: rgba(0,0,0,0.15); }

.mz-voice-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #D4A853, #8b5a2b);
    border-radius: 10px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.mz-message.admin .mz-voice-progress-fill,
.mz-message.bot .mz-voice-progress-fill {
    background: linear-gradient(90deg, #D4A853, #2D5A27);
}

.mz-voice-progress-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #D4A853;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mz-voice-progress:hover .mz-voice-progress-fill::after { opacity: 1; }

.mz-voice-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    opacity: 0.7;
    direction: ltr;
}

.mz-voice-current { font-weight: 600; }
.mz-voice-duration { opacity: 0.8; }

.mz-voice-recording {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    padding: 10px 16px;
    background: #fef7ec;
    border-radius: 24px;
    animation: mzRecordingPulse 1s infinite;
}

@keyframes mzRecordingPulse {
    0%, 100% { background: #fef7ec; }
    50% { background: #fce7d3; }
}

.mz-voice-record-dot {
    width: 12px;
    height: 12px;
    background: #ef4444;
    border-radius: 50%;
    animation: mzRecordBlink 1s infinite;
    flex-shrink: 0;
}

@keyframes mzRecordBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.mz-voice-timer {
    font-size: 0.85rem;
    color: #8b7355;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.mz-voice-cancel-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}

.mz-voice-cancel-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ========================================
   REGISTER FORM
======================================== */
/* ✅ استایل جدید فرم ثبت‌نام با لبه‌های گرد */
.mz-chat-register {
    padding: 24px 20px;
    background: #ffffff;
    border-radius: 20px; /* ✅ لبه‌های کاملاً گرد */
    border: 1px solid rgba(212, 168, 83, 0.2);
    box-shadow: 0 8px 24px rgba(45, 90, 39, 0.08);
    text-align: center;
    margin: 10px; /* ✅ فاصله از لبه‌های پنجره چت */
    animation: mzMessageSlide 0.4s ease;
}

.mz-chat-register h3 {
    color: #2D5A27;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.6;
}

.mz-chat-register input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e8dcc8;
    border-radius: 12px; /* ✅ لبه‌های گرد برای اینپوت‌ها */
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    background: #fdfbf7;
}

.mz-chat-register input:focus {
    border-color: #D4A853;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

.mz-chat-register button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #2D5A27 0%, #1a3d16 100%);
    border: none;
    border-radius: 12px; /* ✅ لبه‌های گرد برای دکمه */
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(45, 90, 39, 0.2);
}

.mz-chat-register button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 90, 39, 0.35);
}

/* ✅ استایل دکمه "مشکل حل نشد" */
.mz-faq-btn-start {
    background: linear-gradient(135deg, #D4A853 0%, #8b5a2b 100%) !important;
    margin-top: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mz-faq-btn-start:hover {
    background: linear-gradient(135deg, #e6b85c 0%, #9c6832 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 168, 83, 0.4);
}

/* ========================================
   INPUT AREA
======================================== */
.mz-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #f0ebe3;
    flex-shrink: 0;
}

.mz-chat-input-wrapper {
    flex: 1;
    background: #f5f5f5;
    border-radius: 24px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.mz-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 4px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    max-height: 100px;
    resize: none;
    line-height: 1.4;
    min-height: 24px;
}

.mz-chat-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.mz-chat-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #8b7355;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mz-chat-action-btn:hover { background: #f0ebe3; color: #D4A853; }

.mz-chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4A853 0%, #8b5a2b 100%);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.mz-chat-send-btn i { margin: 0; padding: 0; line-height: 1; display: block; }

.mz-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.4);
}

.mz-chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ========================================
   REPLY PREVIEW
======================================== */
.mz-reply-preview {
    display: none;
    padding: 10px 16px;
    background: #fef7ec;
    border-top: 1px solid #f0ebe3;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.mz-reply-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: #8b7355;
    cursor: pointer;
    padding: 8px 12px;
    background: #fff;
    border-radius: 10px;
    border-right: 3px solid #D4A853;
    transition: all 0.2s;
    min-width: 0;
}

.mz-reply-content:hover { background: #fdf3e0; }
.mz-reply-content i { color: #D4A853; font-size: 1.1rem; flex-shrink: 0; }

.mz-reply-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mz-reply-label { color: #D4A853; font-weight: 600; font-size: 0.72rem; }

.mz-reply-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    font-size: 0.8rem;
    color: #2c2a24;
}

.mz-reply-cancel {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mz-reply-cancel:hover { transform: rotate(90deg); }

/* ========================================
   CONTEXT MENU
======================================== */
.mz-context-menu {
    position: fixed;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 8px 0;
    z-index: 100001;
    min-width: 150px;
    border: 1px solid #f0ebe3;
    animation: mzContextMenuIn 0.2s ease;
}

@keyframes mzContextMenuIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.mz-context-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #2c2a24;
    transition: all 0.2s;
}

.mz-context-item:hover { background: #fef7ec; color: #D4A853; }
.mz-context-item i { width: 16px; text-align: center; color: #8b7355; }
.mz-context-item:hover i { color: #D4A853; }

/* ========================================
   IMAGE MODAL
======================================== */
.mz-image-modal {
    position: fixed;
    inset: 0;
    z-index: 100002;
    display: none;
    align-items: center;
    justify-content: center;
}

.mz-image-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(8px);
}

.mz-image-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 1;
}

.mz-image-modal-content img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.mz-image-modal-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mz-image-modal-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

.mz-image-modal-download {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #D4A853, #8b5a2b);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.mz-image-modal-download:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 168, 83, 0.4);
}

/* ========================================
   FILE & IMAGE
======================================== */
.mz-file-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
    display: block;
}

.mz-file-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mz-file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 6px;
}

.mz-file-info i { font-size: 1.1rem; }

.mz-message.bot .mz-file-info,
.mz-message.admin .mz-file-info { color: #8b7355; }

.mz-file-download-link {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    transition: all 0.2s;
}

.mz-file-download-link:hover { color: #D4A853; text-decoration: none; }

/* ========================================
   FAQ
======================================== */
.mz-faq-container {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid rgba(212, 168, 83, 0.2);
    animation: mzMessageSlide 0.3s ease;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.mz-faq-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: #2D5A27;
    margin-bottom: 12px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mz-faq-header i { color: #D4A853; }

.mz-faq-btn {
    width: 100%;
    background: linear-gradient(135deg, #2D5A27 0%, #1a3d16 100%);
    border: none;
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 8px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: center;
    line-height: 1.4;
}

.mz-faq-btn:hover {
    background: linear-gradient(135deg, #D4A853 0%, #8b5a2b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 168, 83, 0.3);
}

.mz-faq-btn:last-child { margin-bottom: 0; }

/* ========================================
   TOAST
======================================== */
.mz-chat-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #3b82f6;
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100003;
    font-size: 0.85rem;
    opacity: 0;
    transition: all 0.3s ease;
    font-family: 'Vazirmatn', sans-serif;
    max-width: 90vw;
    text-align: center;
}

.mz-chat-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.mz-chat-toast-error { background: #ef4444; }
.mz-chat-toast-success { background: #10b981; }
.mz-chat-toast-info { background: #3b82f6; }
.mz-chat-toast-warning { background: #f59e0b; }

/* ========================================
   IMAGE LOADING & PREVIEW
======================================== */
.mz-image-container {
    position: relative;
    min-height: 100px;
    margin-bottom: 8px;
}

.mz-image-loading-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.05);
    border-radius: 12px;
    gap: 8px;
    z-index: 1;
}

.mz-image-loading-indicator i { font-size: 1.5rem; color: #D4A853; }
.mz-image-loading-indicator span { font-size: 0.75rem; color: #8b7355; }

.mz-lazy-image { transition: opacity 0.3s ease; min-height: 50px; }
.mz-lazy-image.loaded { opacity: 1; }
.mz-lazy-image.error { opacity: 0.5; filter: grayscale(1); }

.mz-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.05);
    border-radius: 12px;
    gap: 8px;
    min-height: 100px;
}

.mz-image-placeholder i { font-size: 2rem; color: #94a3b8; }
.mz-image-placeholder span { font-size: 0.8rem; color: #94a3b8; }

.mz-image-preview {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
    animation: mzMessageSlide 0.3s ease;
}

.mz-image-preview-content {
    max-width: 200px;
    background: #f0ebe3;
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mz-image-preview-content img { width: 100%; border-radius: 8px; opacity: 0.7; }
.mz-image-preview-label { font-size: 0.7rem; color: #8b7355; text-align: center; }

/* ========================================
   ✅ RESPONSIVE - FIX MOBILE NAV CONFLICT
======================================== */

/* تبلت */
@media (max-width: 768px) {
    /* ✅ آیکون چت بالاتر از منوی موبایل */
    .mz-chat-widget {
        bottom: 95px;
        right: 20px;
    }
    
    /* ✅ پنجره چت تمام عرض */
    .mz-chat-window {
        position: fixed;
        bottom: 100px;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        height: calc(100vh - 180px);
        border-radius: 20px;
    }
    
    .mz-chat-icon {
        width: 54px;
        height: 54px;
        font-size: 1.25rem;
    }
}

/* موبایل کوچک */
@media (max-width: 480px) {
    /* ✅ FIX: فقط right و bottom - بدون left */
    .mz-chat-widget {
        bottom: 100px;
        right: 15px;
        /* ❌ left حذف شد - دیگر کل عرض را نمی‌گیرد */
    }
    
    /* ✅ پنجره چت */
    .mz-chat-window {
        position: fixed;
        bottom: 105px;
        right: 8px !important;
        left: 8px !important;
        width: auto !important;
        height: calc(100vh - 185px);
        border-radius: 18px;
    }
    
    .mz-chat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .mz-chat-header { padding: 12px 14px; }
    .mz-chat-header-text h3 { font-size: 0.9rem; }
    
    .mz-admin-avatar {
        width: 30px;
        height: 30px;
        margin-left: -8px;
    }
    
    .mz-admin-avatar:first-child { margin-left: 0; }
    .mz-admin-avatar i { font-size: 0.85rem; }
    
    .mz-message { max-width: 88%; }
    .mz-chat-input-area { padding: 10px 12px; }
}

/* موبایل خیلی کوچک */
@media (max-width: 360px) {
    .mz-chat-widget {
        bottom: 95px;
        right: 12px;
    }
    
    .mz-chat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }
    
    .mz-chat-window {
        bottom: 100px;
        right: 6px !important;
        left: 6px !important;
        height: calc(100vh - 175px);
    }
}

/* ========================================
   DARK MODE
======================================== */
@media (prefers-color-scheme: dark) {
    .mz-chat-window { background: #1a1a1a; }
    .mz-chat-messages { background: #2d2d2d; }
    .mz-message.bot, .mz-message.admin { background: #2d2d2d; color: #e0e0e0; }
    .mz-chat-input-area { background: #1a1a1a; border-top-color: #333; }
    .mz-chat-input-wrapper { background: #2d2d2d; }
    .mz-chat-input { color: #e0e0e0; }
    .mz-context-menu { background: #2d2d2d; border-color: #444; }
    .mz-context-item { color: #e0e0e0; }
    .mz-context-item:hover { background: #3d3d3d; }
    .mz-image-loading-indicator { background: rgba(255,255,255,0.05); }
    .mz-image-placeholder { background: rgba(255,255,255,0.05); }
}
/* ============================================ */
/* ✅ NEW: استایل‌های لینک در پیام‌ها */
/* ============================================ */

/* لینک‌های مستقیم (URL ساده) */
.mz-message-link.mz-url-link {
    color: #3b82f6 !important;
    text-decoration: underline;
    word-break: break-all;
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.mz-message-link.mz-url-link:hover {
    color: #2563eb !important;
    text-decoration: none;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 3px;
    padding: 1px 3px;
}

/* لینک‌های inline با متن جایگزین [متن](لینک) */
.mz-message-link.mz-inline-link {
    color: #8b5cf6 !important;
    font-weight: 500;
    background: rgba(139, 92, 246, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    text-decoration: none !important;
    display: inline-block;
    margin: 2px 4px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.2s ease;
    font-size: 0.95em;
}

.mz-message-link.mz-inline-link:hover {
    color: #7c3aed !important;
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

/* استایل لینک‌ها در پیام کاربر */
.mz-message.user .mz-message-link.mz-url-link {
    color: #60a5fa !important;
}

.mz-message.user .mz-message-link.mz-url-link:hover {
    color: #93c5fd !important;
    background: rgba(96, 165, 250, 0.15);
}

.mz-message.user .mz-inline-link {
    color: #60a5fa !important;
    background: rgba(96, 165, 250, 0.1);
    border-color: rgba(96, 165, 250, 0.2);
}

.mz-message.user .mz-inline-link:hover {
    color: #93c5fd !important;
    background: rgba(96, 165, 250, 0.2);
    border-color: rgba(96, 165, 250, 0.3);
}

/* استایل لینک‌ها در پیام بات و ادمین */
.mz-message.bot .mz-inline-link,
.mz-message.admin .mz-inline-link {
    color: #D4A853 !important;
    background: rgba(212, 168, 83, 0.1);
    border-color: rgba(212, 168, 83, 0.2);
}

.mz-message.bot .mz-inline-link:hover,
.mz-message.admin .mz-inline-link:hover {
    color: #e5c76b !important;
    background: rgba(212, 168, 83, 0.2);
    border-color: rgba(212, 168, 83, 0.3);
    box-shadow: 0 2px 8px rgba(212, 168, 83, 0.15);
}

.mz-message.bot .mz-message-link.mz-url-link,
.mz-message.admin .mz-message-link.mz-url-link {
    color: #D4A853 !important;
}

.mz-message.bot .mz-message-link.mz-url-link:hover,
.mz-message.admin .mz-message-link.mz-url-link:hover {
    color: #e5c76b !important;
    background: rgba(212, 168, 83, 0.1);
}

/* انیمیشن hover برای همه لینک‌ها */
.mz-message-link {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* افکت focus برای accessibility */
.mz-message-link:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
    border-radius: 3px;
}

/* استایل برای لینک‌های داخل ریپلای */
.mz-reply-bubble-text .mz-message-link,
.mz-reply-bubble-admin .mz-message-link {
    font-size: 0.85em !important;
    padding: 1px 4px !important;
}