/* Position the whole container at the bottom right */
#coach-bot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

#bot-launcher {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #f8fffe;
    color: #2f9f95;
    border: 6px solid #b7e6e2;
    padding: 8px 18px 8px 8px;
    border-radius: 999px;
    cursor: pointer;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#bot-launcher:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.28);
}

#bot-launcher.is-hidden {
    display: none !important;
}

#bot-launcher-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.22);
}

#bot-launcher-text {
    font-size: 25px;
    font-weight: 500;
    letter-spacing: 0.3px;
    line-height: 1;
}

#bot-window {
    display: none;
    flex-direction: column;
    width: 330px;
    max-width: calc(100vw - 40px);
    height: 480px;
    max-height: 70vh;
    border-radius: 16px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background-color: #ffffff;
    color: #1f2937;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.35);
    overflow: hidden;
    transition: transform 0.24s ease, opacity 0.24s ease;
    transform: translateY(10px);
    opacity: 0;
}

#bot-window.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

#bot-messages {
    flex: 1;
    color: #0f172a;
    font-size: 14px;
    line-height: 1.5;
    padding: 12px;
    overflow-y: auto;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

#bot-onboarding-form {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

#bot-onboarding-form h3 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #1f2937;
}

#bot-onboarding-form p {
    margin: 0 0 10px;
    font-size: 13px;
    color: #475569;
}

#bot-name-input,
#bot-phone-input,
#bot-country-code-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

#bot-name-input:focus,
#bot-phone-input:focus,
#bot-country-code-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#bot-name-input {
    margin-bottom: 8px;
}

.bot-phone-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

#bot-country-code-input {
    max-width: 130px;
}

.bot-start-btn {
    width: 100%;
    border: none;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.bot-start-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

#bot-header {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #ffffff;
    padding: 10px 44px 10px 12px;
    text-align: left;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

#bot-header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

#bot-header-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
}

#bot-header-text {
    line-height: 1.25;
}

#bot-header small {
    display: block;
    font-weight: 400;
    font-size: 12px;
    opacity: 0.85;
}

#bot-close-button {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

#bot-close-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#bot-input-area {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

#bot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

#bot-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

#bot-send-button {
    border: none;
    background: linear-gradient(135deg, #2563eb, #60a5fa);
    color: white;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s ease, filter 0.2s ease;
}

#bot-send-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

@media (max-width: 768px) {
    #coach-bot-container {
        position: fixed;
        bottom: 20px;
        right: 12px;
        left: auto;
        transform: none;
        width: auto;
        max-width: calc(100vw - 20px);
        z-index: 10000;
        overflow: visible;
        display: block !important;
        visibility: visible !important;
    }

    @supports (bottom: env(safe-area-inset-bottom)) {
        #coach-bot-container {
            bottom: calc(env(safe-area-inset-bottom) + 16px);
        }
    }

    #bot-launcher {
        display: inline-flex;
        visibility: visible;
        border-width: 4px;
        padding: 4px;
        gap: 0;
        flex-shrink: 0;
        width: auto;
        min-width: auto;
        max-width: calc(100vw - 20px);
    }

    #bot-launcher-avatar {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    #bot-launcher-text {
        display: none;
    }

    #bot-window {
        width: 90vw;
        max-width: calc(100vw - 20px);
        margin: 0;
    }
}