/* Azimuth Adviser — Widget Styles */

#azimuth-adviser-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ——— TRIGGER BUTTON ——— */
#azimuth-trigger {
    height: 48px;
    border-radius: 28px;
    background: var(--azimuth-accent, #E8640C);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    padding: 0 18px 0 8px;
    white-space: nowrap;
}

#azimuth-trigger:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 28px rgba(0,0,0,0.3);
}

#azimuth-trigger:active {
    transform: scale(0.97);
}

#azimuth-trigger-icon {
    width: 36px;
    height: 36px;
    object-fit: cover;
    object-position: var(--azimuth-icon-position, 50% 20%);
    flex-shrink: 0;
    border-radius: 50%;
}

#azimuth-trigger-label {
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* Speech bubble badge — hidden on desktop, shown on mobile, sits outside button */
#azimuth-chat-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    font-size: 12px;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    line-height: 1;
    pointer-events: none;
}

/* ——— MOBILE ——— */
@media (max-width: 480px) {
    #azimuth-adviser-root {
        bottom: 20px;
        right: 20px;
    }

    #azimuth-trigger-label {
        display: none;
    }

    #azimuth-trigger {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
        overflow: hidden;
    }

    #azimuth-chat-badge {
        display: flex;
    }

    #azimuth-trigger-icon {
        width: 100%;
        height: 100%;
        border-radius: 50%;
    }

    #azimuth-teaser {
        max-width: 220px;
        font-size: 12px;
    }

    #azimuth-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        transform-origin: bottom center;
    }

    @keyframes azimuth-panel-in {
        from { transform: translateY(100%); opacity: 0; }
        to   { transform: translateY(0); opacity: 1; }
    }
}

/* ——— TEASER BUBBLE ——— */
#azimuth-teaser {
    position: absolute;
    bottom: 62px;
    right: 0;
    background: #1a1a1a;
    color: #fff;
    padding: 10px 14px 10px 14px;
    border-radius: 12px 12px 4px 12px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 260px;
    white-space: normal;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#azimuth-teaser.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#azimuth-teaser-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.15s;
}

#azimuth-teaser-close:hover {
    color: #fff;
}

/* Small arrow pointing down-right */
#azimuth-teaser::after {
    content: '';
    position: absolute;
    bottom: -7px;
    right: 16px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 0px solid transparent;
    border-top: 7px solid #1a1a1a;
}

/* ——— PANEL ——— */
#azimuth-panel {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 380px;
    max-height: 580px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
}

#azimuth-panel[hidden] {
    display: none !important;
}

#azimuth-panel.azimuth-opening {
    animation: azimuth-panel-in 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#azimuth-panel.azimuth-closing {
    animation: azimuth-panel-out 0.18s ease forwards;
}

@keyframes azimuth-panel-in {
    from { transform: scale(0.85) translateY(12px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

@keyframes azimuth-panel-out {
    from { transform: scale(1); opacity: 1; }
    to   { transform: scale(0.9) translateY(8px); opacity: 0; }
}

/* ——— HEADER ——— */
#azimuth-header {
    background: var(--azimuth-accent, #E8640C);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#azimuth-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#azimuth-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

#azimuth-avatar-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: var(--azimuth-icon-position, 50% 20%);
    border-radius: 50%;
}

#azimuth-bot-name {
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}

#azimuth-bot-status {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.azimuth-status-dot {
    width: 6px;
    height: 6px;
    background: #7fffb5;
    border-radius: 50%;
    display: inline-block;
}

#azimuth-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
    border-radius: 4px;
}

#azimuth-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

/* ——— MESSAGES ——— */
#azimuth-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

#azimuth-messages::-webkit-scrollbar {
    width: 4px;
}
#azimuth-messages::-webkit-scrollbar-track { background: transparent; }
#azimuth-messages::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.azimuth-message {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    animation: azimuth-msg-in 0.2s ease;
}

@keyframes azimuth-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.azimuth-message.bot {
    background: #f5f5f5;
    color: #1a1a1a;
    border-radius: 4px 14px 14px 14px;
    align-self: flex-start;
}

.azimuth-message.user {
    background: var(--azimuth-accent, #E8640C);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    align-self: flex-end;
}

.azimuth-message p { margin: 0 0 6px; }
.azimuth-message p:last-child { margin-bottom: 0; }
.azimuth-message a { color: inherit; text-decoration: underline; opacity: 0.85; }
.azimuth-message.bot a { color: var(--azimuth-accent, #E8640C); opacity: 1; }
.azimuth-message strong { font-weight: 600; }
.azimuth-message ul, .azimuth-message ol { margin: 4px 0 4px 18px; padding: 0; }
.azimuth-message li { margin-bottom: 3px; }

/* Typing indicator */
.azimuth-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #f5f5f5;
    border-radius: 4px 14px 14px 14px;
    align-self: flex-start;
    width: fit-content;
}

.azimuth-typing span {
    width: 7px;
    height: 7px;
    background: #aaa;
    border-radius: 50%;
    animation: azimuth-typing-dot 1.2s ease-in-out infinite;
}

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

@keyframes azimuth-typing-dot {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ——— STARTER BUTTONS ——— */
#azimuth-starters {
    padding: 4px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.azimuth-starter {
    background: #fff;
    border: 1.5px solid #eee;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    color: #333;
    font-family: inherit;
    line-height: 1.3;
}

.azimuth-starter:hover {
    border-color: var(--azimuth-accent, #E8640C);
    background: #fff8f3;
    transform: translateX(2px);
}

.azimuth-starter:active {
    transform: translateX(0);
}

/* ——— INPUT AREA ——— */
#azimuth-input-area {
    padding: 10px 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
    background: #fff;
}

#azimuth-input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13.5px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.15s;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.5;
    color: #1a1a1a;
}

#azimuth-input:focus {
    border-color: var(--azimuth-accent, #E8640C);
}

#azimuth-input::placeholder {
    color: #bbb;
}

#azimuth-send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--azimuth-accent, #E8640C);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
    padding: 0;
}

#azimuth-send:hover { background: #c45500; }
#azimuth-send:active { transform: scale(0.94); }
#azimuth-send:disabled { opacity: 0.5; cursor: not-allowed; }

#azimuth-send svg {
    width: 16px;
    height: 16px;
}

/* ——— FOOTER NOTE ——— */
#azimuth-footer-note {
    padding: 6px 14px 10px;
    font-size: 10.5px;
    color: #aaa;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}

/* ——— LEAD CAPTURE FORM ——— */
#azimuth-lead-form {
    border-top: 1px solid #eee;
    background: #fff8f3;
    flex-shrink: 0;
    animation: azimuth-msg-in 0.25s ease;
}

#azimuth-lead-form[hidden] {
    display: none !important;
}

#azimuth-lead-inner {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#azimuth-lead-prompt {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

#azimuth-lead-name,
#azimuth-lead-email {
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    color: #1a1a1a;
    background: #fff;
}

#azimuth-lead-name:focus,
#azimuth-lead-email:focus {
    border-color: var(--azimuth-accent, #E8640C);
}

#azimuth-lead-buttons {
    display: flex;
    gap: 8px;
}

#azimuth-lead-submit {
    flex: 1;
    background: var(--azimuth-accent, #E8640C);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

#azimuth-lead-submit:hover { background: #c45500; }
#azimuth-lead-submit:disabled { opacity: 0.6; cursor: not-allowed; }

#azimuth-lead-skip {
    background: none;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 13px;
    color: #888;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

#azimuth-lead-skip:hover { border-color: #aaa; color: #555; }

#azimuth-lead-message {
    font-size: 12.5px;
    color: #555;
    margin: 0;
    text-align: center;
}

#azimuth-lead-message[hidden] { display: none !important; }

/* ——— MOBILE ——— */
@media (max-width: 480px) {
    #azimuth-adviser-root {
        bottom: 16px;
        right: 16px;
    }

    #azimuth-trigger-label {
        display: none;
    }

    #azimuth-trigger {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        padding: 0;
        justify-content: center;
    }

    #azimuth-teaser {
        max-width: 220px;
        font-size: 12px;
    }

    #azimuth-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 90vh;
        border-radius: 16px 16px 0 0;
        transform-origin: bottom center;
    }

    @keyframes azimuth-panel-in {
        from { transform: translateY(100%); opacity: 0; }
        to   { transform: translateY(0); opacity: 1; }
    }
}
