/* AI Consultant Page */

:root {
    --chat-max-width: 800px;
    --chat-bg: #f7f7f8;
    --chat-user-bg: #F27E03;
    --chat-user-color: #FFFFFF;
    --chat-bot-bg: #FFFFFF;
    --chat-bot-border: #D0D0D0;
    --chat-input-border: #D0D0D0;
    --chat-input-focus: #F27E03;
}

.chat-page,
.chat-page *,
.chat-page *::before,
.chat-page *::after {
    box-sizing: border-box;
}

/* Page wrapper */
.chat-page {
    margin-top: 80px;
    min-height: calc(100vh - 80px);
    background: var(--chat-bg);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: var(--chat-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 24px !important;
    position: relative;
}

/* Welcome screen */
.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
}

.chat-welcome.is-hidden {
    display: none;
}

.chat-welcome-inner {
    text-align: center;
    max-width: 560px;
    width: 100%;
}

.chat-welcome-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(242, 126, 3, 0.1);
    border-radius: 16px;
}

.chat-welcome-icon svg {
    width: 32px;
    height: 32px;
    color: #F27E03;
}

.chat-welcome-title {
    font-size: 2rem;
    font-weight: 700;
    color: #3E3E3E;
    margin: 0 0 12px;
    line-height: 1.2;
}

.chat-welcome-subtitle {
    font-size: 1.0625rem;
    color: #6B6B6B;
    line-height: 1.6;
    margin: 0 0 40px;
}

/* Suggestion chips */
.chat-suggestions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.chat-suggestion {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #FFFFFF;
    border: 1px solid #D0D0D0;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 0.9375rem;
    color: #3E3E3E;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.chat-suggestion:hover {
    border-color: #F27E03;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.chat-suggestion svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: #F27E03;
    margin-top: 1px;
}

.chat-suggestion span {
    flex: 1;
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages:empty {
    display: none;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: chatFadeIn 0.25s ease;
}

@keyframes chatFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message--user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message--bot {
    align-self: flex-start;
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.chat-message--user .chat-message-avatar {
    background: #3E3E3E;
    color: #FFFFFF;
}

.chat-message--bot .chat-message-avatar {
    background: #F27E03;
    color: #FFFFFF;
}

.chat-message-avatar svg {
    width: 18px;
    height: 18px;
}

.chat-message-body {
    padding: 12px 16px;
    line-height: 1.6;
    font-size: 0.9375rem;
    white-space: pre-wrap;
    word-break: break-word;
    border: 1px solid var(--chat-bot-border);
    background: var(--chat-bot-bg);
    color: #3E3E3E;
}

.chat-message--user .chat-message-body {
    background: #f0f0f0;
    border-color: #d8d8d8;
    color: #3E3E3E;
}

.chat-message--error .chat-message-body {
    background: #FFF5F5;
    border-color: #E53E3E;
    color: #C53030;
}

/* Typing indicator */
.chat-typing-row {
    display: flex;
    gap: 12px;
    align-self: flex-start;
    align-items: flex-start;
}

.chat-typing-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #F27E03;
    color: #FFFFFF;
    font-size: 0.8125rem;
    font-weight: 700;
    animation: chatAvatarPulse 2s ease-in-out infinite;
}

@keyframes chatAvatarPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(242, 126, 3, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(242, 126, 3, 0); }
}

.chat-typing-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--chat-bot-bg);
    border: 1px solid var(--chat-bot-border);
}

.chat-typing-label {
    font-size: 0.875rem;
    color: #6B6B6B;
    font-style: italic;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
}

.chat-typing-dot {
    width: 7px;
    height: 7px;
    background: #F27E03;
    border-radius: 50%;
    animation: chatTyping 1.4s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input area */
.chat-input-area {
    padding: 12px 0 20px;
    position: sticky;
    bottom: 0;
    background: var(--chat-bg);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0;
    background: #FFFFFF;
    border: 1px solid var(--chat-input-border);
    transition: border-color 0.2s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--chat-input-focus);
}

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: #3E3E3E;
    background: transparent;
    max-height: 120px;
    height: 40px;
    overflow-y: hidden;
}

.chat-input::placeholder {
    color: #A0A0A0;
}

.chat-send {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #F27E03;
    transition: color 0.2s ease;
    margin-right: 4px;
}

.chat-send:hover {
    color: #d96f02;
}

.chat-send:disabled {
    color: #D0D0D0;
    cursor: not-allowed;
}

.chat-send svg {
    width: 20px;
    height: 20px;
}

.chat-disclaimer {
    font-size: 0.75rem;
    color: #A0A0A0;
    text-align: center;
    margin: 8px 0 0;
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-page {
        min-height: calc(100vh - 80px);
        min-height: calc(100dvh - 80px);
    }

    .chat-container {
        padding: 0 16px;
    }

    .chat-welcome {
        padding: 20px 0;
        align-items: flex-start;
    }

    .chat-welcome-icon {
        width: 52px;
        height: 52px;
        margin-bottom: 16px;
    }

    .chat-welcome-icon svg {
        width: 26px;
        height: 26px;
    }

    .chat-welcome-title {
        font-size: 1.5rem;
        margin-bottom: 8px;
    }

    .chat-welcome-subtitle {
        font-size: 0.875rem;
        margin-bottom: 20px;
        padding: 0 8px;
    }

    .chat-suggestions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chat-suggestion {
        padding: 12px 14px;
        font-size: 0.875rem;
        gap: 10px;
    }

    .chat-suggestion svg {
        width: 18px;
        height: 18px;
    }

    .chat-message {
        max-width: 92%;
        gap: 8px;
    }

    .chat-message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.625rem;
    }

    .chat-typing-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.625rem;
    }

    .chat-message-body {
        padding: 10px 12px;
        font-size: 0.875rem;
    }

    .chat-typing-bubble {
        padding: 10px 12px;
    }

    .chat-typing-label {
        font-size: 0.8125rem;
    }

    .chat-input-area {
        padding: 8px 0 12px;
    }

    .chat-input {
        font-size: 1rem;
    }

    .chat-disclaimer {
        font-size: 0.6875rem;
        margin-top: 6px;
    }
}

@media (max-width: 480px) {
    .chat-welcome-title {
        font-size: 1.25rem;
    }

    .chat-welcome-subtitle {
        font-size: 0.8125rem;
    }

    .chat-suggestion {
        padding: 10px 12px;
        font-size: 0.8125rem;
    }

    .chat-message {
        max-width: 95%;
    }

    .chat-message-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.5625rem;
    }

    .chat-typing-avatar {
        width: 24px;
        height: 24px;
        font-size: 0.5625rem;
    }
}
