/* The Advisor Chat Popup — Frontend Styles */

#acp-root { font-family: system-ui, -apple-system, sans-serif; }

/* Floating button */
.acp-fab {
    position: fixed;
    z-index: 999998;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.acp-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 36px rgba(0,0,0,0.3);
}

.acp-fab:active { transform: scale(0.97); }

.acp-fab.bottom-right { bottom: 24px; right: 24px; }
.acp-fab.bottom-left  { bottom: 24px; left: 24px;  }

.acp-fab-icon { font-size: 18px; line-height: 1; }
.acp-fab-label { white-space: nowrap; }

.acp-fab-pulse {
    position: absolute;
    top: -4px; right: -4px;
    width: 12px; height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid white;
    animation: acp-pulse 2s infinite;
}

@keyframes acp-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

/* Chat window */
.acp-window {
    position: fixed;
    z-index: 999999;
    width: 380px;
    height: 580px;
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    box-shadow: 0 24px 60px rgba(0,0,0,0.20);
    border: 1px solid rgba(148,163,184,0.3);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}

.acp-window.bottom-right { bottom: 90px; right: 24px; transform-origin: bottom right; }
.acp-window.bottom-left  { bottom: 90px; left: 24px;  transform-origin: bottom left;  }

.acp-window.hidden {
    transform: scale(0.85);
    opacity: 0;
    pointer-events: none;
}

.acp-window.visible {
    transform: scale(1);
    opacity: 1;
}

/* Header */
.acp-win-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(148,163,184,0.25);
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(56,189,248,0.05));
}

.acp-win-logo {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    flex-shrink: 0;
}

.acp-win-title { font-size: 16px; font-weight: 700; color: #0f172a; }
.acp-win-sub   { font-size: 12px; color: #6b7280; margin-top: 1px; }

.acp-win-close {
    margin-left: auto;
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(148,163,184,0.2);
    cursor: pointer;
    font-size: 16px;
    color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}
.acp-win-close:hover { background: rgba(148,163,184,0.4); }

/* Messages */
.acp-messages {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.acp-msg {
    max-width: 85%;
    padding: 9px 12px;
    border-radius: 14px;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.5;
    word-wrap: break-word;
}

.acp-msg.bot {
    background: white;
    color: #111827;
    border: 1px solid rgba(148,163,184,0.3);
    border-bottom-left-radius: 4px;
    margin-right: auto;
}

.acp-msg.user {
    background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
}

.acp-msg.bot p { margin: 0 0 6px; }
.acp-msg.bot p:last-child { margin-bottom: 0; }

/* Partner card inside chat */
.atc-partner-suggestion {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border: 1px solid rgba(251,191,36,0.5);
    font-size: 12px;
    line-height: 1.5;
    color: #1a1714;
}
.atc-partner-suggestion strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; color: #92400e; }
.atc-partner-btn {
    display: inline-block;
    margin-top: 7px;
    padding: 5px 12px;
    background: #f59e0b;
    color: #fff !important;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    box-shadow: 0 3px 10px rgba(245,158,11,0.35);
}
.atc-partner-btn:hover { background: #d97706 !important; }
.atc-partner-contact { display: block; margin-top: 5px; font-size: 12px; color: #78350f; font-weight: 500; }
.atc-also-check { display: block; margin-top: 6px; font-size: 11px; color: #78350f !important; }
.atc-also-check em { color: #92400e; font-style: normal; font-weight: 600; }
.atc-also-link { color: #92400e !important; text-decoration: underline !important; font-weight: 500; }

/* Typing indicator */
.acp-typing {
    display: none;
    padding: 6px 12px;
}

.acp-typing .acp-msg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
}

.acp-dot {
    width: 6px; height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: acp-bounce 1s infinite ease-in-out;
}
.acp-dot:nth-child(2) { animation-delay: 0.18s; }
.acp-dot:nth-child(3) { animation-delay: 0.36s; }

@keyframes acp-bounce {
    0%,80%,100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-3px); opacity: 1; }
}

/* Input */
.acp-input-area {
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(148,163,184,0.25);
    background: rgba(249,250,251,0.95);
}

.acp-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
}

.acp-input {
    flex: 1;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    font-size: 14px;
    outline: none;
    background: white;
    color: #0f172a;
    font-family: inherit;
}

.acp-input:focus { border-color: #3b82f6; }

.acp-send {
    border-radius: 999px;
    border: none;
    padding: 0 16px;
    background: linear-gradient(135deg, #1d4ed8, #0ea5e9);
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 6px 18px rgba(37,99,235,0.4);
    min-width: 64px;
}

.acp-send:disabled { opacity: 0.6; cursor: default; box-shadow: none; }

.acp-powered {
    text-align: center;
    font-size: 10px;
    color: #9ca3af;
}

.acp-powered a { color: #9ca3af; text-decoration: none; }
.acp-powered a:hover { color: #6b7280; }

/* Mobile */
@media (max-width: 480px) {
    .acp-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        border-radius: 14px;
    }
    .acp-window.bottom-right { right: 8px; bottom: 72px; }
    .acp-window.bottom-left  { left: 8px;  bottom: 72px; }
    .acp-fab { padding: 10px 16px; font-size: 13px; }
    .acp-fab.bottom-right { bottom: 16px; right: 16px; }
    .acp-fab.bottom-left  { bottom: 16px; left: 16px;  }
}

.acp-hidden-mobile { display: none !important; }
