/* Variables */
:root {
    --ekinetic-white: #ffffff;
    --ekinetic-ink: #161616;
    --ekinetic-muted: #6f7378;
    --ekinetic-soft: #f4f5f6;
    --ekinetic-soft-2: #ebedf0;
    --ekinetic-line: #e7e9ec;
    --ekinetic-red: #d71920;
    --ekinetic-red-dark: #af1117;
    --ekinetic-green: #21b56b;
    --ekinetic-shadow: 0 24px 70px rgba(13, 18, 28, 0.16);
    --ekinetic-shadow-soft: 0 18px 48px rgba(13, 18, 28, 0.12);
    --ekinetic-radius-lg: 28px;
    --ekinetic-radius-md: 18px;
    --ekinetic-radius-sm: 12px;
    --ekinetic-font: Inter, Poppins, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ekinetic-chat-widget,
.ekinetic-chat-widget * {
    box-sizing: border-box;
}

.ekinetic-chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: var(--ekinetic-font);
    color: var(--ekinetic-ink);
}

.ekinetic-chat-widget [hidden] {
    display: none !important;
}

/* Launcher */
.ekinetic-chat-toggle {
    width: 380px;
    min-height: 168px;
    padding: 26px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
    border: 1px solid rgba(22, 22, 22, 0.06);
    border-radius: var(--ekinetic-radius-lg);
    background: var(--ekinetic-white);
    box-shadow: var(--ekinetic-shadow-soft);
    color: var(--ekinetic-ink);
    cursor: pointer;
    text-align: left;
    font: inherit;
    animation: ekinetic-launcher-in 280ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ekinetic-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 24px 60px rgba(13, 18, 28, 0.15);
}

.ekinetic-chat-toggle:focus-visible {
    outline: 3px solid rgba(215, 25, 32, 0.22);
    outline-offset: 4px;
}

.ekinetic-launcher-top {
    display: flex;
    align-items: center;
    gap: 18px;
}

.ekinetic-launcher-mark {
    position: relative;
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 76px;
}

.ekinetic-chat-bot-logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    border-radius: 18px;
    filter: drop-shadow(0 10px 18px rgba(215, 25, 32, 0.18));
}

.ekinetic-chat-logo {
    width: 74px;
    height: 74px;
    object-fit: contain;
    flex: 0 0 auto;
}

.ekinetic-launcher-brand {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.ekinetic-launcher-brand-name {
    color: var(--ekinetic-ink);
    font-size: 23px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0;
}

.ekinetic-launcher-brand-subtitle {
    color: #34383d;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.ekinetic-launcher-divider {
    width: 62px;
    height: 4px;
    display: block;
    border-radius: 999px;
    background: var(--ekinetic-red);
}

.ekinetic-launcher-cta {
    display: block;
    color: var(--ekinetic-red);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
}

/* Chat Window */
.ekinetic-chat-window {
    width: 380px;
    height: min(720px, calc(100vh - 48px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(22, 22, 22, 0.07);
    border-radius: var(--ekinetic-radius-lg);
    background: var(--ekinetic-white);
    box-shadow: var(--ekinetic-shadow);
    animation: ekinetic-window-in 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.ekinetic-chat-widget.is-open .ekinetic-chat-window {
    display: flex;
}

/* Header */
.ekinetic-chat-header {
    flex: 0 0 auto;
    min-height: 112px;
    padding: 18px 18px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 7px solid var(--ekinetic-red);
    border-bottom: 1px solid var(--ekinetic-line);
    background: var(--ekinetic-white);
}

.ekinetic-chat-header-left {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 13px;
}

.ekinetic-chat-header-mark {
    position: relative;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 60px;
}

.ekinetic-chat-header-bot-icon {
    width: 58px;
    height: 58px;
    object-fit: contain;
    border-radius: 16px;
    filter: drop-shadow(0 8px 14px rgba(215, 25, 32, 0.16));
}

.ekinetic-chat-header-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    flex: 0 0 auto;
}

.ekinetic-chat-header-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ekinetic-chat-title {
    color: var(--ekinetic-ink);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: 0;
}

.ekinetic-chat-subtitle {
    color: #3f444a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.ekinetic-chat-status {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ekinetic-muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.ekinetic-chat-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--ekinetic-green);
    box-shadow: 0 0 0 4px rgba(33, 181, 107, 0.12);
}

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

.ekinetic-chat-header-action {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: var(--ekinetic-soft);
    color: var(--ekinetic-ink);
    cursor: pointer;
    font: inherit;
    transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.ekinetic-chat-header-action:hover {
    background: var(--ekinetic-white);
    border-color: var(--ekinetic-line);
    transform: translateY(-1px);
}

.ekinetic-chat-header-action:focus-visible {
    outline: 3px solid rgba(215, 25, 32, 0.2);
    outline-offset: 2px;
}

.ekinetic-chat-menu::before {
    content: "...";
    margin-top: -8px;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 1px;
}

.ekinetic-chat-toggle-collapse::before {
    content: "";
    width: 15px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.ekinetic-chat-welcome {
    display: none;
}

/* Quick Actions */
.ekinetic-chat-quick-actions {
    flex: 0 0 auto;
    max-height: 196px;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    border-top: 1px solid var(--ekinetic-line);
    background: var(--ekinetic-white);
    scrollbar-color: rgba(215, 25, 32, 0.58) rgba(215, 25, 32, 0.08);
    scrollbar-width: thin;
}

.ekinetic-chat-quick-actions::-webkit-scrollbar {
    width: 8px;
}

.ekinetic-chat-quick-actions::-webkit-scrollbar-track {
    background: rgba(215, 25, 32, 0.08);
}

.ekinetic-chat-quick-actions::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(215, 25, 32, 0.62);
    background-clip: content-box;
}

.ekinetic-chat-quick-actions::-webkit-scrollbar-thumb:hover {
    background: rgba(175, 17, 23, 0.78);
    background-clip: content-box;
}

.ekinetic-quick-btn {
    min-height: 48px;
    padding: 11px 12px;
    border: 1px solid rgba(215, 25, 32, 0.16);
    border-radius: var(--ekinetic-radius-sm);
    background: #fff7f7;
    color: var(--ekinetic-red);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.ekinetic-quick-btn:hover,
.ekinetic-quick-btn:focus-visible {
    border-color: var(--ekinetic-red);
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
    transform: translateY(-1px);
}

.ekinetic-quick-btn:focus-visible {
    outline: 3px solid rgba(215, 25, 32, 0.2);
    outline-offset: 2px;
}

.ekinetic-quick-btn.is-selected {
    border-color: var(--ekinetic-red);
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
    box-shadow: 0 10px 22px rgba(215, 25, 32, 0.18);
}

.ekinetic-quick-btn-continue {
    grid-column: 1 / -1;
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
}

.ekinetic-dropdown-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.ekinetic-dropdown-select {
    width: 100%;
    min-height: 46px;
    padding: 0 12px;
    border: 1px solid rgba(215, 25, 32, 0.18);
    border-radius: var(--ekinetic-radius-sm);
    background: var(--ekinetic-white);
    color: #1f2328;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
}

.ekinetic-dropdown-select:focus {
    border-color: var(--ekinetic-red);
    outline: 3px solid rgba(215, 25, 32, 0.16);
    outline-offset: 2px;
}

.ekinetic-dropdown-submit {
    grid-column: 1 / -1;
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
}

.ekinetic-quick-btn:disabled {
    cursor: default;
    border-color: var(--ekinetic-line);
    background: var(--ekinetic-soft);
    color: #9aa0a6;
    transform: none;
}

/* Messages */
.ekinetic-chat-body {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    padding: 20px 18px 28px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    scrollbar-color: rgba(215, 25, 32, 0.58) rgba(215, 25, 32, 0.08);
    scrollbar-width: thin;
}

.ekinetic-chat-body::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: url("../images/logo-ekinetic.png");
    background-repeat: no-repeat;
    background-position: center 46%;
    background-size: 86% auto;
    opacity: 0.1;
}

.ekinetic-chat-body > * {
    position: relative;
    z-index: 1;
}

.ekinetic-chat-body::-webkit-scrollbar {
    width: 8px;
}

.ekinetic-chat-body::-webkit-scrollbar-track {
    background: rgba(215, 25, 32, 0.08);
}

.ekinetic-chat-body::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;
    background: rgba(215, 25, 32, 0.62);
    background-clip: content-box;
}

.ekinetic-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(175, 17, 23, 0.78);
    background-clip: content-box;
}

.ekinetic-chat-message {
    position: relative;
    width: fit-content;
    max-width: 82%;
    padding: 13px 15px;
    border-radius: 17px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
    animation: ekinetic-message-in 180ms ease-out both;
}

.ekinetic-chat-message-row {
    width: fit-content;
    max-width: 92%;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    align-self: flex-start;
    animation: ekinetic-message-in 180ms ease-out both;
}

.ekinetic-chat-message-row .ekinetic-chat-message {
    max-width: 100%;
    animation: none;
}

.ekinetic-chat-message-avatar {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    object-fit: contain;
    border-radius: 10px;
    background: var(--ekinetic-white);
    box-shadow: 0 7px 15px rgba(13, 18, 28, 0.12);
}

.ekinetic-chat-message-bot {
    align-self: flex-start;
    color: var(--ekinetic-ink);
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(215, 25, 32, 0.1);
    border-bottom-left-radius: 6px;
    box-shadow: inset 3px 0 0 rgba(215, 25, 32, 0.18), 0 10px 22px rgba(13, 18, 28, 0.04);
}

.ekinetic-chat-message-user {
    align-self: flex-end;
    color: var(--ekinetic-white);
    background: rgba(215, 25, 32, 0.94);
    border-bottom-right-radius: 6px;
    box-shadow: 0 12px 26px rgba(215, 25, 32, 0.18);
}

.ekinetic-chat-message-system {
    align-self: center;
    max-width: 92%;
    padding: 10px 13px;
    border: 1px solid rgba(215, 25, 32, 0.1);
    background: rgba(255, 255, 255, 0.62);
    color: var(--ekinetic-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 8px 18px rgba(13, 18, 28, 0.035);
}

.ekinetic-chat-final-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    animation: ekinetic-message-in 180ms ease-out both;
}

.ekinetic-final-btn {
    min-height: 46px;
    padding: 11px 12px;
    border: 1px solid rgba(215, 25, 32, 0.22);
    border-radius: var(--ekinetic-radius-sm);
    background: #fff7f7;
    color: var(--ekinetic-red);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.ekinetic-final-btn-primary {
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
    box-shadow: 0 12px 26px rgba(215, 25, 32, 0.18);
}

.ekinetic-final-btn:hover,
.ekinetic-final-btn:focus-visible {
    border-color: var(--ekinetic-red);
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
    transform: translateY(-1px);
}

.ekinetic-final-btn:focus-visible {
    outline: 3px solid rgba(215, 25, 32, 0.2);
    outline-offset: 2px;
}

/* Form */
.ekinetic-chat-form {
    flex: 0 0 auto;
    padding: 15px 16px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--ekinetic-line);
    background: var(--ekinetic-white);
}

.ekinetic-chat-input {
    width: 100%;
    height: 52px;
    min-width: 0;
    padding: 0 17px;
    border: 1px solid var(--ekinetic-line);
    border-radius: 999px;
    background: var(--ekinetic-soft);
    color: var(--ekinetic-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.ekinetic-chat-input::placeholder {
    color: #90959b;
    font-weight: 600;
}

.ekinetic-chat-input:focus {
    border-color: rgba(215, 25, 32, 0.45);
    background: var(--ekinetic-white);
    box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.1);
}

.ekinetic-chat-message a {
    color: inherit;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ekinetic-chat-submit {
    width: 52px;
    height: 52px;
    min-width: 52px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: var(--ekinetic-red);
    color: var(--ekinetic-white);
    cursor: pointer;
    font: inherit;
    box-shadow: 0 13px 25px rgba(215, 25, 32, 0.22);
    transition: background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.ekinetic-chat-submit:hover {
    background: var(--ekinetic-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(215, 25, 32, 0.26);
}

.ekinetic-chat-submit:focus-visible {
    outline: 3px solid rgba(215, 25, 32, 0.22);
    outline-offset: 3px;
}

.ekinetic-chat-submit:disabled {
    cursor: default;
    background: #c3c7cc;
    box-shadow: none;
    transform: none;
}

.ekinetic-send-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
}

.ekinetic-photo-upload {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.ekinetic-photo-upload-note,
.ekinetic-photo-status {
    margin: 0;
    color: #3f444a;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.ekinetic-photo-input {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(215, 25, 32, 0.2);
    border-radius: 8px;
    background: #fff;
    color: #252a31;
    font-size: 12px;
}

.ekinetic-photo-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ekinetic-photo-list li {
    padding: 8px 10px;
    border-radius: 8px;
    background: #f6f7f8;
    color: #252a31;
    font-size: 12px;
    font-weight: 700;
}

.ekinetic-photo-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ekinetic-photo-actions .ekinetic-photo-upload-btn {
    grid-column: 1 / -1;
}

/* Footer */
.ekinetic-chat-footer {
    flex: 0 0 auto;
    padding: 0 16px 16px;
    background: var(--ekinetic-white);
    color: #9aa0a6;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
}

/* Responsive */
@media (max-width: 520px) {
    .ekinetic-chat-widget {
        right: 12px;
        bottom: 12px;
    }

    .ekinetic-chat-widget.is-open {
        left: 12px;
    }

    .ekinetic-chat-window {
        width: 100%;
    }

    .ekinetic-chat-window {
        height: min(720px, calc(100vh - 24px));
        border-radius: 22px;
    }

    .ekinetic-chat-toggle {
        width: 76px;
        min-height: 76px;
        height: 76px;
        padding: 8px;
        align-items: center;
        justify-content: center;
        gap: 0;
        border-radius: 50%;
        text-align: center;
    }

    .ekinetic-chat-toggle:hover {
        transform: translateY(-2px);
    }

    .ekinetic-launcher-mark {
        width: 60px;
        height: 60px;
        flex-basis: 60px;
    }

    .ekinetic-chat-bot-logo {
        width: 58px;
        height: 58px;
        border-radius: 16px;
    }

    .ekinetic-launcher-brand,
    .ekinetic-launcher-divider,
    .ekinetic-launcher-cta {
        display: none;
    }

    .ekinetic-launcher-top {
        gap: 0;
    }

    .ekinetic-launcher-brand-name {
        font-size: 21px;
    }

    .ekinetic-chat-header {
        min-height: 102px;
        padding: 16px 14px 14px;
    }

    .ekinetic-chat-header-logo {
        width: 52px;
        height: 52px;
    }

    .ekinetic-chat-header-mark {
        width: 52px;
        height: 52px;
        flex-basis: 52px;
    }

    .ekinetic-chat-header-bot-icon {
        width: 50px;
        height: 50px;
    }

    .ekinetic-chat-message-avatar {
        width: 28px;
        height: 28px;
        flex-basis: 28px;
    }

    .ekinetic-chat-header-action {
        width: 34px;
        height: 34px;
    }

    .ekinetic-chat-quick-actions {
        padding: 14px;
        gap: 8px;
    }

    .ekinetic-quick-btn {
        min-height: 46px;
        padding: 10px;
        font-size: 11px;
    }

    .ekinetic-chat-body {
        padding: 18px 14px 20px;
    }

    .ekinetic-chat-form {
        padding: 13px 14px 10px;
    }

    .ekinetic-chat-footer {
        padding: 0 14px 14px;
    }
}

@media (max-width: 360px) {
    .ekinetic-chat-quick-actions,
    .ekinetic-chat-final-actions {
        grid-template-columns: 1fr;
    }

    .ekinetic-launcher-top {
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ekinetic-chat-toggle,
    .ekinetic-chat-window,
    .ekinetic-chat-message,
    .ekinetic-chat-message-row {
        animation: none;
    }

    .ekinetic-chat-body {
        scroll-behavior: auto;
    }

    .ekinetic-chat-toggle,
    .ekinetic-chat-header-action,
    .ekinetic-quick-btn,
    .ekinetic-final-btn,
    .ekinetic-chat-input,
    .ekinetic-chat-submit {
        transition: none;
    }
}

@keyframes ekinetic-launcher-in {
    from {
        transform: translateY(12px) scale(0.98);
    }
    to {
        transform: translateY(0) scale(1);
    }
}

@keyframes ekinetic-window-in {
    from {
        transform: translateY(18px) scale(0.98);
    }
    to {
        transform: translateY(0) scale(1);
    }
}

@keyframes ekinetic-message-in {
    from {
        transform: translateY(6px);
    }
    to {
        transform: translateY(0);
    }
}
