/* ============================================================
   AI YORDAMCHI — talabalar uchun suzuvchi chat vidjeti.
   ============================================================ */

.ai-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--blue-light), var(--indigo));
    color: #fff;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    z-index: 1400;
    transition: transform 0.15s ease;
}
.ai-fab:hover { transform: scale(1.06); }
.ai-fab .ai-fab-dot {
    position: absolute; top: 2px; right: 2px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--emerald-light); border: 2px solid var(--paper);
}
[data-bs-theme="dark"] .ai-fab .ai-fab-dot { border-color: var(--ink); }

body.mobile-app-student .ai-fab { bottom: 90px; }

.ai-panel {
    position: fixed;
    right: 22px;
    bottom: 92px;
    width: 340px;
    max-width: calc(100vw - 32px);
    height: 460px;
    max-height: calc(100vh - 140px);
    background: var(--paper-2);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--shadow-soft), 0 20px 50px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1400;
}
[data-bs-theme="dark"] .ai-panel { background: var(--charcoal-2); }
.ai-panel.is-open { display: flex; }
body.mobile-app-student .ai-panel { bottom: 160px; }

.ai-panel-head {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    background: linear-gradient(135deg, var(--blue-light), var(--indigo));
    color: #fff; flex-shrink: 0;
}
.ai-panel-avatar {
    width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.2);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.ai-panel-title { font-weight: 700; font-size: 0.9rem; line-height: 1.1; }
.ai-panel-status { font-size: 0.72rem; opacity: 0.9; display: flex; align-items: center; gap: 4px; }
.ai-panel-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--emerald-light); display: inline-block; }
.ai-panel-close {
    margin-left: auto; background: none; border: none; color: #fff; opacity: 0.85;
    font-size: 1.1rem; cursor: pointer; line-height: 1;
}
.ai-panel-close:hover { opacity: 1; }

.ai-panel-body { flex: 1; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ai-msg-row { display: flex; }
.ai-msg-row.mine { justify-content: flex-end; }
.ai-msg-bubble {
    max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 0.83rem; line-height: 1.45;
    white-space: pre-wrap;
}
.ai-msg-row:not(.mine) .ai-msg-bubble { background: var(--paper); border: 1px solid var(--border-soft); border-bottom-left-radius: 3px; }
[data-bs-theme="dark"] .ai-msg-row:not(.mine) .ai-msg-bubble { background: var(--ink); }
.ai-msg-row.mine .ai-msg-bubble { background: linear-gradient(135deg, var(--blue-light), var(--blue-dim)); color: #062033; border-bottom-right-radius: 3px; }

.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; flex-shrink: 0; }
.ai-chip {
    border: 1px solid var(--border-soft); background: var(--paper); color: var(--text-body);
    border-radius: 999px; padding: 5px 11px; font-size: 0.74rem; cursor: pointer;
}
[data-bs-theme="dark"] .ai-chip { background: var(--ink); }
.ai-chip:hover { border-color: var(--blue); color: var(--blue-dim); }

.ai-panel-input-row { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border-soft); flex-shrink: 0; }
.ai-panel-input {
    flex: 1; resize: none; border: 1px solid var(--border-soft); border-radius: 10px;
    padding: 7px 10px; font-size: 0.83rem; background: var(--paper); color: var(--text-body);
}
[data-bs-theme="dark"] .ai-panel-input { background: var(--ink); }
.ai-panel-send {
    flex-shrink: 0; border: none; border-radius: 10px; width: 36px;
    background: linear-gradient(135deg, var(--blue-light), var(--blue-dim)); color: #fff; cursor: pointer;
}
.ai-panel-send:disabled { opacity: 0.6; cursor: not-allowed; }
.ai-typing { font-size: 0.78rem; color: var(--text-muted); font-style: italic; padding: 0 14px 6px; }
