:root {
    --teamadroit-navy: #263b55;
    --teamadroit-dark-navy: #17263a;
    --teamadroit-blue-gray: #52657c;
    --teamadroit-orange: #f15a3b;
    --teamadroit-orange-hover: #d9482c;
    --teamadroit-light-bg: #f6f8fb;
    --teamadroit-border: #d7dde6;
    --teamadroit-text: #172033;
}

#teamadroit-chatbot {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 999999;
    font-family: Arial, Helvetica, sans-serif;
}

/* Launcher bubble */
#teamadroit-chatbot-launcher {
    display: none;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 999px;
    background: var(--teamadroit-navy);
    color: #ffffff;
    padding: 12px 16px;
    box-shadow: 0 14px 40px rgba(17, 24, 39, 0.25);
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    animation: teamadroit-launcher-in 0.35s ease-out both;
}

#teamadroit-chatbot-launcher:hover {
    background: var(--teamadroit-dark-navy);
}

#teamadroit-launcher-dots {
    display: grid;
    grid-template-columns: repeat(3, 6px);
    grid-template-rows: repeat(3, 6px);
    gap: 4px;
}

#teamadroit-launcher-dots span {
    width: 6px;
    height: 6px;
    background: var(--teamadroit-orange);
    border-radius: 50%;
    display: block;
}

@keyframes teamadroit-launcher-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chatbot window */
#teamadroit-chatbot-window {
    width: 380px;
    height: min(560px, calc(100vh - 44px));
    background: #ffffff;
    border: 1px solid var(--teamadroit-border);
    border-radius: 18px;
    box-shadow: 0 18px 55px rgba(17, 24, 39, 0.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: teamadroit-chatbot-enter 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
    transform-origin: bottom right;
}

#teamadroit-chatbot.teamadroit-chatbot-closed #teamadroit-chatbot-window {
    display: none;
}

#teamadroit-chatbot.teamadroit-chatbot-closed #teamadroit-chatbot-launcher {
    display: flex;
}

@keyframes teamadroit-chatbot-enter {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }

    60% {
        opacity: 1;
        transform: translateY(-3px) scale(1.01);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
#teamadroit-chatbot-header {
    background: linear-gradient(135deg, var(--teamadroit-navy), var(--teamadroit-blue-gray));
    color: #ffffff;
    padding: 16px 16px 15px 16px;
    border-bottom: 4px solid var(--teamadroit-orange);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

#teamadroit-chatbot-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

#teamadroit-chatbot-accent-dots {
    display: grid;
    grid-template-columns: repeat(3, 8px);
    grid-template-rows: repeat(3, 8px);
    gap: 5px;
    flex-shrink: 0;
}

#teamadroit-chatbot-accent-dots span {
    width: 8px;
    height: 8px;
    background: var(--teamadroit-orange);
    border-radius: 50%;
    display: block;
}

#teamadroit-chatbot-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    letter-spacing: 0.1px;
}

#teamadroit-chatbot-subtitle {
    font-size: 12px;
    line-height: 1.35;
    color: #eef3f8;
    max-width: 280px;
}

#teamadroit-chatbot-minimize {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.9;
}

#teamadroit-chatbot-minimize:hover {
    opacity: 1;
}

/* Messages */
#teamadroit-chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: var(--teamadroit-light-bg);
}

.teamadroit-chatbot-message {
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 14px;
    margin-bottom: 10px;
    line-height: 1.45;
    font-size: 13.5px;
    white-space: normal;
    text-align: left;
    animation: teamadroit-message-in 0.22s ease-out both;
}

@keyframes teamadroit-message-in {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.teamadroit-chatbot-message.bot {
    background: #ffffff;
    border: 1px solid var(--teamadroit-border);
    color: var(--teamadroit-text);
    border-top-left-radius: 5px;
}

.teamadroit-chatbot-message.user {
    background: var(--teamadroit-navy);
    color: #ffffff;
    margin-left: auto;
    border-top-right-radius: 5px;
}

/* Suggestions */
#teamadroit-chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 8px;
}

.teamadroit-chatbot-suggestion {
    background: #ffffff;
    color: var(--teamadroit-navy);
    border: 1px solid var(--teamadroit-border);
    border-radius: 999px;
    padding: 8px 11px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.teamadroit-chatbot-suggestion:hover {
    background: var(--teamadroit-orange);
    border-color: var(--teamadroit-orange);
    color: #ffffff;
}

/* Input area */
#teamadroit-chatbot-input-area {
    display: flex;
    border-top: 1px solid var(--teamadroit-border);
    background: #ffffff;
}

#teamadroit-chatbot-input {
    flex: 1;
    min-width: 0;
    border: none;
    padding: 14px;
    font-size: 13.5px;
    outline: none;
    color: var(--teamadroit-text);
}

#teamadroit-chatbot-input::placeholder {
    color: #6b7280;
}

#teamadroit-chatbot-send {
    border: none;
    background: var(--teamadroit-orange);
    color: #ffffff;
    padding: 0 18px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

#teamadroit-chatbot-send:hover {
    background: var(--teamadroit-orange-hover);
}

/* Thinking animation */
.teamadroit-chatbot-message.teamadroit-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
}

.teamadroit-thinking-label {
    font-size: 13px;
    color: var(--teamadroit-text);
}

.teamadroit-thinking-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.teamadroit-thinking-dots span {
    width: 6px;
    height: 6px;
    background: var(--teamadroit-orange);
    border-radius: 50%;
    display: block;
    animation: teamadroit-dot-bounce 1s infinite ease-in-out;
}

.teamadroit-thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.teamadroit-thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes teamadroit-dot-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }

    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* Scrollbar */
#teamadroit-chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

#teamadroit-chatbot-messages::-webkit-scrollbar-track {
    background: #eef2f7;
}

#teamadroit-chatbot-messages::-webkit-scrollbar-thumb {
    background: #b7c1cf;
    border-radius: 999px;
}

#teamadroit-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #8d9aaa;
}

/* Medium screens */
@media (max-width: 1024px) {
    #teamadroit-chatbot {
        right: 18px;
        bottom: 18px;
    }

    #teamadroit-chatbot-window {
        width: 360px;
        height: min(540px, calc(100vh - 36px));
    }
}

/* Mobile */
@media (max-width: 640px) {
    #teamadroit-chatbot {
        right: 14px;
        bottom: 14px;
        left: auto;
    }

    #teamadroit-chatbot-window {
        position: fixed;
        right: 10px;
        left: 10px;
        bottom: 10px;
        width: auto;
        height: min(72vh, 560px);
        border-radius: 16px;
        transform-origin: bottom right;
    }

    #teamadroit-chatbot:not(.teamadroit-user-opened) #teamadroit-chatbot-window {
        display: none;
    }

    #teamadroit-chatbot:not(.teamadroit-user-opened) #teamadroit-chatbot-launcher {
        display: flex;
    }

    #teamadroit-chatbot-header {
        padding: 14px;
    }

    #teamadroit-chatbot-title {
        font-size: 15px;
    }

    #teamadroit-chatbot-subtitle {
        font-size: 11.5px;
        max-width: 230px;
    }

    #teamadroit-chatbot-accent-dots {
        grid-template-columns: repeat(3, 7px);
        grid-template-rows: repeat(3, 7px);
        gap: 4px;
    }

    #teamadroit-chatbot-accent-dots span {
        width: 7px;
        height: 7px;
    }

    #teamadroit-chatbot-messages {
        padding: 13px;
    }

    .teamadroit-chatbot-message {
        max-width: 92%;
        font-size: 13px;
    }

    #teamadroit-chatbot-input {
        font-size: 13px;
        padding: 13px;
    }

    #teamadroit-chatbot-send {
        font-size: 13px;
        padding: 0 15px;
    }

    #teamadroit-chatbot-launcher {
        padding: 12px 15px;
    }
}

/* Very small phones */
@media (max-width: 380px) {
    #teamadroit-chatbot-window {
        height: 76vh;
    }

    #teamadroit-chatbot-subtitle {
        display: none;
    }

    #teamadroit-chatbot-title {
        margin-bottom: 0;
    }

    .teamadroit-chatbot-suggestion {
        font-size: 11.5px;
        padding: 7px 9px;
    }
}

/* Respect users who disable motion */
@media (prefers-reduced-motion: reduce) {
    #teamadroit-chatbot-window,
    #teamadroit-chatbot-launcher,
    .teamadroit-chatbot-message,
    .teamadroit-thinking-dots span {
        animation: none;
    }
}