/**
 * Join a School in France — chatbot skin.
 *
 * Overrides widget-base.css for the Join brand.
 * Scoped under .join-launcher, .join-close, .join-dialog.
 * No font-family: inherits from the host theme (Inter).
 */

:root {
    --join-brand:       #e3193f;
    --join-brand-hover: #c4112f;
    --join-brand-fg:    #fff;
    --join-brand-soft:  #fdf2f4;
    --join-fg:          #171717;   /* neutral-900 */
    --join-muted:       #f9fafb;   /* neutral-50  */
    --join-muted-fg:    #737373;   /* neutral-500 */
    --join-border:      #e5e7eb;   /* neutral-200 */
    --join-card:        #fff;
    --join-shadow:      0 20px 60px -15px rgb(227 25 63 / .18);
    --join-radius-dialog: 24px;
    --join-radius-bubble: 16px;
    --join-radius-input:  3px;
}

/* -------------------------------------------------------------------------
 * Launcher (closed state) — simple red circle with chat icon
 * ------------------------------------------------------------------------- */

.dify-open-button.join-launcher {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    background: var(--join-brand);
    color: var(--join-brand-fg);
    border: 0;
    border-radius: 999px;
    box-shadow: var(--join-shadow);
    cursor: pointer;
    transition: transform .2s ease, background .15s ease;
}

.dify-open-button.join-launcher:hover {
    background: var(--join-brand-hover);
    transform: scale(1.05);
}

.dify-open-button.join-launcher:active {
    transform: scale(.95);
}

/* Hide inherited pieces not used by this skin. */
.dify-open-button.join-launcher .fda-launcher__bubble,
.dify-open-button.join-launcher .fda-launcher__avatar,
.dify-open-button.join-launcher .notification-badge {
    display: none !important;
}

.dify-open-button.join-launcher .bubble-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.dify-open-button.join-launcher .bubble-icon svg {
    width: 26px;
    height: 26px;
}

/* -------------------------------------------------------------------------
 * Close button (visible when dialog is open)
 * ------------------------------------------------------------------------- */

.dify-close-button.join-close {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    padding: 0;
    background: var(--join-brand);
    color: var(--join-brand-fg);
    border: 0;
    border-radius: 999px;
    box-shadow: var(--join-shadow);
    cursor: pointer;
    transition: transform .2s ease, background .15s ease;
}

.dify-close-button.join-close:hover {
    background: var(--join-brand-hover);
    transform: scale(1.05);
}

.dify-close-button.join-close:active {
    transform: scale(.95);
}

.dify-close-button.join-close .bubble-icon svg {
    width: 22px;
    height: 22px;
}

/* -------------------------------------------------------------------------
 * Dialog (open state)
 * ------------------------------------------------------------------------- */

.dify-chatbot.join-dialog {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 9997;
    display: flex;
    flex-direction: column;
    width: 416px;
    max-width: calc(100vw - 48px);
    height: 512px;
    max-height: calc(100vh - 120px);
    overflow: hidden;
    background: var(--join-card);
    border: 1px solid var(--join-border);
    border-radius: var(--join-radius-dialog);
    box-shadow: var(--join-shadow);
    color: var(--join-fg);
}

.dify-chatbot.join-dialog .resize-handle,
.dify-chatbot.join-dialog .new-conversation-button,
.dify-chatbot.join-dialog .minimize-button {
    display: none !important;
}

/* Header — logo only. */
.dify-chatbot.join-dialog .dify-widget-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: var(--join-card);
    border-bottom: 1px solid var(--join-border);
    min-height: 64px;
}

.join-header__logo {
    display: block;
    height: 40px;
    width: auto;
}

/* Hide title (kept in markup for a11y aria-labelledby). */
.dify-chatbot.join-dialog .dify-widget-title {
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    width: 1px;
    height: 1px;
}

/* Hide FDA-specific header pieces if present. */
.dify-chatbot.join-dialog .fda-header__logos,
.dify-chatbot.join-dialog .fda-header__badge {
    display: none !important;
}

/* Messages stream. */
.dify-chatbot.join-dialog .dify-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--join-muted);
}

.dify-chatbot.join-dialog .dify-welcome-message,
.dify-chatbot.join-dialog .message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.dify-chatbot.join-dialog .message.user-message {
    flex-direction: row-reverse;
}

/* Bot avatar: wide landscape SVG (80 × 56 px) — not a circle. */
.dify-chatbot.join-dialog .message-avatar.bot-avatar {
    flex-shrink: 0;
    width: 80px;
    height: 56px;
    border-radius: 0;
    object-fit: contain;
    background: transparent;
}

/* User avatar: discreet red circle. */
.dify-chatbot.join-dialog span.message-avatar.user-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--join-brand);
    color: var(--join-brand-fg);
    border-radius: 999px;
    font-size: 16px;
}

.dify-chatbot.join-dialog .message-body {
    max-width: 80%;
}

/* Bot bubble — white, border, rounded with flattened bottom-left. */
.dify-chatbot.join-dialog .message-content {
    padding: 10px 16px;
    background: var(--join-card);
    border: 1px solid var(--join-border);
    border-radius: var(--join-radius-bubble);
    border-bottom-left-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgb(0 0 0 / .04);
    white-space: pre-line;
    color: var(--join-fg);
}

/* User bubble — red, flattened bottom-right. */
.dify-chatbot.join-dialog .message.user-message .message-content {
    background: var(--join-brand);
    color: var(--join-brand-fg);
    border-color: var(--join-brand);
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: var(--join-radius-bubble);
}

.dify-chatbot.join-dialog .message.user-message .message-content a {
    color: inherit;
    text-decoration: underline;
}

/* Markdown helpers inside bot bubbles. */
.dify-chatbot.join-dialog .markdown-body p {
    margin: 0 0 8px;
}

.dify-chatbot.join-dialog .markdown-body p:last-child {
    margin-bottom: 0;
}

.dify-chatbot.join-dialog .markdown-body a {
    color: var(--join-brand);
}

.dify-chatbot.join-dialog .markdown-body ul,
.dify-chatbot.join-dialog .markdown-body ol {
    margin: 0 0 8px;
    padding-left: 20px;
}

.dify-chatbot.join-dialog .markdown-body code {
    padding: 1px 4px;
    background: var(--join-brand-soft);
    border-radius: 4px;
    font-size: .9em;
}

/* Typing indicator. */
.dify-chatbot.join-dialog .typing-indicator {
    display: inline-flex;
    gap: 4px;
    padding: 6px 0;
}

.dify-chatbot.join-dialog .typing-indicator > span {
    width: 6px;
    height: 6px;
    background: var(--join-muted-fg);
    border-radius: 999px;
    animation: join-typing 1.2s infinite ease-in-out;
}

.dify-chatbot.join-dialog .typing-indicator > span:nth-child(2) {
    animation-delay: .15s;
}

.dify-chatbot.join-dialog .typing-indicator > span:nth-child(3) {
    animation-delay: .3s;
}

@keyframes join-typing {
    0%, 80%, 100% {
        opacity: .3;
        transform: scale(.85);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Input zone. */
.dify-chatbot.join-dialog .dify-widget-input {
    padding: 12px;
    background: var(--join-card);
    border-top: 1px solid var(--join-border);
}

.dify-chatbot.join-dialog .dify-input-form .input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dify-chatbot.join-dialog .message-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 16px;
    background: var(--join-card);
    border: 1px solid var(--join-border);
    border-radius: var(--join-radius-input);
    font: inherit;
    font-size: 14px;
    color: var(--join-fg);
    resize: none;
    line-height: 1.4;
}

.dify-chatbot.join-dialog .message-input:focus {
    outline: none;
    border-color: var(--join-brand);
    box-shadow: 0 0 0 2px rgb(227 25 63 / .15);
}

/* Send button — red circle. */
.dify-chatbot.join-dialog .send-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--join-brand);
    color: var(--join-brand-fg);
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: opacity .15s ease, transform .15s ease;
}

.dify-chatbot.join-dialog .send-button:hover:not([disabled]) {
    opacity: .9;
    transform: scale(1.05);
}

.dify-chatbot.join-dialog .send-button:active:not([disabled]) {
    transform: scale(.95);
}

.dify-chatbot.join-dialog .send-button[disabled] {
    opacity: .4;
    cursor: not-allowed;
}

/* Show the arrow icon, hide the paper-plane SVG used by FDA. */
.dify-chatbot.join-dialog .send-button .send-icon-paper {
    display: none;
}

.dify-chatbot.join-dialog .send-button .send-icon {
    display: block;
    width: 16px;
    height: 16px;
}

.dify-chatbot.join-dialog .send-button .loading-spinner {
    display: none;
}

/* Suggestions. */
.dify-chatbot.join-dialog .suggestions-content {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.dify-chatbot.join-dialog .suggestion-button {
    padding: 6px 12px;
    background: var(--join-card);
    color: var(--join-brand);
    border: 1px solid var(--join-brand);
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.dify-chatbot.join-dialog .suggestion-button:hover {
    background: var(--join-brand);
    color: var(--join-brand-fg);
}

/* Feedback buttons. */
.dify-chatbot.join-dialog .message-feedback {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.dify-chatbot.join-dialog .feedback-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    background: transparent;
    border: 0;
    color: var(--join-muted-fg);
    font-size: 14px;
    cursor: pointer;
    opacity: .6;
    transition: opacity .15s ease;
}

.dify-chatbot.join-dialog .feedback-btn:hover,
.dify-chatbot.join-dialog .feedback-btn.active {
    opacity: 1;
    color: var(--join-brand);
}
