@font-face {
    font-family: "Vazir";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/vazir/Vazir-Variable.woff2") format("woff2");
}

#dani-ai-root {
    --dani-color: #0f766e;
    --dani-text: #102a43;
    --dani-muted: #627d98;
    --dani-surface: #ffffff;
    position: fixed;
    z-index: 2147483000;
    right: 24px;
    bottom: 24px;
    direction: rtl;
    font-family: Vazir;
    text-align: right;
}

#dani-ai-root[data-position="left"] { right: auto; left: 24px; }
#dani-ai-root * { box-sizing: border-box; font-family: Vazir; }
.dani-widget__launcher { display: grid; overflow: hidden; width: 60px; height: 60px; padding: 3px; place-items: center; border: 1px solid rgba(255,255,255,.7); border-radius: 20px; background: linear-gradient(145deg, #0b3341, var(--dani-color)); color: #fff; box-shadow: 0 14px 32px rgba(16,42,67,.26); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.dani-widget__launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(16,42,67,.31); }
.dani-widget__launcher:focus-visible, .dani-widget button:focus-visible, .dani-widget input:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 3px; }
.dani-widget__launcher svg { width: 27px; height: 27px; fill: currentColor; }
.dani-widget__launcher-avatar { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 12%; border-radius: 16px; background: linear-gradient(180deg, #e8f3f6, #c8dfe8); }

.dani-widget { position: absolute; right: 0; bottom: 74px; display: none; width: min(390px, calc(100vw - 32px)); height: min(650px, calc(100vh - 118px)); overflow: hidden; border: 1px solid rgba(98,125,152,.24); border-radius: 20px; background: var(--dani-surface); box-shadow: 0 24px 70px rgba(16,42,67,.24); }
[data-position="left"] .dani-widget { right: auto; left: 0; }
.dani-widget.is-open { display: grid; grid-template-rows: auto 1fr auto auto; animation: dani-open .18s ease-out; }
@keyframes dani-open { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

.dani-widget__header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; background: linear-gradient(135deg, #0b3341, var(--dani-color)); color: #fff; }
.dani-widget__avatar { display: grid; overflow: hidden; flex: 0 0 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,.4); border-radius: 13px; background: linear-gradient(180deg, #e8f3f6, #c8dfe8); font: 700 20px/1 Vazir; }
.dani-widget__avatar-image { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 12%; }
.dani-widget__identity { min-width: 0; flex: 1; }
.dani-widget__name { display: block; overflow: hidden; margin-bottom: 4px; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.dani-widget__status { display: flex; align-items: center; gap: 6px; font-size: 11px; opacity: .82; }
.dani-widget__status::before { width: 7px; height: 7px; border-radius: 50%; background: #6ee7b7; content: ""; }
.dani-widget__actions { display: flex; align-items: center; gap: 4px; }
.dani-widget__action { display: grid; width: 30px; height: 30px; padding: 0; place-items: center; border: 0; border-radius: 9px; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; font: 700 14px/1 Vazir; }
.dani-widget__action:hover, .dani-widget__action[aria-pressed="true"] { background: rgba(255,255,255,.23); }
.dani-widget__close { display: grid; width: 34px; height: 34px; padding: 0; place-items: center; border: 0; border-radius: 10px; background: transparent; color: #fff; cursor: pointer; font-size: 23px; }
.dani-widget__close:hover { background: rgba(255,255,255,.13); }

.dani-widget__messages { overflow-y: auto; padding: 18px; background: #f5f8fa; scroll-behavior: smooth; }
.dani-widget__message { width: fit-content; max-width: 86%; margin: 0 0 11px; padding: 11px 14px; border-radius: 15px; color: var(--dani-text); font-size: 13px; line-height: 1.85; white-space: pre-wrap; word-break: break-word; }
.dani-widget__message--assistant { margin-left: auto; border-bottom-right-radius: 5px; background: #fff; box-shadow: 0 4px 14px rgba(16,42,67,.07); }
.dani-widget__message--user { margin-right: auto; border-bottom-left-radius: 5px; background: #dff5f2; background: color-mix(in srgb, var(--dani-color) 14%, white); }
.dani-widget__order { margin-bottom: 14px; padding: 14px; border: 1px solid #d9e2ec; border-color: color-mix(in srgb, var(--dani-color) 26%, #d9e2ec); border-radius: 14px; background: var(--dani-surface); color: var(--dani-text); box-shadow: 0 5px 18px rgba(16,42,67,.07); }
.dani-widget__order[hidden] { display: none; }
.dani-widget__order-title { display: block; margin-bottom: 5px; font-size: 13px; }
.dani-widget__order-help { margin: 0 0 10px; color: var(--dani-muted); font-size: 11px; line-height: 1.75; }
.dani-widget__order-form { display: grid; gap: 8px; }
.dani-widget__order-input { width: 100%; min-width: 0; height: 40px; padding: 8px 11px; border: 1px solid #bcccdc; border-radius: 10px; background: #fbfdff; color: var(--dani-text); font: inherit; font-size: 12px; box-shadow: none; }
.dani-widget__order-input:focus { border-color: var(--dani-color); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--dani-color) 12%, transparent); }
.dani-widget__order-submit { min-height: 40px; padding: 8px 12px; border: 0; border-radius: 10px; background: var(--dani-color); color: #fff; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; }
.dani-widget__order-submit:disabled { cursor: wait; opacity: .55; }
.dani-widget__sources { display: grid; gap: 5px; margin-top: 9px; padding-top: 8px; border-top: 1px solid #e7edf2; }
.dani-widget__sources a { overflow: hidden; color: var(--dani-color); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.dani-widget__typing { display: flex; align-items: center; gap: 8px; width: fit-content; padding: 10px 13px; border-radius: 15px 15px 5px 15px; background: #fff; color: var(--dani-muted); font-size: 11px; box-shadow: 0 4px 14px rgba(16,42,67,.07); }
.dani-widget__typing-label { white-space: nowrap; }
.dani-widget__typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.dani-widget__typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--dani-color); animation: dani-dot 1.1s infinite; }
.dani-widget__typing-dots i:nth-child(2) { animation-delay: .15s; }
.dani-widget__typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dani-dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.dani-widget__suggestions { display: flex; gap: 7px; overflow-x: auto; padding: 10px 14px; border-top: 1px solid #edf2f7; background: #fff; scrollbar-width: none; }
.dani-widget__suggestions::-webkit-scrollbar { display: none; }
.dani-widget__suggestions button { flex: 0 0 auto; padding: 7px 11px; border: 1px solid #92d2ca; border-color: color-mix(in srgb, var(--dani-color) 35%, white); border-radius: 999px; background: #fff; color: var(--dani-color); cursor: pointer; font: inherit; font-size: 11px; }
.dani-widget__suggestions button:hover { background: #effaf8; background: color-mix(in srgb, var(--dani-color) 8%, white); }

.dani-widget__composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid #edf2f7; background: #fff; }
.dani-widget__input { width: 100%; min-width: 0; height: 44px; padding: 9px 13px; border: 1px solid #bcccdc; border-radius: 12px; background: #fbfdff; color: var(--dani-text); font: inherit; font-size: 13px; box-shadow: none; }
.dani-widget__input:focus { border-color: var(--dani-color); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--dani-color) 12%, transparent); }
.dani-widget__send { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 0; border-radius: 12px; background: var(--dani-color); color: #fff; cursor: pointer; }
.dani-widget__send:disabled { cursor: wait; opacity: .55; }
.dani-widget__send svg { width: 20px; height: 20px; fill: currentColor; transform: scaleX(-1); }
.dani-widget__error { margin: 0; padding: 7px 15px; background: #fff1f2; color: #9f1239; font-size: 11px; }

#dani-ai-root[data-theme="dark"] {
    --dani-text: #e7eef5;
    --dani-muted: #a8bdd0;
    --dani-surface: #132734;
}
#dani-ai-root[data-theme="dark"] .dani-widget { border-color: #365166; background: #132734; }
#dani-ai-root[data-theme="dark"] .dani-widget__messages { background: #0d1d27; }
#dani-ai-root[data-theme="dark"] .dani-widget__message--assistant,
#dani-ai-root[data-theme="dark"] .dani-widget__typing,
#dani-ai-root[data-theme="dark"] .dani-widget__suggestions,
#dani-ai-root[data-theme="dark"] .dani-widget__composer { border-color: #2c4354; background: #132734; color: var(--dani-text); }
#dani-ai-root[data-theme="dark"] .dani-widget__message--user { background: color-mix(in srgb, var(--dani-color) 36%, #132734); }
#dani-ai-root[data-theme="dark"] .dani-widget__sources { border-color: #365166; }
#dani-ai-root[data-theme="dark"] .dani-widget__suggestions button { border-color: #4c7d79; background: #18313f; color: #c8fff6; }
#dani-ai-root[data-theme="dark"] .dani-widget__input,
#dani-ai-root[data-theme="dark"] .dani-widget__order-input { border-color: #496273; background: #0d1d27; color: var(--dani-text); }
#dani-ai-root[data-theme="dark"] .dani-widget__input::placeholder,
#dani-ai-root[data-theme="dark"] .dani-widget__order-input::placeholder { color: #91a8ba; }

@media (max-width: 520px) {
    #dani-ai-root, #dani-ai-root[data-position="left"] { right: 12px; bottom: 12px; left: auto; }
    .dani-widget { position: fixed; inset: 8px; width: auto; height: auto; border-radius: 17px; }
    .dani-widget__launcher { width: 56px; height: 56px; }
    .dani-widget__typing-label { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
}

@media (prefers-reduced-motion: reduce) {
    .dani-widget, .dani-widget__launcher, .dani-widget__messages { animation: none; scroll-behavior: auto; transition: none; }
}
