/* ═══════════════════════════════════════════════
   Home AI Chat Widget – Inline Triage on Homepage
   ═══════════════════════════════════════════════ */

.home-ai-chat-wrapper {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

.home-ai-chat-card {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    background: linear-gradient(145deg, #0d1117 0%, #161b28 40%, #1a1f35 100%);
    border: 1px solid rgba(54, 84, 255, 0.2);
    box-shadow:
        0 0 40px rgba(54, 84, 255, 0.08),
        0 8px 32px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    height: 560px;
    direction: rtl;
}

/* ─── Animated AI Background Canvas ─── */
.home-ai-chat-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
}

/* ─── Header ─── */
.home-ai-chat-header {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(54, 84, 255, 0.15);
    background: rgba(13, 17, 23, 0.7);
    backdrop-filter: blur(10px);
}

.home-ai-chat-header__icon {
    color: #6c8cff;
    display: flex;
    align-items: center;
    animation: homeAiPulse 3s ease-in-out infinite;
}

@keyframes homeAiPulse {
    0%, 100% { filter: drop-shadow(0 0 4px rgba(108, 140, 255, 0.4)); }
    50% { filter: drop-shadow(0 0 12px rgba(108, 140, 255, 0.8)); }
}

.home-ai-chat-header__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #e8ecf4;
    letter-spacing: 0.02em;
}

/* ─── Messages Area ─── */
.home-ai-chat-messages {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.home-ai-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.home-ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.home-ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(108, 140, 255, 0.2);
    border-radius: 4px;
}

/* ─ Welcome State ─ */
.home-ai-chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1.5rem 0.5rem;
    gap: 1rem;
}

.home-ai-chat-welcome p {
    color: rgba(232, 236, 244, 0.75);
    font-size: 0.92rem;
    line-height: 1.8;
    max-width: 500px;
    margin: 0;
}

/* ─ Suggestion Chips ─ */
.home-ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
    max-width: 100%;
}

.home-ai-suggestion-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem;
    border-radius: 18px;
    border: 1px solid rgba(108, 140, 255, 0.25);
    background: rgba(108, 140, 255, 0.06);
    color: rgba(232, 236, 244, 0.85);
    font-family: inherit;
    font-size: 0.8rem;
    line-height: 1.5;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    max-width: 100%;
}

.home-ai-suggestion-chip:hover {
    background: rgba(108, 140, 255, 0.15);
    border-color: rgba(108, 140, 255, 0.5);
    color: #c0d0ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(54, 84, 255, 0.15);
}

.home-ai-suggestion-chip:active {
    transform: translateY(0);
}

.home-ai-suggestion-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

/* ─ Chat Bubbles ─ */
.home-ai-msg-row {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    max-width: 100%;
}

.home-ai-msg-row--user {
    align-items: flex-start;
}

.home-ai-msg-row--assistant {
    align-items: flex-end;
}

.home-ai-bubble {
    max-width: 80%;
    padding: 0.7rem 1rem;
    border-radius: 16px;
    line-height: 1.8;
    font-size: 0.88rem;
    word-break: break-word;
}

.home-ai-bubble--user {
    background: linear-gradient(135deg, #3654ff 0%, #5a7aff 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.home-ai-bubble--assistant {
    background: rgba(30, 36, 54, 0.85);
    color: rgba(232, 236, 244, 0.9);
    border: 1px solid rgba(108, 140, 255, 0.15);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(6px);
}

.home-ai-bubble-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    opacity: 0.6;
}

.home-ai-bubble-text {
    white-space: pre-wrap;
}

/* ─ Typing indicator ─ */
.home-ai-typing .home-ai-typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 0.25rem 0;
}

.home-ai-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(108, 140, 255, 0.5);
    animation: homeAiTypingBounce 1.2s infinite;
}

.home-ai-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.home-ai-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes homeAiTypingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ─ Input Area ─ */
.home-ai-chat-input-area {
    position: relative;
    z-index: 1;
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid rgba(54, 84, 255, 0.1);
    background: rgba(13, 17, 23, 0.6);
    backdrop-filter: blur(10px);
}

.home-ai-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    background: rgba(30, 36, 54, 0.6);
    border: 1px solid rgba(108, 140, 255, 0.2);
    border-radius: 20px;
    padding: 0.45rem 0.5rem 0.45rem 0.7rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.home-ai-chat-form:focus-within {
    border-color: rgba(108, 140, 255, 0.5);
    box-shadow: 0 0 20px rgba(54, 84, 255, 0.12);
}

.home-ai-chat-input {
    flex: 1;
    border: none;
    padding: 0.45rem 0.5rem;
    font-family: inherit;
    font-size: 0.88rem;
    resize: none;
    min-height: 34px;
    max-height: 100px;
    overflow-y: auto;
    background: transparent;
    color: #e8ecf4;
    direction: rtl;
    line-height: 1.5;
}

.home-ai-chat-input:focus {
    outline: none;
}

.home-ai-chat-input::placeholder {
    color: rgba(232, 236, 244, 0.35);
}

.home-ai-chat-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3654ff, #5a7aff);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.home-ai-chat-send:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.home-ai-chat-send:not(:disabled):hover {
    opacity: 0.9;
    transform: scale(1.08);
}

/* ─ Login Overlay ─ */
.home-ai-chat-login-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1rem;
    background: rgba(13, 17, 23, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 24px;
    padding: 2rem;
}

.home-ai-chat-login-overlay p {
    color: rgba(232, 236, 244, 0.7);
    font-size: 0.95rem;
    margin: 0;
    max-width: 320px;
    line-height: 1.7;
}

.home-ai-chat-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(108, 140, 255, 0.4);
    background: linear-gradient(135deg, #3654ff, #5a7aff);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.home-ai-chat-login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(54, 84, 255, 0.3);
    color: #fff;
}

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .home-ai-chat-card {
        height: 480px;
        border-radius: 18px;
    }

    .home-ai-chat-header {
        padding: 0.75rem 1rem;
    }

    .home-ai-chat-header__title {
        font-size: 1rem;
    }

    .home-ai-chat-messages {
        padding: 0.75rem 0.75rem;
    }

    .home-ai-bubble {
        max-width: 90%;
    }

    .home-ai-suggestion-chip {
        font-size: 0.76rem;
        padding: 0.4rem 0.7rem;
    }

    .home-ai-chat-input-area {
        padding: 0.5rem 0.75rem 0.75rem;
    }
}

@media (max-width: 480px) {
    .home-ai-chat-card {
        height: 440px;
        border-radius: 14px;
    }
}
