:root {
    --kts-primary: #111827;
    --kts-secondary: #2563eb;
}

/* =========================
   WRAPPER (FIX OVERFLOW)
========================= */
#kts-chat-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: Inter, sans-serif;

    max-width: calc(100vw - 20px);
}

#kts-chat-widget.right {
    right: 20px;
}

#kts-chat-widget.left {
    left: 20px;
}

/* =========================
   FLOAT BUTTON
========================= */
.kts-chat-button {
    position: relative;
    width: 68px;
    height: 68px;
	padding: 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.18);
    cursor: pointer;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), rgba(255,255,255,0) 40%),
        linear-gradient(135deg, var(--kts-secondary), #2982d7);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 20px 60px rgba(0,0,0,.25),
        inset 0 1px 0 rgba(255,255,255,.2);
    transition: transform .25s ease, box-shadow .25s ease;
}

.kts-chat-button::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #1d6fd6, #4f46e5);
    opacity: 0;
    transition: opacity .35s ease;
    z-index: 0;
}

.kts-chat-button:hover::before {
    opacity: 1;
}
.kts-chat-button:hover {
    box-shadow:
        0 30px 80px rgba(0,0,0,.3),
        0 0 40px rgba(41,130,215,.35);
}
.kts-chat-icon {
    position: relative;
    z-index: 2;
}
.kts-chat-icon svg {
    width: 38px;
    height: 38px;
    color: white;
	fill: white;
}
.kts-chat-glow {
    position: absolute;
    inset: -10px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(41,130,215,.35), transparent 60%);
    filter: blur(12px);
    opacity: .6;
    z-index: 0;
}

.kts-chat-label {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.95);
    color: #2982d7;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    backdrop-filter: blur(10px);
    font-family: Inter, sans-serif;
    pointer-events: none;
    z-index: 2;
}

#kts-chat-widget.right .kts-chat-label {
	right: 75px;
}
#kts-chat-widget.left .kts-chat-label {
	left: 75px;
}

.kts-enter {
    animation: ktsSlideUp .6s cubic-bezier(.2,.9,.2,1) both;
}

@keyframes ktsSlideUp {
    0% {
        transform: translateY(80px) scale(.8);
        opacity: 0;
    }
    60% {
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* =========================
   CHAT WINDOW (FIXED + RESPONSIVE CORE)
========================= */
.kts-chat-window {
    width: clamp(320px, 28vw, 370px);
    height: min(650px, 80vh);

    background: white;
    border-radius: 26px;
    overflow: hidden;

    display: flex;
    flex-direction: column;

    box-shadow: 0 30px 80px rgba(0,0,0,.25);
    animation: show .25s ease;

    will-change: transform, opacity;
}

/* safety positioning */
#kts-chat-widget.right .kts-chat-window {
    transform-origin: bottom right;
}

#kts-chat-widget.left .kts-chat-window {
    transform-origin: bottom left;
}

/* =========================
   HEADER
========================= */
.kts-chat-header {
    background: var(--kts-primary);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 6px;
    border-top-left-radius: 22px;
    border-top-right-radius: 22px;
}

.kts-chat-header h3 {
    font-size: 20px;
    text-transform: capitalize;
    line-height: 1;
    font-weight: 600;
    width: 100%;
	color: #ebebeb;
}

.kts-chat-status {
    font-size: 14px;
    color: #22c55e;
}

.kts-chat-close {
    color: white;
    cursor: pointer;
    font-size: 28px;
    padding: 0 5px;
    line-height: 1;
    background: none;
}

.kts-chat-close:hover,
.kts-chat-close:focus,
.kts-chat-close:active {
    color: var(--kts-secondary);
	background: none;
}

/* =========================
   BODY
========================= */
.kts-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    background: #f3f4f6;
}

/* messages */
.kts-chat-message {
    display: flex;
    margin-bottom: 16px;
}

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

.kts-chat-message.bot {
    align-items: flex-start;
    gap: 12px;
}

.kts-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    object-fit: cover;
    background: #d1d5db;
    flex-shrink: 0;
}

/* bubbles */
.kts-chat-bubble {
    position: relative;
    max-width: 78%;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
	min-height: 37px;
}

.kts-chat-message.bot .kts-chat-bubble {
    background: white;
    color: gray;
}

.kts-chat-message.user .kts-chat-bubble {
    background: var(--kts-secondary);
    color: white;
}

.kts-chat-message.bot .kts-chat-bubble::before {
    content: "";
    position: absolute;
    left: -4px;
    top: 14px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-radius: 2px;
}

/* =========================
   BOT HEADER AREA
========================= */
.kts-bot-wrapper {
    display: flex;
    flex-wrap: wrap;
}

.kts-chat-title {
    display: flex;
    gap: 15px;
    align-items: center;
}

.kts-avatar-wrapper {
    position: relative;
    width: 60px;
    height: 60px;
}

.kts-chat-title .kts-avatar {
    width: 60px;
    height: 60px;
    background: black;
	min-width: 60px;
}

.kts-avatar-wrapper::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    right: 1px;
    bottom: 5px;
    background: #22c55e;
    border: 2px solid var(--kts-primary);
    border-radius: 999px;
}

/* =========================
   FAQ
========================= */
.kts-faq-btn {
    border: none;
    background: white;
    cursor: pointer;
    transition: .2s;
    text-align: left;
    font-weight: bold;
    font-family: Inter, sans-serif;
    line-height: 1;
	border: 2px solid var(--kts-secondary);
	border-radius: 12px;
	text-transform: capitalize;
}
.kts-chat-faq-column .kts-faq-btn {
    display: flex;
    align-items: center;
    gap: 10px;
	width: 100%;
	padding: 14px;
	margin-bottom: 10px;
}
.kts-chat-faq-row {
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 10px;
}
.kts-chat-faq-row .kts-faq-btn {
	box-sizing: border-box;
	flex: 0 0 calc(10% - 5px);
	position: relative;
	padding: 8px 12px;
	color: var(--kts-secondary);
}
.kts-chat-faq-row .kts-faq-btn:hover,
.kts-chat-faq-row .kts-faq-btn:active,
.kts-chat-faq-row .kts-faq-btn:focus {
	color: #fff;
}
.kts-chat-faq-row .kts-faq-icon {
	display: none;
}

.kts-faq-btn:hover, .kts-faq-btn:focus, .kts-faq-btn:active {
	background: var(--kts-secondary);
}

.kts-faq-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: var(--kts-secondary);
    flex-shrink: 0;
}
.kts-faq-icon svg {
    width: 16px;
    height: 16px;
}
.kts-faq-text {
    flex: 1;
}

/*.kts-faq-btn::before {
    content: "➜";
    margin-right: 10px;
    color: var(--kts-secondary);
}
*/
.kts-faq-btn:hover .kts-faq-icon,
.kts-faq-btn:focus .kts-faq-icon,
.kts-faq-btn:active .kts-faq-icon {
    color: white;
}

.kts-faq-btn:hover {
    transform: translateY(-2px);
}

/* =========================
   FOOTER
========================= */
.kts-chat-footer {
    padding: 16px;
    border-top: 1px solid #eee;
    background: white;
}

/* messenger */
.kts-messenger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--kts-secondary);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s ease;
    width: 100%;
    font-size: 16px;
}

.kts-messenger-btn:hover,
.kts-messenger-btn:active,
.kts-messenger-btn:focus {
	color: #e1e1e1;
	background: #4b82fb;
}

.kts-messenger-icon {
    width: 26px;
    height: 26px;
}

/* =========================
   ANIMATIONS
========================= */
.kts-chat-window.closing {
    animation: hide .25s ease forwards;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes show {
    from {
        opacity: 0;
        transform: translateY(20px) scale(.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes hide {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(20px) scale(.95);
    }
}

.kts-typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 10px 14px;
}

.kts-typing span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.2s infinite ease-in-out;
}

.kts-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.kts-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.kts-chat-message {
    display: flex;
    margin-bottom: 16px;

    opacity: 0;
    transform: translateY(10px);
    animation: msgIn .25s ease forwards;
}

@keyframes msgIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================
   LAPTOP FIX (IMPORTANT)
========================= */
@media (max-width: 1366px) {
    .kts-chat-window {
        width: 340px;
        height: min(620px, 82vh);
    }

    #kts-chat-widget.right {
        right: 14px;
        bottom: 14px;
    }

    #kts-chat-widget.left {
        left: 14px;
        bottom: 14px;
    }
}

@media (max-width: 1280px) {
    .kts-chat-window {
        width: 320px;
        height: min(600px, 82vh);
    }

    .kts-chat-button {
        width: 64px;
        height: 64px;
    }
}



/* =========================
   MOBILE
========================= */
@media (max-width: 768px) {

    #kts-chat-widget {
        bottom: 12px;
    }

    #kts-chat-widget.right {
        right: 12px;
    }

    #kts-chat-widget.left {
        left: 12px;
    }

    .kts-chat-window {
        width: calc(100vw - 24px);
        max-width: 420px;
        height: calc(100vh - 120px);
        max-height: 600px;
        border-radius: 18px;
    }
	
	.kts-chat-header {
		border-top-left-radius: 16px;
		border-top-right-radius: 16px;
	}

    .kts-chat-header {
        padding: 14px;
    }

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

    .kts-chat-status {
        font-size: 12px;
    }

    .kts-chat-body {
        padding: 12px;
    }

    .kts-chat-bubble {
        font-size: 13px;
        max-width: 85%;
    }

    .kts-chat-button {
        width: 60px;
        height: 60px;
    }

    .kts-chat-button svg {
        width: 26px;
        height: 26px;
    }

    .kts-avatar {
        width: 32px;
        height: 32px;
    }

    .kts-faq-btn {
        font-size: 14px;
        padding: 12px;
    }

    .kts-chat-footer {
        padding: 12px;
    }

    .kts-messenger-btn {
        font-size: 14px;
        padding: 10px;
    }

    .kts-messenger-icon {
        width: 22px;
        height: 22px;
    }
	
	.kts-chat-label {
        display: none;
    }
}

/* =========================
   SMALL MOBILE
========================= */
@media (max-width: 420px) {

    .kts-chat-window {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        border-radius: 14px;
    }
	
	.kts-chat-header {
		border-top-left-radius: 12px;
		border-top-right-radius: 12px;
	}

    .kts-chat-button {
        width: 56px;
        height: 56px;
    }

    .kts-chat-button svg {
        width: 24px;
        height: 24px;
    }

    .kts-chat-bubble {
        font-size: 12px;
    }
}