/* ai-consultant.css — Floating chat widget (bottom-right) */

/* ===== FAB button ===== */
.aic-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a5f7a 0%, #134b61 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 28px;
    line-height: 1;
}

.aic-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.3);
}

.aic-fab.open {
    transform: scale(0);
    pointer-events: none;
}

/* Pulse hint on first visit */
.aic-fab::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(245, 158, 11, 0.6);
    animation: aic-pulse 2s ease-out infinite;
}

.aic-fab.seen::after {
    display: none;
}

@keyframes aic-pulse {
    0% { transform: scale(1); opacity: 1; }
    70% { transform: scale(1.35); opacity: 0; }
    100% { transform: scale(1.35); opacity: 0; }
}

/* ===== Chat window ===== */
.aic-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    max-height: 560px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0,0,0,0.2);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.4) translateY(40px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s;
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
}

.aic-window * {
    box-sizing: border-box;
}

.aic-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.aic-win-header {
    background: linear-gradient(135deg, #1a5f7a 0%, #134b61 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.aic-win-header-left span.icon {
    font-size: 22px;
}

.aic-win-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 16px;
}

.aic-win-subtitle {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 1px;
}

.aic-win-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    flex-shrink: 0;
}

.aic-win-close:hover {
    background: rgba(255,255,255,0.25);
}

/* Body (scrollable) */
.aic-win-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* Limits badge */
.aic-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e8f4f8;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    color: #1a5f7a;
    align-self: center;
}

.aic-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.aic-badge-dot.warn { background: #f59e0b; }
.aic-badge-dot.out { background: #ef4444; }

/* Chat bubbles */
.aic-bubble {
    max-width: 92%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.aic-bubble-user {
    background: #1a5f7a;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.aic-bubble-ai {
    background: #f1f5f9;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

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

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

/* Smart CTA inside bubble */
.aic-cta-card {
    background: #e8f4f8;
    border: 1px solid #b8dde8;
    border-radius: 10px;
    padding: 10px 14px;
    margin-top: 10px;
    font-size: 13px;
    color: #1a5f7a;
    line-height: 1.4;
}

.aic-cta-card a {
    display: inline-block;
    margin-top: 8px;
    background: #0088cc;
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s;
}

.aic-cta-card a:hover {
    background: #006daa;
}

/* Loading dots */
.aic-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 14px 20px;
    background: #f1f5f9;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.aic-typing span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: aic-dot 1.2s infinite;
}

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

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

/* Footer / input area */
.aic-win-footer {
    border-top: 1px solid #e5e7eb;
    padding: 14px 16px;
    flex-shrink: 0;
    background: #fff;
}

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

.aic-input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    max-height: 100px;
    min-height: 42px;
    transition: border-color 0.15s;
    color: #1f2937;
}

.aic-input::placeholder {
    color: #9ca3af;
}

.aic-input:focus {
    outline: none;
    border-color: #1a5f7a;
}

.aic-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #1a5f7a;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, opacity 0.15s;
    flex-shrink: 0;
    font-size: 18px;
}

.aic-send:hover {
    background: #134b61;
}

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

.aic-footer-note {
    text-align: center;
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px;
}

.aic-footer-note a {
    color: #1a5f7a;
    text-decoration: none;
}

/* Limit reached state */
.aic-limit-msg {
    text-align: center;
    padding: 8px 0;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.aic-limit-msg a {
    display: inline-block;
    margin-top: 10px;
    background: #0088cc;
    color: white;
    padding: 8px 18px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

/* ===== Mobile ===== */
@media (max-width: 640px) {
    .aic-fab {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
        font-size: 24px;
    }

    .aic-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        max-height: none;
        border-radius: 0;
        transform-origin: bottom center;
    }

    .aic-win-footer {
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    /* Prevent body scroll when chat is open */
    body.aic-body-lock {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }
}
