:root {
    --ssci-chat-primary: #fe5716;
    --ssci-chat-primary-strong: #e24b10;
    --ssci-chat-primary-soft: #fff0ea;
    --ssci-chat-accent: #ff8a4c;
    --ssci-chat-ink: #1c1917;
    --ssci-chat-muted: #6b5b4f;
    --ssci-chat-line: rgba(254, 87, 22, 0.14);
    --ssci-chat-surface: rgba(255, 250, 245, 0.96);
    --ssci-chat-surface-strong: #fffdf9;
    --ssci-chat-shadow: 0 28px 70px rgba(226, 75, 16, 0.22);
    --ssci-chat-radius: 24px;
    --ssci-chat-width: min(80vw, 1040px);
    --ssci-chat-height: min(82vh, 820px);
    --ssci-chat-z: 99999;
}

.ssci-chatbot-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: var(--ssci-chat-z);
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.ssci-chat-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px 10px 10px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    background: linear-gradient(135deg, #fe5716, #e24b10);
    box-shadow: 0 18px 44px rgba(254, 87, 22, 0.34);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ssci-chat-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 54px rgba(254, 87, 22, 0.42);
}

.ssci-chat-toggle-ring {
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.25);
    opacity: 0.65;
    animation: ssci-chat-pulse 2.6s infinite;
}

.ssci-chat-toggle-core {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
}

.ssci-chat-toggle-core svg,
.ssci-chat-send svg,
.ssci-chat-close svg {
    width: 22px;
    height: 22px;
}

.ssci-chat-toggle-label {
    position: relative;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.ssci-chat-window {
    position: absolute;
    right: 0;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    width: var(--ssci-chat-width);
    height: var(--ssci-chat-height);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.52);
    border-radius: var(--ssci-chat-radius);
    background:
        radial-gradient(circle at top right, rgba(255, 138, 76, 0.2), transparent 32%),
        radial-gradient(circle at top left, rgba(254, 87, 22, 0.18), transparent 36%),
        var(--ssci-chat-surface);
    backdrop-filter: blur(15px);
    box-shadow: var(--ssci-chat-shadow);
    transform-origin: bottom right;
    animation: ssci-chat-enter 0.26s ease;
}

.ssci-chat-window.ssci-hidden {
    display: none;
}

.ssci-chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px 10px;
    background: linear-gradient(135deg, rgba(254, 87, 22, 0.98), rgba(226, 75, 16, 0.97));
    color: #fff;
}

.ssci-chat-header-copy h3,
.ssci-chat-header-copy p,
.ssci-chat-kicker {
    margin: 0;
}

.ssci-chat-kicker {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.82);
}

.ssci-chat-header-copy h3 {
    font-size: 18px;
    line-height: 1.1;
    margin-bottom: 4px;
}

.ssci-chat-header-copy p {
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.ssci-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.ssci-chat-restart {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.ssci-chat-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 12px;
    position: relative;
    background: rgba(0, 0, 0, 0.14);
    color: #fff;
    cursor: pointer;
    flex: 0 0 auto;
}

.ssci-chat-close-fallback {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.ssci-chat-close svg {
    position: relative;
    z-index: 1;
    display: block;
}

.ssci-chat-status-bar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 8px 16px 10px;
    background: rgba(255, 252, 248, 0.84);
    border-bottom: 1px solid var(--ssci-chat-line);
}

.ssci-chat-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border-radius: 999px;
    background: rgba(254, 87, 22, 0.08);
    color: var(--ssci-chat-primary-strong);
    font-size: 11px;
    font-weight: 700;
}

.ssci-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.14);
}

.ssci-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.54), rgba(255, 251, 247, 0.94)),
        linear-gradient(135deg, rgba(254, 87, 22, 0.05), transparent 36%);
}

.ssci-chat-message {
    display: flex;
    margin-bottom: 14px;
}

.ssci-chat-message.is-user {
    justify-content: flex-end;
}

.ssci-chat-bubble {
    max-width: 88%;
    padding: 14px 15px;
    border-radius: 20px;
    box-shadow: 0 12px 24px rgba(226, 75, 16, 0.08);
    font-size: 14px;
    line-height: 1.58;
    color: var(--ssci-chat-ink);
    background: var(--ssci-chat-surface-strong);
    border: 1px solid rgba(254, 87, 22, 0.1);
}

.ssci-chat-message.is-user .ssci-chat-bubble {
    color: #fff;
    background: linear-gradient(135deg, #fe5716, #ff7a3d);
}

.ssci-chat-bubble p {
    margin: 0 0 10px;
}

.ssci-chat-bubble p:last-child {
    margin-bottom: 0;
}

.ssci-chat-compose {
    padding: 12px 14px;
    background: rgba(255, 252, 248, 0.96);
    border-top: 1px solid var(--ssci-chat-line);
}

.ssci-chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ssci-chat-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid rgba(254, 87, 22, 0.16);
    border-radius: 999px;
    background: #fff;
    color: var(--ssci-chat-primary-strong);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.ssci-chat-chip:hover {
    transform: translateY(-1px);
    background: var(--ssci-chat-primary-soft);
    border-color: rgba(254, 87, 22, 0.32);
}

.ssci-chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ssci-chat-input {
    flex: 1;
    min-width: 0;
    height: 50px;
    padding: 0 15px;
    border: 1px solid rgba(254, 87, 22, 0.28);
    border-radius: 16px;
    background: #fff;
    color: var(--ssci-chat-ink);
    font-size: 14px;
}

.ssci-chat-input:focus {
    outline: none;
    border-color: rgba(254, 87, 22, 0.55);
    box-shadow: 0 0 0 4px rgba(254, 87, 22, 0.12);
}

.ssci-chat-send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, #fe5716, #e24b10);
    color: #fff;
    cursor: pointer;
}

.ssci-chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ssci-chat-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(254, 87, 22, 0.65);
    animation: ssci-chat-dot 1.2s infinite ease-in-out;
}

.ssci-chat-typing span:nth-child(2) {
    animation-delay: 0.12s;
}

.ssci-chat-typing span:nth-child(3) {
    animation-delay: 0.24s;
}

.ssci-chat-card-list {
    display: grid;
    gap: 14px;
    margin-top: 12px;
}

.ssci-chat-service-card,
.ssci-chat-summary-card {
    padding: 14px;
    border-radius: 18px;
    background: rgba(254, 87, 22, 0.05);
    border: 1px solid rgba(254, 87, 22, 0.12);
}

.ssci-chat-service-head {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 14px;
    align-items: start;
}

.ssci-chat-service-thumb {
    width: 92px;
    height: 72px;
    overflow: hidden;
    border-radius: 14px;
    background: linear-gradient(135deg, #ff9f72, #fe5716);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ssci-chat-service-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ssci-chat-thumb-fallback {
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.ssci-chat-service-card strong,
.ssci-chat-summary-card strong {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
}

.ssci-chat-meta {
    margin-top: 8px;
    font-size: 12px;
    color: var(--ssci-chat-muted);
}

.ssci-chat-summary-total {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed rgba(254, 87, 22, 0.25);
    font-weight: 700;
    color: var(--ssci-chat-primary-strong);
}

.ssci-chat-inline-code {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(254, 87, 22, 0.12);
    color: #c2410c;
    font-weight: 700;
}

.ssci-chat-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.ssci-chat-action-btn {
    min-width: 128px;
}

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

@keyframes ssci-chat-enter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes ssci-chat-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.65;
    }
    50% {
        transform: scale(1.035);
        opacity: 0.2;
    }
}

@keyframes ssci-chat-dot {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }
    40% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

@media (max-width: 767px) {
    .ssci-chatbot-widget {
        right: 10px;
        bottom: 12px;
    }

    .ssci-chat-toggle-label {
        display: none;
    }

    .ssci-chat-window {
        right: 0;
        width: 95vw;
        height: 60vh;
        bottom: 72px;
        border-radius: 20px;
    }

    .ssci-chat-header {
        padding: 10px 12px 8px;
    }

    .ssci-chat-header-copy h3 {
        font-size: 16px;
    }

    .ssci-chat-header-copy p {
        font-size: 11px;
    }

    .ssci-chat-header-actions {
        gap: 6px;
    }

    .ssci-chat-restart {
        min-width: 68px;
        height: 32px;
        font-size: 11px;
        padding: 0 10px;
    }

    .ssci-chat-status-bar {
        padding: 6px 12px 8px;
    }

    .ssci-chat-status-pill {
        padding: 6px 10px;
        font-size: 10px;
    }

    .ssci-chat-messages {
        padding: 12px;
    }

    .ssci-chat-compose {
        padding: 6px 8px;
    }

    .ssci-chat-chip {
        padding: 7px 9px;
        font-size: 10px;
    }

    .ssci-chat-input {
        height: 42px;
        font-size: 16px;
        padding: 0 12px;
    }

    .ssci-chat-send {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .ssci-chat-service-head {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .ssci-chat-service-thumb {
        width: 100%;
        height: 122px;
    }

    .ssci-chat-action-row {
        gap: 8px;
    }

    .ssci-chat-action-btn {
        min-width: 0;
        flex: 1 1 calc(50% - 4px);
        padding: 8px 10px;
    }

    .ssci-chat-restart,
    .ssci-chat-close {
        height: 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ssci-chat-toggle,
    .ssci-chat-toggle-ring,
    .ssci-chat-window,
    .ssci-chat-chip,
    .ssci-chat-typing span {
        animation: none;
        transition: none;
    }
}
