/* Coast Bands chat widget. Mobile-first; deliberately self-contained so it
   can be dropped onto any band page without polluting the host theme. */

.coast-chat {
    --coast-chat-bg: #ffffff;
    --coast-chat-fg: #111827;
    --coast-chat-muted: #6b7280;
    --coast-chat-accent: #b9233a;
    --coast-chat-accent-fg: #ffffff;
    --coast-chat-border: rgba(17, 24, 39, 0.12);
    --coast-chat-bubble-user-bg: #b9233a;
    --coast-chat-bubble-user-fg: #ffffff;
    --coast-chat-bubble-bot-bg: #f3f4f6;
    --coast-chat-bubble-bot-fg: #111827;
    --coast-chat-radius: 14px;
    --coast-chat-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);

    font-family: 'Inter Tight', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--coast-chat-fg);
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
}

.coast-chat__launcher {
    background: var(--coast-chat-accent);
    color: var(--coast-chat-accent-fg);
    border: none;
    border-radius: 999px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: 15px;
    box-shadow: var(--coast-chat-shadow);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
}

.coast-chat__launcher:hover { filter: brightness(0.95); }

.coast-chat__panel {
    display: none;
    width: min(380px, calc(100vw - 24px));
    height: min(620px, calc(100vh - 32px));
    background: var(--coast-chat-bg);
    border-radius: var(--coast-chat-radius);
    box-shadow: var(--coast-chat-shadow);
    overflow: hidden;
    flex-direction: column;
}

.coast-chat[data-state="open"] .coast-chat__panel { display: flex; }
.coast-chat[data-state="open"] .coast-chat__launcher { display: none; }

.coast-chat__header {
    background: var(--coast-chat-accent);
    color: var(--coast-chat-accent-fg);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.coast-chat__title { font-weight: 600; font-size: 15px; }
.coast-chat__subtitle { font-size: 12px; opacity: 0.85; margin-top: 2px; }

.coast-chat__close {
    background: transparent;
    color: inherit;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 6px;
}
.coast-chat__close:hover { background: rgba(255, 255, 255, 0.18); }

.coast-chat__cta {
    display: inline-block;
    background: var(--coast-chat-accent-fg);
    color: var(--coast-chat-accent);
    text-decoration: none;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    margin: 0 16px 12px;
    text-align: center;
}

.coast-chat__cta:hover { filter: brightness(0.95); }

.coast-chat__gate {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coast-chat__gate label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--coast-chat-fg);
}

.coast-chat__gate input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--coast-chat-border);
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: var(--coast-chat-fg);
}

.coast-chat__gate input:focus {
    outline: 2px solid var(--coast-chat-accent);
    outline-offset: 1px;
}

.coast-chat__submit {
    background: var(--coast-chat-accent);
    color: var(--coast-chat-accent-fg);
    border: none;
    border-radius: 10px;
    padding: 12px 14px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.coast-chat__submit:disabled { opacity: 0.6; cursor: not-allowed; }

.coast-chat__conversation {
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.coast-chat__feed {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coast-chat__bubble {
    max-width: 86%;
    padding: 10px 14px;
    border-radius: 14px;
    line-height: 1.4;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.coast-chat__bubble--bot {
    background: var(--coast-chat-bubble-bot-bg);
    color: var(--coast-chat-bubble-bot-fg);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.coast-chat__bubble--user {
    background: var(--coast-chat-bubble-user-bg);
    color: var(--coast-chat-bubble-user-fg);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.coast-chat__bubble--error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    align-self: stretch;
    font-size: 13px;
}

.coast-chat__composer {
    border-top: 1px solid var(--coast-chat-border);
    padding: 10px;
    display: flex;
    gap: 8px;
    background: #fff;
}

.coast-chat__composer textarea {
    flex: 1;
    border: 1px solid var(--coast-chat-border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    color: var(--coast-chat-fg);
    background: #fff;
}

.coast-chat__composer textarea:focus {
    outline: 2px solid var(--coast-chat-accent);
    outline-offset: 1px;
}

.coast-chat__send {
    background: var(--coast-chat-accent);
    color: var(--coast-chat-accent-fg);
    border: none;
    border-radius: 10px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.coast-chat__send:disabled { opacity: 0.5; cursor: not-allowed; }

.coast-chat__meta {
    font-size: 12px;
    color: var(--coast-chat-muted);
    padding: 4px 16px 8px;
    text-align: right;
}

.coast-chat__typing {
    align-self: flex-start;
    color: var(--coast-chat-muted);
    font-size: 12px;
    font-style: italic;
}

@media (max-width: 600px) {
    .coast-chat__panel {
        height: min(80vh, calc(100vh - 32px));
    }
}
