/* ═══════════════════════════════════════════════════════════
   maschl.marketing — KI Concierge Widget Styles
   Warm light panel · Brand orange/teal accents
   ═══════════════════════════════════════════════════════════ */

/* ── trigger button ── */
.mw-trigger {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.2rem;
    border: 0;
    border-radius: 999px;
    background: var(--navy);
    color: var(--white);
    font-family: inherit;
    font-size: 0.93rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(17, 24, 39, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
}

.mw-trigger[aria-expanded="true"] {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.86);
}

.mw-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(17, 24, 39, 0.36);
}

.mw-trigger-pulse {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    position: relative;
    flex-shrink: 0;
}

.mw-trigger-pulse::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(34, 197, 94, 0.4);
    animation: mw-pulse 1.8s ease-out infinite;
}

@keyframes mw-pulse {
    0%   { transform: scale(0.7); opacity: 0.9; }
    100% { transform: scale(1.9); opacity: 0; }
}

.mw-trigger-icon {
    flex-shrink: 0;
    opacity: 0.9;
}

.mw-trigger-text {
    display: grid;
    gap: 0.1rem;
    text-align: left;
}

.mw-trigger-text strong {
    display: block;
    font-size: 0.93rem;
    font-weight: 700;
}

.mw-trigger-text small {
    display: block;
    font-size: 0.77rem;
    color: rgba(255, 255, 255, 0.62);
    font-weight: 400;
}

/* ── panel ── */
.mw-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.5rem;
    z-index: 1000;
    width: min(370px, calc(100vw - 2rem));
    border-radius: 26px;
    border: 1px solid rgba(23, 32, 51, 0.1);
    background: rgba(255, 250, 242, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 32px 70px rgba(17, 24, 39, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(520px, calc(100svh - 8rem));
    transform: translateY(14px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
                opacity 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
                bottom 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mw-trigger[aria-expanded="true"] + .mw-panel {
    bottom: 1.5rem;
    max-height: min(620px, calc(100svh - 3rem));
}

.mw-panel.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* ── header ── */
.mw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(23, 32, 51, 0.08);
    background: rgba(17, 24, 39, 0.03);
    flex-shrink: 0;
}

.mw-header-info {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.mw-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--navy);
    color: var(--white);
    flex-shrink: 0;
}

.mw-agent-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--ink);
}

.mw-agent-status {
    font-size: 0.76rem;
    color: #16a34a;
    font-weight: 500;
}

.mw-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 0;
    background: rgba(17, 24, 39, 0.06);
    color: var(--ink-muted);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.mw-close:hover {
    background: rgba(17, 24, 39, 0.12);
    color: var(--ink);
}

/* ── consent ── */
.mw-consent {
    padding: 0.9rem;
    border-bottom: 1px solid rgba(23, 32, 51, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overflow-y: auto;
    flex: 0 1 auto;
    min-height: 0;
}

.mw-consent.hidden {
    display: none;
}

.mw-consent-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
}

.mw-consent-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.65rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(23, 32, 51, 0.08);
    background: rgba(255, 255, 255, 0.55);
    font-size: 0.8rem;
    color: var(--ink-soft);
    line-height: 1.5;
}

.mw-consent-block strong {
    color: var(--ink);
    font-size: 0.82rem;
}

.mw-consent-block--warn {
    border-color: rgba(215, 101, 59, 0.22);
    background: rgba(215, 101, 59, 0.06);
}

.mw-consent-block--warn strong {
    color: var(--brand-dark);
}

.mw-consent-block a,
.mw-bubble a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.mw-consent-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.mw-consent-row input[type="checkbox"] {
    margin-top: 2px;
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    flex-shrink: 0;
}

.mw-consent-row label {
    font-size: 0.79rem;
    color: var(--ink-soft);
    line-height: 1.5;
    cursor: pointer;
}

.mw-consent-btn {
    padding: 0.7rem 0.9rem;
    border: none;
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.08);
    color: var(--ink-muted);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    opacity: 0.5;
}

.mw-consent-btn.active {
    background: var(--accent);
    color: var(--white);
    opacity: 1;
}

.mw-consent-btn.active:hover {
    background: var(--navy);
    transform: translateY(-1px);
}

/* ── messages ── */
.mw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    scroll-behavior: smooth;
    min-height: 0;
}

.mw-messages::-webkit-scrollbar { width: 3px; }
.mw-messages::-webkit-scrollbar-track { background: transparent; }
.mw-messages::-webkit-scrollbar-thumb {
    background: rgba(23, 32, 51, 0.15);
    border-radius: 2px;
}

.mw-msg { display: flex; }
.mw-msg--user { justify-content: flex-end; }
.mw-msg--bot  { justify-content: flex-start; }

.mw-bubble {
    max-width: 88%;
    padding: 0.7rem 0.9rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.55;
    word-wrap: break-word;
}

.mw-msg--user .mw-bubble {
    background: var(--brand);
    color: var(--white);
    border-bottom-right-radius: 6px;
}

.mw-msg--bot .mw-bubble {
    background: rgba(17, 24, 39, 0.06);
    color: var(--ink);
    border-bottom-left-radius: 6px;
}

.mw-bubble code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.82em;
    background: rgba(17, 24, 39, 0.08);
    padding: 2px 6px;
    border-radius: 6px;
}

.mw-bubble ul {
    margin: 8px 0 0 18px;
}

.mw-bubble strong { font-weight: 700; }
.mw-bubble em    { font-style: italic; }

/* ── typing indicator ── */
.mw-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0.7rem 0.9rem;
    width: fit-content;
    background: rgba(17, 24, 39, 0.06);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
}

.mw-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ink-muted);
    animation: mw-typing 1.1s ease-in-out infinite;
}

.mw-typing span:nth-child(2) { animation-delay: 0.15s; }
.mw-typing span:nth-child(3) { animation-delay: 0.30s; }

@keyframes mw-typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50%       { opacity: 1;   transform: translateY(-3px); }
}

/* ── input area ── */
.mw-input-area {
    border-top: 1px solid rgba(23, 32, 51, 0.08);
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.mw-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mw-text-input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(23, 32, 51, 0.12);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mw-text-input::placeholder { color: var(--ink-muted); }

.mw-text-input:focus {
    outline: none;
    border-color: rgba(13, 118, 104, 0.35);
    box-shadow: 0 0 0 3px rgba(13, 118, 104, 0.1);
}

.mw-mic-btn,
.mw-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(23, 32, 51, 0.1);
    background: rgba(255, 255, 255, 0.7);
    color: var(--ink-soft);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.mw-send-btn {
    background: var(--accent);
    border-color: transparent;
    color: var(--white);
}

.mw-mic-btn:hover  { background: rgba(17, 24, 39, 0.08); color: var(--ink); }
.mw-send-btn:hover { background: var(--navy); transform: translateY(-1px); }

.mw-mic-btn.recording {
    color: var(--brand);
    border-color: rgba(215, 101, 59, 0.3);
    box-shadow: 0 0 0 5px rgba(215, 101, 59, 0.08);
}

.mw-mic-btn:disabled,
.mw-send-btn:disabled,
.mw-text-input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.mw-rec-hint {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: var(--brand-dark);
    font-weight: 500;
}

.mw-rec-hint.active { display: block; }

/* ── mobile ── */
@media (max-width: 480px) {
    .mw-panel {
        width: calc(100vw - 1.2rem);
        right: 0.6rem;
        bottom: 5rem;
        border-radius: 20px;
        max-height: calc(100svh - 7rem);
    }

    .mw-trigger {
        right: 0.6rem;
        bottom: 0.6rem;
        padding: 0.75rem 1rem;
        font-size: 0.88rem;
    }
}
