/*
 * Azlynt Chat Widget — CSS ثابت مستقل (بلا Tailwind/build step)، محمَّل عبر
 * <link> عادي من كِلا الـlayouts (marketing.blade.php وapp.blade.php) —
 * نفس أسلوب public/marketing/css/consent.css، بلا أي اعتماد على أي Pipeline
 * بناء. يستخدم خصائص CSS المنطقية (inset-inline-*) لدعم RTL/LTR تلقائياً
 * بلا أي كود JS إضافي لتبديل الاتجاه.
 */

.az-chat-widget {
    position: fixed;
    inset-block-end: 1rem;
    inset-inline-end: 1rem;
    z-index: 2147483000;
    font-family: 'Readex Pro', system-ui, sans-serif;
    direction: rtl;
}

.az-chat-widget__toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 999px;
    border: none;
    background: #1c0060;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(28, 0, 96, 0.35);
}

.az-chat-widget__toggle:focus-visible {
    outline: 3px solid #006c51;
    outline-offset: 2px;
}

.az-chat-widget__panel {
    position: absolute;
    inset-block-end: 4rem;
    inset-inline-end: 0;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(32rem, 75vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 20px 45px rgba(15, 15, 35, 0.25);
    overflow: hidden;
    border: 1px solid #e5e7eb;
}

.az-chat-widget__panel[hidden] {
    display: none;
}

.az-chat-widget__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #1c0060;
    color: #fff;
}

.az-chat-widget__header h2 {
    font-size: 0.95rem;
    margin: 0;
}

.az-chat-widget__close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
}

.az-chat-widget__close:focus-visible,
.az-chat-widget button:focus-visible,
.az-chat-widget input:focus-visible,
.az-chat-widget textarea:focus-visible {
    outline: 3px solid #006c51;
    outline-offset: 1px;
}

.az-chat-widget__status-banner {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #374151;
    background: #f9fafb;
    border-bottom: 1px solid #eee;
}

.az-chat-widget__body {
    padding: 0.75rem 1rem;
    overflow-y: auto;
    flex: 1;
    font-size: 0.85rem;
    color: #1f2937;
}

.az-chat-widget [data-chat-view] {
    display: block;
}

.az-chat-widget [data-chat-view][hidden] {
    display: none;
}

.az-chat-messages {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 16rem;
    overflow-y: auto;
}

.az-chat-message {
    display: flex;
}

.az-chat-message__bubble {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
}

.az-chat-message--user {
    justify-content: flex-end;
}

.az-chat-message--user .az-chat-message__bubble {
    background: #006c51;
    color: #fff;
    border-start-end-radius: 0.15rem;
}

.az-chat-message--employee .az-chat-message__bubble,
.az-chat-message--system .az-chat-message__bubble {
    background: #f1f0f7;
    color: #1f2937;
    border-start-start-radius: 0.15rem;
}

.az-chat-widget form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.az-chat-widget label {
    font-size: 0.75rem;
    color: #4b5563;
}

.az-chat-widget input[type="text"],
.az-chat-widget input[type="email"],
.az-chat-widget input[type="tel"],
.az-chat-widget textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.6rem;
    font-size: 0.85rem;
    font-family: inherit;
}

.az-chat-widget textarea {
    min-height: 3rem;
    resize: vertical;
}

.az-chat-widget__error {
    color: #b91c1c;
    font-size: 0.75rem;
    min-height: 1em;
}

.az-chat-widget__submit {
    align-self: flex-end;
    background: #1c0060;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.az-chat-widget__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.az-chat-widget__composer {
    flex-direction: row;
    align-items: flex-end;
    border-top: 1px solid #eee;
    padding: 0.6rem 1rem;
    gap: 0.5rem;
}

.az-chat-widget__composer textarea {
    flex: 1;
    min-height: 2.25rem;
}

.az-chat-selection-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.az-chat-selection-item {
    width: 100%;
    text-align: start;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
    font-size: 0.8rem;
}

.az-chat-widget__live {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

@media (max-width: 480px) {
    .az-chat-widget {
        inset-inline-end: 0.5rem;
        inset-block-end: 0.5rem;
    }

    .az-chat-widget__panel {
        width: calc(100vw - 1rem);
    }
}
