.alice-ai-widget,
.alice-ai-widget * {
    box-sizing: border-box;
}

.alice-ai-widget {
    --alice-primary: #087dff;
    --alice-accent: #00e5ff;
    --alice-surface: #07102d;
    --alice-panel: #101b3d;
    --alice-text: #f7fbff;
    --alice-muted: #aab7d6;
    --alice-border: rgba(110, 172, 255, .22);
    --alice-shadow: 0 24px 70px rgba(0, 0, 0, .36);
    width: 100%;
    color: var(--alice-text);
    font-family: Inter, Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

.alice-ai-panel {
    width: 100%;
    height: var(--alice-height, 640px);
    min-height: 420px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 95% 0%, rgba(0, 229, 255, .12), transparent 34%),
        linear-gradient(155deg, var(--alice-surface), var(--alice-panel));
    border: 1px solid var(--alice-border);
    border-radius: 24px;
    box-shadow: var(--alice-shadow);
}

.alice-ai-panel[hidden] {
    display: none !important;
}

.alice-ai-header {
    min-height: 84px;
    padding: 13px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: rgba(4, 12, 42, .74);
    border-bottom: 1px solid var(--alice-border);
    backdrop-filter: blur(16px);
}

.alice-ai-identity {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alice-ai-avatar-wrap {
    position: relative;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, .2), rgba(8, 125, 255, .08));
    box-shadow: 0 0 28px rgba(0, 174, 255, .26);
}

.alice-ai-avatar {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transform: scale(1.6);
}

.alice-ai-status-dot {
    position: absolute;
    right: 0;
    bottom: 4px;
    width: 12px;
    height: 12px;
    border: 2px solid #07102d;
    border-radius: 50%;
    background: #35ef96;
    box-shadow: 0 0 12px rgba(53, 239, 150, .8);
}

.alice-ai-header h3 {
    margin: 0;
    color: var(--alice-text);
    font-size: 20px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -.02em;
}

.alice-ai-header p {
    margin: 4px 0 0;
    color: var(--alice-muted);
    font-size: 12px;
    line-height: 1.25;
}

.alice-ai-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.alice-ai-header-actions button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    padding: 0;
    color: var(--alice-text);
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 11px;
    cursor: pointer;
    transition: .2s ease;
}

.alice-ai-header-actions button:hover,
.alice-ai-header-actions button:focus-visible {
    background: rgba(8, 125, 255, .24);
    border-color: rgba(0, 229, 255, .35);
    outline: none;
}

.alice-ai-header-actions svg,
.alice-ai-send svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.alice-ai-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 22px 20px 14px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 229, 255, .3) transparent;
}

.alice-ai-message {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    margin: 0 0 16px;
    animation: aliceMessageIn .24s ease both;
}

.alice-ai-message > img {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    object-fit: contain;
    transform: scale(1.55);
}

.alice-ai-message-user {
    justify-content: flex-end;
}

.alice-ai-bubble {
    max-width: min(82%, 720px);
    padding: 12px 15px;
    color: #edf5ff;
    font-size: 14px;
    line-height: 1.62;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 7px 18px 18px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    overflow-wrap: anywhere;
}

.alice-ai-message-user .alice-ai-bubble {
    color: #fff;
    background: linear-gradient(135deg, var(--alice-primary), #1457d5);
    border-color: rgba(255, 255, 255, .12);
    border-radius: 18px 7px 18px 18px;
}

.alice-ai-bubble p {
    margin: 0 0 9px;
}

.alice-ai-bubble p:last-child {
    margin-bottom: 0;
}

.alice-ai-bubble ul,
.alice-ai-bubble ol {
    margin: 8px 0 8px 20px;
    padding: 0;
}

.alice-ai-sources {
    max-width: min(82%, 720px);
    margin: -7px 0 18px 43px;
    padding: 9px 12px;
    color: var(--alice-muted);
    font-size: 11px;
    background: rgba(0, 229, 255, .055);
    border: 1px solid rgba(0, 229, 255, .16);
    border-radius: 10px;
}

.alice-ai-sources strong {
    color: var(--alice-accent);
}

.alice-ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 3px 0 18px 43px;
}

.alice-ai-suggestions button {
    padding: 8px 11px;
    color: #dfeaff;
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
    background: rgba(8, 125, 255, .11);
    border: 1px solid rgba(61, 156, 255, .28);
    border-radius: 999px;
    cursor: pointer;
    transition: .2s ease;
}

.alice-ai-suggestions button:hover,
.alice-ai-suggestions button:focus-visible {
    color: #fff;
    background: rgba(8, 125, 255, .24);
    border-color: var(--alice-accent);
    outline: none;
}

.alice-ai-typing .alice-ai-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 45px;
}

.alice-ai-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--alice-accent);
    animation: aliceTyping 1.05s infinite ease-in-out;
}

.alice-ai-typing-dot:nth-child(2) { animation-delay: .14s; }
.alice-ai-typing-dot:nth-child(3) { animation-delay: .28s; }

.alice-ai-disclaimer {
    padding: 8px 18px;
    color: #8d9bbb;
    font-size: 10px;
    line-height: 1.35;
    text-align: center;
    background: rgba(1, 7, 26, .44);
    border-top: 1px solid rgba(255, 255, 255, .05);
}

.alice-ai-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(3, 10, 33, .86);
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.alice-ai-form textarea {
    flex: 1;
    width: 100%;
    min-height: 48px;
    max-height: 130px;
    resize: none;
    margin: 0;
    padding: 12px 14px;
    color: var(--alice-text);
    caret-color: var(--alice-accent);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
    background: rgba(255, 255, 255, .075);
    border: 1px solid rgba(255, 255, 255, .11);
    border-radius: 15px;
    box-shadow: none;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.alice-ai-form textarea::placeholder {
    color: #8794b4;
}

.alice-ai-form textarea:focus {
    border-color: rgba(0, 229, 255, .55);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, .08);
}

.alice-ai-send {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #fff;
    background: linear-gradient(135deg, var(--alice-accent), var(--alice-primary));
    border: 0;
    border-radius: 15px;
    box-shadow: 0 10px 22px rgba(8, 125, 255, .3);
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease;
}

.alice-ai-send:hover,
.alice-ai-send:focus-visible {
    filter: brightness(1.08);
    transform: translateY(-1px);
    outline: none;
}

.alice-ai-send:disabled,
.alice-ai-form textarea:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.alice-ai-footer {
    padding: 6px 12px 8px;
    color: #667495;
    font-size: 9px;
    letter-spacing: .05em;
    text-align: center;
    text-transform: uppercase;
    background: rgba(3, 10, 33, .86);
}

.alice-ai-mode-floating {
    position: fixed;
    z-index: 99998;
    right: 22px;
    bottom: 22px;
    width: auto;
}

.alice-ai-mode-floating.alice-ai-position-left {
    right: auto;
    left: 22px;
}

.alice-ai-mode-floating .alice-ai-panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: min(410px, calc(100vw - 28px));
    height: min(var(--alice-height, 640px), calc(100vh - 112px));
    transform-origin: bottom right;
    animation: alicePanelIn .2s ease both;
}

.alice-ai-mode-floating.alice-ai-position-left .alice-ai-panel {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.alice-ai-launcher {
    min-width: 168px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 19px 4px 7px;
    color: #fff;
    font: inherit;
    font-weight: 700;
    background: linear-gradient(135deg, #062663, #087dff);
    border: 1px solid rgba(0, 229, 255, .42);
    border-radius: 999px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .34), 0 0 30px rgba(8, 125, 255, .2);
    cursor: pointer;
    transition: transform .2s ease, filter .2s ease;
}

.alice-ai-launcher:hover,
.alice-ai-launcher:focus-visible {
    filter: brightness(1.08);
    transform: translateY(-2px);
    outline: none;
}

.alice-ai-launcher img {
    width: 51px;
    height: 51px;
    object-fit: contain;
    transform: scale(1.58);
}

.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

@keyframes aliceMessageIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes alicePanelIn {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes aliceTyping {
    0%, 60%, 100% { opacity: .35; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

@media (max-width: 560px) {
    .alice-ai-panel {
        border-radius: 18px;
    }

    .alice-ai-header {
        min-height: 76px;
        padding: 10px 12px;
    }

    .alice-ai-avatar-wrap {
        flex-basis: 50px;
        width: 50px;
        height: 50px;
    }

    .alice-ai-header h3 {
        font-size: 17px;
    }

    .alice-ai-header p {
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .alice-ai-messages {
        padding: 17px 12px 10px;
    }

    .alice-ai-bubble {
        max-width: 88%;
    }

    .alice-ai-suggestions,
    .alice-ai-sources {
        margin-left: 0;
    }

    .alice-ai-mode-floating,
    .alice-ai-mode-floating.alice-ai-position-left {
        right: 14px;
        left: 14px;
        bottom: 14px;
    }

    .alice-ai-mode-floating .alice-ai-panel,
    .alice-ai-mode-floating.alice-ai-position-left .alice-ai-panel {
        position: fixed;
        inset: 10px;
        width: auto;
        height: auto;
        max-height: none;
        border-radius: 18px;
    }

    .alice-ai-launcher {
        margin-left: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .alice-ai-widget *,
    .alice-ai-widget *::before,
    .alice-ai-widget *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
