/* =========================================================
   SW AI CHATBOT — Dark Pink + White
   ========================================================= */

.sw-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 1.6rem;
    box-shadow: 0 8px 30px rgba(190, 24, 93, 0.4);
    z-index: 99998;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sw-pulse 2s infinite;
}
.sw-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(190, 24, 93, 0.55);
    animation: none;
}
.sw-chat-toggle.active { animation: none; transform: rotate(90deg); }
.sw-chat-toggle.active i::before { content: "\f00d"; }

@keyframes sw-pulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(190, 24, 93, 0.4); }
    50% { box-shadow: 0 8px 40px rgba(236, 72, 153, 0.7); }
}

.sw-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: sw-bounce 1.5s infinite;
}
@keyframes sw-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.sw-agent-online-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
}

.sw-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 140px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(190, 24, 93, 0.3);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.sw-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.sw-chat-header {
    background: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
}
.sw-chat-header-left { display: flex; align-items: center; gap: 12px; }

.sw-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}
.sw-chat-avatar img { width: 100%; height: 100%; object-fit: cover; }

.sw-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #be185d;
}
.sw-chat-header-info h4 {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
}
.sw-chat-header-info p {
    margin: 2px 0 0;
    font-size: 0.78rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}
.sw-online-dot-small {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
}
.sw-chat-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sw-chat-close:hover { background: rgba(255, 255, 255, 0.25); }

.sw-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #fdf2f8;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}
.sw-chat-body::-webkit-scrollbar { width: 6px; }
.sw-chat-body::-webkit-scrollbar-thumb { background: #fbcfe8; border-radius: 3px; }

.sw-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: sw-fadeIn 0.3s ease;
}
@keyframes sw-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.sw-chat-bot { align-self: flex-start; }
.sw-chat-user { align-self: flex-end; align-items: flex-end; }
.sw-chat-agent { align-self: flex-start; }

/*.sw-chat-bubble {*/
/*    padding: 12px 16px;*/
/*    border-radius: 16px;*/
/*    font-size: 0.92rem;*/
/*    line-height: 1.5;*/
/*    word-wrap: break-word;*/
/*    white-space: pre-wrap;*/
/*}*/
.sw-chat-bot .sw-chat-bubble {
    background: #ffffff;
    color: #1f0a14;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(190, 24, 93, 0.08);
}
.sw-chat-user .sw-chat-bubble {
    background: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(190, 24, 93, 0.2);
}
.sw-chat-agent .sw-chat-bubble {
    background: #fef3c7;
    color: #78350f;
    border-left: 4px solid #f59e0b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.sw-chat-agent-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #be185d;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sw-chat-time {
    font-size: 0.7rem;
    color: #a88b9a;
    margin-top: 4px;
    padding: 0 8px;
}

.sw-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}
.sw-chat-quick button {
    background: #ffffff;
    border: 1.5px solid #fbcfe8;
    color: #be185d;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.sw-chat-quick button:hover {
    background: #be185d;
    color: #ffffff;
    border-color: #be185d;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(190, 24, 93, 0.2);
}

.sw-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    align-self: center;
    margin-top: 8px;
}
.sw-live-indicator i { color: #22c55e; font-size: 0.6rem; animation: sw-blink 1.5s infinite; }
@keyframes sw-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.sw-chat-typing {
    padding: 8px 20px 14px;
    background: #fdf2f8;
    display: flex;
    gap: 5px;
    align-items: center;
}
.sw-chat-typing span {
    width: 8px;
    height: 8px;
    background: #be185d;
    border-radius: 50%;
    animation: sw-typing 1.4s infinite;
}
.sw-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.sw-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sw-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.sw-chat-footer {
    padding: 14px 16px;
    background: #ffffff;
    border-top: 1px solid #fbcfe8;
}
.sw-chat-footer form { display: flex; gap: 8px; }
.sw-chat-footer input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #fbcfe8;
    border-radius: 24px;
    font-size: 0.9rem;
    color: #1f0a14;
    background: #fdf2f8;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.sw-chat-footer input:focus {
    border-color: #be185d;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(190, 24, 93, 0.1);
}
.sw-chat-footer button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sw-chat-footer button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(190, 24, 93, 0.4);
}

@media (max-width: 575px) {
    .sw-chat-toggle { width: 56px; height: 56px; font-size: 1.4rem; bottom: 18px; right: 18px; }
    .sw-chat-window {
        bottom: 84px;
        right: 12px;
        left: 12px;
        width: auto;
        height: calc(100vh - 120px);
        max-height: 600px;
    }
}
/* ==================== CLICKABLE LINKS ==================== */
.sw-chat-bubble a {
    color: #be185d;
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(190,24,93,0.3);
    text-underline-offset: 2px;
    transition: all 0.2s;
}
.sw-chat-bubble a:hover {
    color: #9d174d;
    text-decoration-color: #be185d;
    background: rgba(190,24,93,0.05);
    padding: 2px 4px;
    border-radius: 4px;
}
.sw-chat-user .sw-chat-bubble a {
    color: #ffffff;
    text-decoration-color: rgba(255,255,255,0.4);
}
.sw-chat-user .sw-chat-bubble a:hover {
    color: #ffffff;
    text-decoration-color: #ffffff;
    background: rgba(255,255,255,0.15);
}

/* Bold text in bubbles */
.sw-chat-bubble strong {
    font-weight: 700;
    color: #1f0a14;
}
.sw-chat-user .sw-chat-bubble strong {
    color: #ffffff;
}

/* WhatsApp link special */
.sw-chat-bubble a[href^="https://wa.me"] {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff !important;
    padding: 4px 12px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    margin: 2px 0;
    transition: transform 0.2s, box-shadow 0.2s;
}
.sw-chat-bubble a[href^="https://wa.me"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,211,102,0.4);
    background: linear-gradient(135deg, #25D366, #128C7E);
}
.sw-chat-bubble a[href^="https://wa.me"]::before {
    content: '\f232';
    font-family: 'Font Awesome 6 Brands';
    font-size: 1.1em;
}

/* Email link special */
.sw-chat-bubble a[href^="mailto:"] {
    color: #be185d;
    font-weight: 700;
}

/* Phone link special */
.sw-chat-bubble a[href^="tel:"] {
    color: #be185d;
    font-weight: 700;
} 
/* =========================================================
   SW AI CHATBOT — Responsive + Dark/Light Mode
   ========================================================= */

/* ==================== LIGHT MODE (DEFAULT) ==================== */
:root {
    --sw-pink: #be185d;
    --sw-pink-2: #ec4899;
    --sw-pink-3: #f472b6;
    --sw-pink-soft: #fce7f3;
    --sw-pink-bg: #fdf2f8;

    --sw-white: #ffffff;
    --sw-bg: #f8f9fc;
    --sw-card: #ffffff;
    --sw-card-2: #fdf2f8;
    --sw-border: #fbcfe8;
    --sw-text: #1f0a14;
    --sw-text-muted: #6b4a5e;

    --sw-shadow: 0 4px 20px rgba(190,24,93,0.08);
    --sw-shadow-lg: 0 20px 60px rgba(190,24,93,0.25);
    --sw-glow: 0 0 40px rgba(236,72,153,0.4);

    --sw-grad: linear-gradient(135deg, #be185d 0%, #ec4899 100%);
}

/* ==================== DARK MODE ==================== */
[data-theme="dark"] {
    --sw-bg: #0f0a14;
    --sw-card: #1a1220;
    --sw-card-2: #241826;
    --sw-border: rgba(244,114,182,0.25);
    --sw-text: #fce7f3;
    --sw-text-muted: #d8b4c8;

    --sw-shadow: 0 4px 20px rgba(0,0,0,0.5);
    --sw-shadow-lg: 0 20px 60px rgba(0,0,0,0.6);
}

/* ==================== FLOATING BUTTON ==================== */
.sw-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: var(--sw-grad);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    box-shadow: 0 8px 30px rgba(190,24,93,0.45);
    z-index: 99998;
    transition: transform 0.3s cubic-bezier(0.68,-0.55,0.265,1.55), box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: sw-pulse 2s infinite;
}

.sw-chat-toggle.sw-chat-bottom-left {
    right: auto;
    left: 24px;
}

.sw-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 40px rgba(190,24,93,0.6);
    animation: none;
}

.sw-chat-toggle.active {
    animation: none;
    transform: rotate(90deg);
}
.sw-chat-toggle.active i::before {
    content: "\f00d"; /* fa-times */
}

@keyframes sw-pulse {
    0%, 100% { box-shadow: 0 8px 30px rgba(190,24,93,0.45); }
    50% { box-shadow: 0 8px 40px rgba(236,72,153,0.75); }
}

/* Badge */
.sw-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: sw-bounce 1.5s infinite;
}
@keyframes sw-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.sw-agent-online-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ==================== CHAT WINDOW ==================== */
.sw-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 130px);
    background: var(--sw-card);
    border-radius: 20px;
    box-shadow: var(--sw-shadow-lg);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.68,-0.55,0.265,1.55), visibility 0.3s;
}

.sw-chat-window.sw-chat-bottom-left {
    right: auto;
    left: 24px;
}

.sw-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Minimized state */
.sw-chat-window.minimized {
    height: 70px !important;
    min-height: 70px;
}
.sw-chat-window.minimized .sw-chat-body,
.sw-chat-window.minimized .sw-chat-footer,
.sw-chat-window.minimized .sw-chat-typing {
    display: none !important;
}

/* ==================== HEADER ==================== */
.sw-chat-header {
    background: var(--sw-grad);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.sw-chat-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(255,255,255,0.15), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.sw-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}
.sw-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff;
    position: relative;
    border: 2px solid rgba(255,255,255,0.3);
    overflow: hidden;
    flex-shrink: 0;
}
.sw-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sw-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #be185d;
}
.sw-chat-header-info {
    position: relative;
    z-index: 1;
}
.sw-chat-header-info h4 {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}
.sw-chat-header-info p {
    margin: 3px 0 0;
    font-size: 0.76rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
}
.sw-online-dot-small {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ==================== HEADER ACTIONS ==================== */
.sw-chat-header-actions {
    display: flex;
    gap: 4px;
    position: relative;
    z-index: 1;
}
.sw-chat-action-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sw-chat-action-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* ==================== BODY ==================== */
.sw-chat-body {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    background: var(--sw-bg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    min-height: 0;
}
.sw-chat-body::-webkit-scrollbar { width: 6px; }
.sw-chat-body::-webkit-scrollbar-track { background: transparent; }
.sw-chat-body::-webkit-scrollbar-thumb {
    background: var(--sw-border);
    border-radius: 3px;
}

.sw-chat-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: sw-fadeIn 0.3s ease;
}
@keyframes sw-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.sw-chat-bot { align-self: flex-start; }
.sw-chat-user { align-self: flex-end; align-items: flex-end; }
.sw-chat-agent { align-self: flex-start; }

.sw-chat-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.sw-chat-bot .sw-chat-bubble {
    background: var(--sw-card);
    color: var(--sw-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(190,24,93,0.08);
}
.sw-chat-user .sw-chat-bubble {
    background: var(--sw-grad);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 12px rgba(190,24,93,0.25);
}
.sw-chat-agent .sw-chat-bubble {
    background: #fef3c7;
    color: #78350f;
    border-left: 4px solid #f59e0b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}
[data-theme="dark"] .sw-chat-agent .sw-chat-bubble {
    background: rgba(245,158,11,0.15);
    color: #fcd34d;
}
.sw-chat-agent-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--sw-pink);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.sw-chat-time {
    font-size: 0.68rem;
    color: var(--sw-text-muted);
    margin-top: 3px;
    padding: 0 6px;
}

/* ==================== CLICKABLE LINKS ==================== */
.sw-chat-bubble a {
    color: var(--sw-pink);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: rgba(190,24,93,0.3);
    text-underline-offset: 2px;
    transition: all 0.2s;
}
.sw-chat-bubble a:hover {
    color: #9d174d;
    text-decoration-color: var(--sw-pink);
    background: rgba(190,24,93,0.05);
    padding: 2px 4px;
    border-radius: 4px;
}
.sw-chat-user .sw-chat-bubble a {
    color: #ffffff;
    text-decoration-color: rgba(255,255,255,0.4);
}
.sw-chat-bubble strong {
    font-weight: 700;
    color: var(--sw-text);
}
.sw-chat-user .sw-chat-bubble strong {
    color: #ffffff;
}
.sw-chat-bubble a[href^="https://wa.me"] {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff !important;
    padding: 3px 10px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    margin: 2px 0;
}
.sw-chat-bubble a[href^="https://wa.me"]::before {
    content: '\f232';
    font-family: 'Font Awesome 6 Brands';
    font-size: 1em;
}

/* ==================== QUICK REPLIES ==================== */
.sw-chat-quick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.sw-chat-quick button {
    background: var(--sw-card);
    border: 1.5px solid var(--sw-border);
    color: var(--sw-pink);
    padding: 7px 12px;
    border-radius: 18px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}
.sw-chat-quick button:hover {
    background: var(--sw-pink);
    color: #ffffff;
    border-color: var(--sw-pink);
    transform: translateY(-2px);
}

/* ==================== LIVE INDICATOR ==================== */
.sw-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(34,197,94,0.12);
    color: #15803d;
    border-radius: 18px;
    font-size: 0.78rem;
    font-weight: 600;
    align-self: center;
    margin-top: 6px;
}
.sw-live-indicator i {
    color: #22c55e;
    font-size: 0.55rem;
    animation: sw-blink 1.5s infinite;
}
@keyframes sw-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ==================== TYPING ==================== */
.sw-chat-typing {
    padding: 6px 18px 12px;
    background: var(--sw-bg);
    display: flex;
    gap: 4px;
    align-items: center;
    flex-shrink: 0;
}
.sw-chat-typing span {
    width: 7px;
    height: 7px;
    background: var(--sw-pink);
    border-radius: 50%;
    animation: sw-typing 1.4s infinite;
}
.sw-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.sw-chat-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes sw-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ==================== FOOTER ==================== */
.sw-chat-footer {
    padding: 12px 14px;
    background: var(--sw-card);
    border-top: 1px solid var(--sw-border);
    flex-shrink: 0;
}
.sw-chat-footer form {
    display: flex;
    gap: 8px;
    align-items: center;
}
.sw-chat-footer input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid var(--sw-border);
    border-radius: 22px;
    font-size: 0.88rem;
    color: var(--sw-text);
    background: var(--sw-card-2);
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    min-width: 0;
}
.sw-chat-footer input::placeholder {
    color: var(--sw-text-muted);
    opacity: 0.7;
}
.sw-chat-footer input:focus {
    border-color: var(--sw-pink);
    background: var(--sw-card);
    box-shadow: 0 0 0 3px rgba(190,24,93,0.12);
}
.sw-chat-footer button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--sw-grad);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sw-chat-footer button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(190,24,93,0.4);
}

/* =========================================================
   MOBILE FIX — CHAT BOX SIZE (CHOTA)
   ========================================================= */

@media (max-width: 640px) {

    /* ==================== FLOATING BUTTON ==================== */
    .sw-chat-toggle {
        width: 52px;
        height: 52px;
        font-size: 1.2rem;
        bottom: 16px;
        right: 16px;
    }
    .sw-chat-toggle.sw-chat-bottom-left {
        right: auto;
        left: 16px;
    }

    /* ==================== CHAT WINDOW — FIXED SIZE ==================== */
    .sw-chat-window {
        position: fixed !important;
        /* Niche se 80px upar */
        bottom: 80px !important;
        /* Right se 12px */
        right: 12px !important;
        left: 12px !important;
        /* Width: screen width - 24px */
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
        /* Height: 70% of screen — chota */
        height: 70vh !important;
        max-height: 480px !important;
        /* Rounded corners */
        border-radius: 18px !important;
        /* Animation */
        transform: translateY(20px) scale(0.95);
        transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.68,-0.55,0.265,1.55), visibility 0.3s;
    }

    .sw-chat-window.open {
        transform: translateY(0) scale(1);
    }

    .sw-chat-window.sw-chat-bottom-left {
        right: 12px !important;
        left: 12px !important;
    }

    /* Minimized state */
    .sw-chat-window.minimized {
        height: 60px !important;
        min-height: 60px !important;
        max-height: 60px !important;
    }

    /* ==================== HEADER ==================== */
    .sw-chat-header {
        padding: 12px 14px;
        border-radius: 18px 18px 0 0;
    }
    .sw-chat-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
    .sw-chat-header-info h4 {
        font-size: 0.88rem;
    }
    .sw-chat-header-info p {
        font-size: 0.7rem;
    }
    .sw-chat-action-btn {
        width: 26px;
        height: 26px;
        font-size: 0.75rem;
    }

    /* ==================== BODY ==================== */
    .sw-chat-body {
        padding: 12px;
        gap: 10px;
    }
    .sw-chat-message {
        max-width: 88%;
    }
    .sw-chat-bubble {
        padding: 9px 12px;
        font-size: 0.85rem;
        line-height: 1.45;
    }
    .sw-chat-time {
        font-size: 0.65rem;
    }

    /* ==================== QUICK REPLIES ==================== */
    .sw-chat-quick {
        gap: 5px;
    }
    .sw-chat-quick button {
        padding: 6px 10px;
        font-size: 0.72rem;
    }

    /* ==================== LIVE INDICATOR ==================== */
    .sw-live-indicator {
        padding: 5px 12px;
        font-size: 0.72rem;
    }

    /* ==================== FOOTER ==================== */
    .sw-chat-footer {
        padding: 10px 12px;
    }
    .sw-chat-footer input {
        padding: 9px 14px;
        font-size: 0.85rem;
    }
    .sw-chat-footer button {
        width: 38px;
        height: 38px;
        font-size: 0.88rem;
    }

    /* ==================== TYPING ==================== */
    .sw-chat-typing {
        padding: 5px 14px 10px;
    }
    .sw-chat-typing span {
        width: 6px;
        height: 6px;
    }
}

/* ==================== VERY SMALL PHONES (< 380px) ==================== */
@media (max-width: 380px) {

    .sw-chat-toggle {
        width: 48px;
        height: 48px;
        font-size: 1.1rem;
    }

    .sw-chat-window {
        bottom: 72px !important;
        right: 8px !important;
        left: 8px !important;
        max-width: calc(100vw - 16px) !important;
        height: 72vh !important;
        max-height: 440px !important;
        border-radius: 16px !important;
    }

    .sw-chat-header {
        padding: 10px 12px;
    }
    .sw-chat-avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    .sw-chat-header-info h4 {
        font-size: 0.82rem;
    }
    .sw-chat-header-info p {
        font-size: 0.66rem;
    }
    .sw-chat-bubble {
        font-size: 0.82rem;
        padding: 8px 11px;
    }
    .sw-chat-footer input {
        font-size: 0.82rem;
        padding: 8px 12px;
    }
    .sw-chat-footer button {
        width: 36px;
        height: 36px;
    }
    .sw-chat-quick button {
        font-size: 0.68rem;
        padding: 5px 9px;
    }
}

/* ==================== LANDSCAPE MODE ==================== */
@media (max-width: 900px) and (orientation: landscape) {
    .sw-chat-window {
        bottom: 70px !important;
        right: 16px !important;
        left: auto !important;
        width: 400px !important;
        max-width: calc(100vw - 32px) !important;
        height: calc(100vh - 100px) !important;
        max-height: 360px !important;
        border-radius: 18px !important;
        transform: translateY(20px) scale(0.95);
    }
    .sw-chat-window.open {
        transform: translateY(0) scale(1);
    }
    .sw-chat-window.sw-chat-bottom-left {
        right: auto !important;
        left: 16px !important;
    }
}
// ==================== AUTO-OPEN SUPPORT ====================
const displayConfig = window.SW_CHATBOT_DISPLAY || {};
if (displayConfig.autoOpen && displayConfig.autoOpenDelay) {
    setTimeout(() => {
        if (!windowEl.classList.contains('open')) {
            openChat();
        }
    }, displayConfig.autoOpenDelay * 1000);
}
/* ==================== CLICKABLE LINKS ==================== */
.sw-chat-bubble a {
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 8px;
    margin: 2px 0;
    line-height: 1.3;
}

/* Phone — Green */
.sw-chat-bubble a.sw-link-call {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(16,185,129,0.3);
}
.sw-chat-bubble a.sw-link-call:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16,185,129,0.5);
}
.sw-chat-bubble a.sw-link-call::before {
    content: '\f095';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85em;
}

/* Email — Pink */
.sw-chat-bubble a.sw-link-email {
    background: linear-gradient(135deg, #be185d, #ec4899);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(190,24,93,0.3);
}
.sw-chat-bubble a.sw-link-email:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(190,24,93,0.5);
}
.sw-chat-bubble a.sw-link-email::before {
    content: '\f0e0';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85em;
}

/* WhatsApp — Green Official */
.sw-chat-bubble a.sw-link-whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff !important;
    box-shadow: 0 3px 12px rgba(37,211,102,0.4);
    padding: 4px 12px;
    border-radius: 14px;
}
.sw-chat-bubble a.sw-link-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,211,102,0.6);
}
.sw-chat-bubble a.sw-link-whatsapp::before {
    content: '\f232';
    font-family: 'Font Awesome 6 Brands';
    font-weight: 400;
    font-size: 1.1em;
    margin-right: 2px;
}

/* Web Link */
.sw-chat-bubble a.sw-link-web {
    color: #be185d;
    text-decoration: underline;
    text-underline-offset: 2px;
    background: transparent;
    padding: 0;
}
.sw-chat-bubble a.sw-link-web:hover {
    color: #9d174d;
    background: rgba(190,24,93,0.08);
    padding: 2px 4px;
}

/* User bubble links — white */
.sw-chat-user .sw-chat-bubble a {
    color: #ffffff !important;
}
.sw-chat-user .sw-chat-bubble a.sw-link-web {
    color: #ffffff !important;
    text-decoration: underline;
}

/* Bold text */
.sw-chat-bubble strong {
    font-weight: 700;
}
/* ==================== TEXT SIZE — CHOTA ==================== */
.sw-chat-bubble {
    font-size: 0.84rem !important;   /* Chota text */
    line-height: 1.45 !important;
    padding: 9px 13px !important;
    border-radius: 13px !important;
}

.sw-chat-time {
    font-size: 0.65rem !important;
    margin-top: 3px !important;
}

.sw-chat-agent-label {
    font-size: 0.72rem !important;
}

.sw-chat-header-info h4 {
    font-size: 0.92rem !important;
}

.sw-chat-header-info p {
    font-size: 0.72rem !important;
}

.sw-chat-quick button {
    font-size: 0.74rem !important;
    padding: 6px 11px !important;
}

.sw-chat-footer input {
    font-size: 0.85rem !important;
    padding: 10px 14px !important;
}

.sw-live-indicator {
    font-size: 0.72rem !important;
    padding: 5px 12px !important;
}

/* ==================== CLICKABLE LINKS ==================== */
.sw-chat-bubble a {
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 8px;
    margin: 2px 0;
    font-size: 0.82rem;
    line-height: 1.3;
}

/* Phone — Green */
.sw-chat-bubble a.sw-link-call {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(16,185,129,0.3);
}
.sw-chat-bubble a.sw-link-call:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16,185,129,0.5);
    color: #ffffff !important;
}
.sw-chat-bubble a.sw-link-call::before {
    content: '\f095';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85em;
}

/* Email — Pink */
.sw-chat-bubble a.sw-link-email {
    background: linear-gradient(135deg, #be185d, #ec4899);
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(190,24,93,0.3);
}
.sw-chat-bubble a.sw-link-email:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(190,24,93,0.5);
    color: #ffffff !important;
}
.sw-chat-bubble a.sw-link-email::before {
    content: '\f0e0';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 0.85em;
}

/* WhatsApp — Green */
.sw-chat-bubble a.sw-link-whatsapp {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff !important;
    box-shadow: 0 3px 12px rgba(37,211,102,0.4);
    padding: 4px 12px;
    border-radius: 14px;
}
.sw-chat-bubble a.sw-link-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37,211,102,0.6);
    color: #ffffff !important;
}
.sw-chat-bubble a.sw-link-whatsapp::before {
    content: '\f232';
    font-family: 'Font Awesome 6 Brands';
    font-weight: 400;
    font-size: 1.1em;
    margin-right: 2px;
}

/* Web Link */
.sw-chat-bubble a.sw-link-web {
    color: #be185d;
    text-decoration: underline;
    text-underline-offset: 2px;
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.sw-chat-bubble a.sw-link-web:hover {
    color: #9d174d;
    background: rgba(190,24,93,0.08);
    padding: 2px 4px;
    border-radius: 4px;
}

/* User bubble links — white */
.sw-chat-user .sw-chat-bubble a.sw-link-web {
    color: #ffffff !important;
    text-decoration: underline;
}

/* Bold text */
.sw-chat-bubble strong {
    font-weight: 700;
}

/* ==================== MOBILE — EVEN SMALLER ==================== */
@media (max-width: 640px) {
    .sw-chat-bubble {
        font-size: 0.8rem !important;
        padding: 8px 12px !important;
    }
    .sw-chat-bubble a {
        font-size: 0.78rem;
        padding: 3px 7px;
    }
}