/* ===================================
   K3 AI CHATBOT - 2025 DESIGN
   =================================== */

/* Floating Chat Button */
.chat-button {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: 86px;
    height: 80px;
    padding: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
    border: none;
    overflow: visible;
    isolation: isolate;
}

.chat-button:hover {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.03);
}

.chat-button__bubble-shell {
    position: relative;
    width: 100%;
    height: 100%;
    display: block;
}

.chat-button__bubble-shell::before {
    content: "";
    position: absolute;
    inset: 13px 10px 10px 9px;
    border-radius: 999px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 52%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.9));
    box-shadow:
        0 18px 34px rgba(2, 6, 23, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 0 0 1px rgba(148, 163, 184, 0.1);
    pointer-events: none;
    z-index: 0;
}

.chat-button__bubble {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    color: rgba(241, 245, 249, 0.94);
    filter:
        drop-shadow(0 14px 24px rgba(2, 6, 23, 0.24))
        drop-shadow(0 0 18px rgba(15, 23, 42, 0.2));
    pointer-events: none;
    z-index: 1;
}

.chat-button.active {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(10px) scale(0.92);
}

.chat-button__brand {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 38px;
    height: 38px;
    padding: 0.28rem;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, rgba(15, 23, 42, 0.74) 0%, rgba(15, 23, 42, 0.54) 56%, rgba(15, 23, 42, 0.14) 76%, rgba(15, 23, 42, 0) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: none;
}

.chat-button__brand-image {
    width: 100%;
    max-width: 28px;
    height: auto;
    filter:
        drop-shadow(0 0 8px rgba(219, 234, 254, 0.1))
        drop-shadow(0 2px 8px rgba(2, 6, 23, 0.14));
}

/* Notification Badge */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #10b981;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 16px;
    right: 20px;
    width: min(540px, calc(100vw - 24px));
    height: min(760px, calc(100vh - 36px));
    max-height: calc(100vh - 24px);
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 100px rgba(239, 68, 68, 0.1);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chat-window.is-home .chat-messages {
    display: none;
}

.chat-window.is-home .chat-home {
    display: block;
}

.chat-home[hidden] {
    display: none !important;
}

.chat-home {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.chat-home-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.chat-home-eyebrow {
    display: inline-flex;
    align-self: flex-start;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.32);
    background: rgba(59, 130, 246, 0.12);
    color: #dbeafe;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-home-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.05;
    color: #f8fafc;
}

.chat-home-copy {
    margin: -6px 0 0;
    color: rgba(226, 232, 240, 0.76);
    font-size: 14px;
    line-height: 1.5;
}

.chat-home-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.chat-home-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 150px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
        rgba(15, 23, 42, 0.72);
    color: #f8fafc;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease, background-color 0.24s ease;
}

.chat-home-card:hover,
.chat-home-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(248, 113, 113, 0.34);
    box-shadow: 0 14px 28px rgba(2, 6, 23, 0.28);
    outline: none;
}

.chat-home-card--primary {
    border-color: rgba(248, 113, 113, 0.36);
    background:
        linear-gradient(180deg, rgba(248, 113, 113, 0.08), rgba(255, 255, 255, 0)),
        rgba(15, 23, 42, 0.82);
}

.chat-home-card-kicker {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-home-card-title {
    font-size: 18px;
    line-height: 1.15;
}

.chat-home-card-copy {
    color: rgba(226, 232, 240, 0.74);
    font-size: 13px;
    line-height: 1.5;
}

.chat-home-card-meta {
    margin-top: auto;
    color: #93c5fd;
    font-size: 12px;
    font-weight: 600;
}

.chat-home-section-label {
    color: #f8fafc;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.chat-home-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-home-topic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.26);
    background: rgba(59, 130, 246, 0.08);
    color: #dbeafe;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.chat-home-topic:hover,
.chat-home-topic:focus-visible {
    transform: translateY(-1px);
    border-color: rgba(147, 197, 253, 0.44);
    background: rgba(59, 130, 246, 0.14);
    outline: none;
}

.chat-home-notes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.chat-home-notes--single {
    grid-template-columns: 1fr;
}

.chat-home-note {
    padding: 12px 13px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.03);
}

.chat-home-note strong {
    display: block;
    margin-bottom: 4px;
    color: #f8fafc;
    font-size: 13px;
}

.chat-home-note span {
    color: rgba(226, 232, 240, 0.72);
    font-size: 12px;
    line-height: 1.45;
}

.chat-faq-panel {
    gap: 12px;
}

.chat-faq-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-home-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-home-back:hover,
.chat-home-back:focus-visible {
    border-color: rgba(248, 113, 113, 0.34);
    background: rgba(239, 68, 68, 0.1);
    outline: none;
}

.chat-faq-search {
    display: flex;
}

.chat-faq-search-input {
    width: 100%;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.88);
    color: #f8fafc;
    font-size: 14px;
}

.chat-faq-search-input::placeholder {
    color: rgba(226, 232, 240, 0.46);
}

.chat-faq-search-input:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.45);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.chat-faq-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-faq-category {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.04);
    color: #dbeafe;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-faq-category:hover,
.chat-faq-category:focus-visible,
.chat-faq-category.is-active {
    border-color: rgba(96, 165, 250, 0.42);
    background: rgba(59, 130, 246, 0.12);
    color: #ffffff;
    outline: none;
}

.chat-faq-results-meta {
    color: rgba(226, 232, 240, 0.62);
    font-size: 12px;
    font-weight: 600;
}

.chat-faq-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 12px;
    min-height: 320px;
}

.chat-faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-faq-card,
.chat-faq-empty {
    padding: 14px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
        rgba(15, 23, 42, 0.7);
}

.chat-faq-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-faq-card:hover,
.chat-faq-card:focus-visible,
.chat-faq-card.is-active {
    transform: translateY(-1px);
    border-color: rgba(248, 113, 113, 0.34);
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.22);
    outline: none;
}

.chat-faq-card-category {
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-faq-card-title {
    color: #f8fafc;
    font-size: 16px;
    line-height: 1.25;
}

.chat-faq-card-summary,
.chat-faq-empty span {
    color: rgba(226, 232, 240, 0.72);
    font-size: 13px;
    line-height: 1.5;
}

.chat-faq-empty strong,
.chat-faq-detail strong {
    color: #f8fafc;
}

.chat-faq-detail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(248, 113, 113, 0.22);
    background:
        radial-gradient(circle at top right, rgba(239, 68, 68, 0.12), transparent 48%),
        rgba(15, 23, 42, 0.86);
}

.chat-faq-detail--empty {
    justify-content: center;
    align-items: flex-start;
}

.chat-faq-detail-eyebrow {
    color: #93c5fd;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.chat-faq-detail-title {
    margin: 0;
    color: #f8fafc;
    font-size: 22px;
    line-height: 1.1;
}

.chat-faq-detail-answer {
    margin: 0;
    color: rgba(226, 232, 240, 0.82);
    font-size: 14px;
    line-height: 1.6;
}

.chat-faq-detail-actions,
.chat-faq-detail-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-faq-action,
.chat-faq-detail-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.04);
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-faq-action.primary {
    border-color: rgba(248, 113, 113, 0.36);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.94), rgba(249, 115, 22, 0.9));
    color: #ffffff;
}

.chat-faq-action:hover,
.chat-faq-action:focus-visible,
.chat-faq-detail-links a:hover,
.chat-faq-detail-links a:focus-visible {
    border-color: rgba(248, 113, 113, 0.44);
    background: rgba(239, 68, 68, 0.12);
    color: #ffffff;
    outline: none;
}

/* Chat Header */
.chat-header {
    padding: 16px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 20px 20px 0 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chat-avatar {
    width: 58px;
    height: 38px;
    padding: 0 0.45rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
        linear-gradient(135deg, rgba(8, 15, 29, 0.96), rgba(30, 41, 59, 0.88));
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.24);
    overflow: hidden;
}

.chat-avatar__logo {
    width: 100%;
    max-width: 50px;
    height: auto;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.chat-header-status {
    font-size: 12px;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.chat-header-caption {
    margin: 6px 0 0;
    max-width: 320px;
    font-size: 12px;
    line-height: 1.45;
    color: rgba(226, 232, 240, 0.78);
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.chat-mode-toggle,
.chat-close {
    min-height: 34px;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #f8fafc;
}

.chat-mode-toggle {
    width: auto;
    min-width: 78px;
    padding: 0 12px;
    color: #f8fafc;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.chat-mode-toggle:hover,
.chat-mode-toggle:focus-visible {
    background: rgba(59, 130, 246, 0.16);
    border-color: rgba(96, 165, 250, 0.46);
    color: #ffffff;
    transform: translateY(-1px);
    outline: none;
}

.chat-mode-toggle.is-active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(37, 99, 235, 0.18));
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 0 18px rgba(59, 130, 246, 0.14);
}

.chat-close {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
}

.chat-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
    transform: rotate(90deg);
}

.chat-close svg {
    width: 16px;
    height: 16px;
    stroke: rgba(248, 250, 252, 0.94);
}

/* Chat Messages Container */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(239, 68, 68, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* Message Bubbles */
.message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.bot {
    align-items: flex-start;
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #ffffff;
}

.message.bot .message-avatar {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.message-content {
    max-width: 75%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.message.bot .message-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.message-time {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Quick Reply Buttons */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-btn {
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    color: #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
}

.quick-reply-btn.is-primary {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(248, 113, 113, 0.34);
    color: #ffffff;
}

.quick-reply-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.44);
    color: white;
    transform: translateY(-1px);
}

.quick-reply-btn:active {
    transform: translateY(0);
}

/* Chat Input */
.chat-input-container {
    padding: 14px 16px 16px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 0 0 20px 20px;
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(239, 68, 68, 0.5);
    border-radius: 16px;
    padding: 6px;
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2), 0 4px 12px rgba(239, 68, 68, 0.3);
    background: rgba(255, 255, 255, 0.12);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 16px;
    color: white;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.chat-input:focus {
    outline: none;
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.5);
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.6);
}

.chat-send-btn:active {
    transform: translateY(0) scale(0.98);
}

.chat-send-btn svg {
    width: 22px;
    height: 22px;
    fill: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
        max-height: 100vh;
    }

    .chat-button {
        bottom: calc(96px + env(safe-area-inset-bottom));
        right: 16px;
        width: 96px;
        height: 88px;
    }

    .chat-button__bubble-shell::before {
        inset: 17px 12px 11px 10px;
    }

    .chat-button__brand {
        width: 38px;
        height: 38px;
        padding: 0.28rem;
        border-radius: 50%;
    }

    .chat-button__brand-image {
        max-width: 28px;
    }

    .chat-header {
        padding: 1.5rem 1rem;
    }

    .chat-home {
        padding: 1rem;
    }

    .chat-home-grid,
    .chat-home-notes {
        grid-template-columns: 1fr;
    }

    .chat-faq-layout {
        grid-template-columns: 1fr;
    }

    .chat-faq-detail-title {
        font-size: 20px;
    }

    .chat-messages {
        padding: 1rem;
    }

    .message-bubble {
        max-width: 85%;
        font-size: 0.95rem;
    }

    .quick-replies {
        flex-wrap: wrap;
    }

    .quick-reply-btn {
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }

    .chat-input-container {
        padding: 1rem;
    }

    .chat-toast {
        left: 16px;
        right: 16px;
        bottom: calc(172px + env(safe-area-inset-bottom));
    }

    /* Improve touch targets */
    .reaction-btn,
    .msg-action-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 0.5rem;
    }
}

/* Welcome Animation */
@keyframes welcomePulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4), 0 0 40px rgba(239, 68, 68, 0.2);
    }
    50% {
        box-shadow: 0 4px 30px rgba(239, 68, 68, 0.6), 0 0 60px rgba(239, 68, 68, 0.4);
    }
}

.chat-button.welcome {
    animation: welcomePulse 2s infinite;
}

/* Message Actions & Reactions */
.message-actions,
.message-reactions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message:hover .message-actions,
.message:hover .message-reactions {
    opacity: 1;
}

.reaction-btn,
.msg-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reaction-btn:hover,
.msg-action-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--primary-red);
    transform: scale(1.1);
}

.reaction-active {
    background: var(--primary-red) !important;
    border-color: var(--primary-red) !important;
    transform: scale(1.2);
}



/* Loading Skeleton */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text:last-child {
    width: 60%;
}

/* Enhanced Mobile Experience */
@media (max-width: 768px) {
    /* Prevent zoom on input focus */
    .chat-input {
        font-size: 16px;
    }

    /* Better spacing for mobile */
    .message {
        margin-bottom: 1.5rem;
    }

    /* Larger tap targets */
    .chat-mode-toggle,
    .chat-close {
        width: 40px;
        height: 40px;
    }

    .chat-mode-toggle {
        min-width: 78px;
        padding-inline: 12px;
    }

    /* Optimize for notch devices */
    .chat-window {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .chat-header {
        padding-top: calc(1rem + env(safe-area-inset-top));
    }

    .chat-input-container {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }

}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: rgba(15, 23, 42, 0.98);
    }

    .message-bubble {
        background: rgba(255, 255, 255, 0.08);
    }

    .message.user .message-bubble {
        background: var(--gradient-primary);
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .chat-window {
        border: 2px solid var(--primary-red);
    }

    .message-bubble {
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .quick-reply-btn {
        border-width: 2px;
    }
}

/* System Messages */
.message.system {
    justify-content: center;
    margin: 1rem 0;
}

.system-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    color: var(--primary-red);
    text-align: center;
    animation: slideIn 0.5s ease;
}

/* Toast Notifications */
.chat-toast {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100000;
    font-size: 0.95rem;
}

.chat-toast.show {
    transform: translateY(0);
    opacity: 1;
}

/* K3 Chat V1 - Lead Capture */
.chat-cta-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chat-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-cta-btn.primary {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
}

.chat-cta-btn.secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.chat-cta-btn:hover {
    transform: translateY(-1px);
}

.chat-lead-card {
    position: relative;
    width: 100%;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.18), transparent 42%),
        linear-gradient(180deg, rgba(8, 15, 29, 0.98), rgba(15, 23, 42, 0.94));
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 20px;
    padding: 16px;
    text-align: left;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.35);
    overflow: hidden;
}

.chat-lead-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 28%);
    pointer-events: none;
}

.chat-email-card {
    width: 100%;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.14), transparent 46%),
        rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 16px;
    padding: 14px;
    text-align: left;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.35);
}

.chat-lead-card h4 {
    margin: 0 0 6px;
    position: relative;
    z-index: 1;
    font-size: 16px;
    color: #f8fafc;
}

.chat-email-card h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #f8fafc;
}

.chat-lead-card p {
    margin: 0 0 12px;
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: rgba(219, 234, 254, 0.78);
    line-height: 1.45;
}

.chat-email-card p {
    margin: 0 0 12px;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.45;
}

.chat-lead-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 12px;
    position: relative;
    z-index: 1;
}

.chat-lead-highlights span {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: rgba(30, 41, 59, 0.72);
    color: #dbeafe;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.chat-lead-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-email-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-lead-progress {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.chat-lead-progress-label {
    font-size: 12px;
    font-weight: 700;
    color: #bfdbfe;
}

.chat-lead-progress-bar {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(51, 65, 85, 0.72);
    overflow: hidden;
}

.chat-lead-progress-bar > span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #60a5fa, #2563eb);
    transition: width 0.25s ease;
}

.chat-lead-step {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(15, 23, 42, 0.56);
}

.chat-lead-step[hidden] {
    display: none !important;
}

.chat-lead-step label {
    font-size: 12px;
    color: #dbeafe;
    font-weight: 600;
}

.chat-lead-step label.is-attention {
    color: #fde68a;
}

.chat-email-form > label {
    font-size: 12px;
    color: #e2e8f0;
    font-weight: 600;
}

.chat-lead-step-grid,
.chat-lead-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.chat-lead-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    position: relative;
    z-index: 1;
}

.chat-lead-nav-btn {
    border: 1px solid rgba(96, 165, 250, 0.26);
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-lead-nav-btn.primary {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.chat-lead-nav-btn.secondary {
    color: #e2e8f0;
    background: rgba(15, 23, 42, 0.74);
}

.chat-lead-nav-btn:hover:not(:disabled),
.chat-lead-submit:hover:not(:disabled) {
    transform: translateY(-1px);
}

.chat-lead-nav-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.chat-lead-error {
    min-height: 1.05rem;
    font-size: 12px;
    color: #fde68a;
    display: none;
    position: relative;
    z-index: 1;
}

.chat-lead-error.is-visible {
    display: block;
}

.chat-lead-step-note {
    margin: 0;
    font-size: 12px;
    color: rgba(191, 219, 254, 0.76);
}

.chat-lead-field-full {
    grid-column: 1 / -1;
}

.chat-lead-form input,
.chat-lead-form textarea,
.chat-lead-form select {
    width: 100%;
    background: rgba(8, 15, 29, 0.82);
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 12px;
    color: #e2e8f0;
    padding: 10px 11px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.chat-email-form input,
.chat-email-form textarea {
    width: 100%;
    background: rgba(2, 6, 23, 0.7);
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 10px;
    color: #e2e8f0;
    padding: 9px 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.chat-lead-form textarea {
    min-height: 88px;
}

.chat-email-form textarea {
    min-height: 108px;
}

.chat-lead-form select.is-attention {
    border-color: rgba(251, 191, 36, 0.62);
    background:
        linear-gradient(180deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0)),
        rgba(8, 15, 29, 0.82);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.12);
}

.chat-lead-form input:focus,
.chat-lead-form textarea:focus,
.chat-lead-form select:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.62);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.chat-email-form input:focus,
.chat-email-form textarea:focus {
    outline: none;
    border-color: rgba(96, 165, 250, 0.6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.chat-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: rgba(219, 234, 254, 0.8);
    line-height: 1.45;
}

.chat-checkbox-row input {
    width: auto;
    margin-top: 2px;
}

.chat-lead-submit {
    border: none;
    border-radius: 12px;
    padding: 10px 14px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.chat-lead-submit:disabled {
    opacity: 0.6;
    cursor: default;
}

.chat-lead-card.submitted {
    opacity: 0.75;
}

.chat-email-card.submitted {
    opacity: 0.78;
}

.chat-email-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

@media (max-width: 768px) {
    .chat-lead-step-grid,
    .chat-lead-grid {
        grid-template-columns: 1fr;
    }

    .chat-lead-card {
        padding: 12px;
    }

    .chat-lead-form input,
    .chat-lead-form textarea,
    .chat-lead-form select {
        font-size: 16px;
    }

    .chat-email-form input,
    .chat-email-form textarea {
        font-size: 16px;
    }
}
