/* 052b AI Consultant - Chat Widget */
:root {
    --aic-color: #c0392b;
    --aic-color-hover: #a93226;
    --aic-bg: #ffffff;
    --aic-msg-user: #e8f4fd;
    --aic-msg-ai: #f0f0f0;
    --aic-text: #333333;
    --aic-text-light: #666666;
    --aic-border: #e0e0e0;
    --aic-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    --aic-radius: 12px;
}

/* Bubble */
.aic-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--aic-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--aic-shadow);
    z-index: 99999;
    transition: transform 0.2s, background 0.2s;
}

.aic-bubble:hover {
    transform: scale(1.05);
    background: var(--aic-color-hover);
}

.aic-widget--left .aic-bubble {
    right: auto;
    left: 20px;
}

/* Panel */
.aic-panel {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 520px;
    background: var(--aic-bg);
    border-radius: var(--aic-radius);
    box-shadow: var(--aic-shadow);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--aic-text);
}

.aic-widget--left .aic-panel {
    right: auto;
    left: 20px;
}

/* Header */
.aic-header {
    background: var(--aic-color);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.aic-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.aic-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aic-header-title {
    font-weight: 600;
    font-size: 15px;
}

.aic-header-subtitle {
    font-size: 11px;
    opacity: 0.8;
}

.aic-minimize {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.aic-minimize:hover {
    opacity: 1;
}

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

.aic-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.6;
}

.aic-msg--ai {
    align-self: flex-start;
    background: var(--aic-msg-ai);
    border-bottom-left-radius: 4px;
}

.aic-msg--user {
    align-self: flex-end;
    background: var(--aic-msg-user);
    border-bottom-right-radius: 4px;
}

.aic-msg--error {
    align-self: center;
    background: #ffeaea;
    color: #c0392b;
    text-align: center;
    font-size: 12px;
}

/* Markdown in AI messages */
.aic-msg--ai strong,
.aic-msg--ai b {
    font-weight: 600;
}

.aic-msg--ai ul,
.aic-msg--ai ol {
    margin: 4px 0;
    padding-left: 20px;
}

.aic-msg--ai li {
    margin-bottom: 2px;
}

.aic-msg--ai a {
    color: var(--aic-color);
    text-decoration: underline;
}

.aic-msg--ai p {
    margin: 0 0 8px;
}

.aic-msg--ai p:last-child {
    margin-bottom: 0;
}

/* Typing indicator */
.aic-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    align-self: flex-start;
    background: var(--aic-msg-ai);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.aic-typing-dot {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: aicTyping 1.4s ease-in-out infinite;
}

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

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

/* Input area */
.aic-input-area {
    border-top: 1px solid var(--aic-border);
    padding: 12px;
    flex-shrink: 0;
    background: var(--aic-bg);
}

.aic-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.aic-input {
    flex: 1;
    border: 1px solid var(--aic-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}

.aic-input:focus {
    border-color: var(--aic-color);
}

.aic-send {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--aic-color);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, opacity 0.2s;
}

.aic-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.aic-send:not(:disabled):hover {
    background: var(--aic-color-hover);
}

.aic-powered {
    text-align: center;
    font-size: 10px;
    color: #aaa;
    margin-top: 6px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .aic-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
    }

    .aic-widget--left .aic-panel {
        left: 0;
    }

    .aic-bubble {
        bottom: 16px;
        right: 16px;
    }

    .aic-widget--left .aic-bubble {
        left: 16px;
    }
}
