.pazi-define-word {
    color: #FF0000;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: color 0.2s;
}
.pazi-define-word:hover {
    color: #787878;
}
.pazi-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.pazi-modal-backdrop.pazi-visible {
    opacity: 1;
    visibility: visible;
}
.pazi-modal-window {
    direction: rtl;
    position: relative;
    width: 90%;
    max-width: 550px;
    padding: 25px;
    padding-top: 65px;
    padding-bottom: 20px;
    border-radius: 24px;
    
    background: rgba(248, 248, 248, 0.85);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);

    transform: scale(0.95) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.25, 0.1, 0.25, 1), 
                opacity 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    
    display: flex;
    flex-direction: column;
}
.pazi-modal-backdrop.pazi-visible .pazi-modal-window {
    transform: scale(1) translateY(0);
}
.pazi-modal-avatar {
    position: absolute;
    top: -45px;
    right: 50%;
    transform: translateX(50%);
    
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

/* 5. دکمه بستن (×) */
.pazi-modal-close {
    position: absolute;
    top: 15px;
    left: 15px;
    background: #e9e9eb;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
    font-weight: normal;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}

.pazi-modal-close:hover {
    background: #dcdcdc;
    color: #000;
}

/* 6. هدر مودال */
.pazi-modal-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.pazi-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin-top: 5px;
}

/* 7. محتوای تعریف */
.pazi-modal-body {
    flex-grow: 1;
    min-height: 60px;
    font-size: 1rem;
    line-height: 1.7;
    color: #333;
    overflow-y: auto;
    padding-bottom: 15px;
}

.pazi-modal-body .pazi-typing-cursor::after {
    content: '▋';
    display: inline-block;
    animation: pazi-blink 1s step-end infinite;
    opacity: 1;
    color: #888;
}

.pazi-modal-body.pazi-typing-done .pazi-typing-cursor::after {
    display: none;
}

@keyframes pazi-blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* 8. دکمه‌های کنترلی - خارج از کادر و زیر */
.pazi-action-buttons-wrapper {
    position: absolute;
    bottom: -90px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: center;
    gap: 25px;
    padding: 0;
    margin: 0;
    border: none;
    z-index: 100;
    width: auto;
}

.pazi-action-button {
    background: rgba(248, 248, 248, 0.95);
    backdrop-filter: blur(20px);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: background 0.3s, transform 0.3s, box-shadow 0.3s;
    opacity: 1;
    pointer-events: auto;
}

.pazi-action-button:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.pazi-action-button:active {
    transform: scale(0.95) translateY(-2px);
}

.pazi-action-button svg {
    width: 36px;
    height: 36px;
    fill: #1d1d1f;
    transition: fill 0.3s;
}

.pazi-action-button:hover svg {
    fill: #0066cc;
}

/* 9. Input چت/سوال */
.pazi-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    margin-top: auto;
}

.pazi-chat-input-wrapper input {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.9);
    padding: 12px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-size: 0.9rem;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s;
}

.pazi-chat-input-wrapper input:focus {
    border-color: #FF0000;
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.15);
}

.pazi-chat-input-wrapper #pazi-send-button {
    background: #FF0000;
    border: none;
    border-radius: 10px;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
}

.pazi-chat-input-wrapper #pazi-send-button:hover {
    background: #CC0000;
    transform: scale(1.05);
}

.pazi-chat-input-wrapper #pazi-send-button:active {
    transform: scale(0.95);
}

.pazi-chat-input-wrapper #pazi-send-button svg {
    width: 22px;
    height: 22px;
    fill: white;
}

/* 10. ریسپانسیو */
@media (max-width: 600px) {
    .pazi-modal-window {
        width: 95%;
        padding: 15px;
        padding-top: 55px;
        padding-bottom: 15px;
        border-radius: 18px;
    }

    .pazi-modal-avatar {
        width: 70px;
        height: 70px;
        top: -35px;
    }

    .pazi-action-buttons-wrapper {
        bottom: -75px;
        gap: 15px;
    }

    .pazi-action-button {
        width: 60px;
        height: 60px;
    }

    .pazi-action-button svg {
        width: 28px;
        height: 28px;
    }

    .pazi-chat-input-wrapper input {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .pazi-chat-input-wrapper #pazi-send-button {
        width: 40px;
        height: 40px;
    }

    .pazi-chat-input-wrapper #pazi-send-button svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 400px) {
    .pazi-modal-window {
        width: 98%;
        padding: 12px;
        padding-top: 50px;
    }

    .pazi-action-buttons-wrapper {
        gap: 10px;
        bottom: -65px;
    }

    .pazi-action-button {
        width: 55px;
        height: 55px;
    }

    .pazi-action-button svg {
        width: 24px;
        height: 24px;
    }
}