/* ============================================================
   Gmind Institute — Chat Widget & WhatsApp Button Styles
   ============================================================ */

/* ─── WhatsApp Floating Button ─────────────────────────── */

.whatsapp-float {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 9998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.5);
}

.whatsapp-float svg {
    width: 34px;
    height: 34px;
    fill: #fff;
}

.whatsapp-float-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.whatsapp-float-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #333;
}

.whatsapp-float:hover .whatsapp-float-tooltip {
    opacity: 1;
}

/* Pulse animation */
@keyframes whatsapp-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
    70% { box-shadow: 0 0 0 18px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.whatsapp-float {
    animation: whatsapp-pulse 2s infinite;
}


/* ─── Live Chat Widget ─────────────────────────────────── */

.chat-widget-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A6CF7, #6C3FE8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.4);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    outline: none;
}

.chat-widget-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(74, 108, 247, 0.5);
}

.chat-widget-toggle svg {
    width: 28px;
    height: 28px;
    fill: #fff;
    transition: transform 0.3s ease;
}

.chat-widget-toggle.active svg {
    transform: rotate(90deg);
}

.chat-widget-toggle .chat-unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #FF4757;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #fff;
    font-family: 'Inter', sans-serif;
}

@keyframes chat-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.chat-widget-toggle.has-unread {
    animation: chat-bounce 0.6s ease infinite;
}


/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 9998;
    width: 370px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0) translateY(20px);
    transform-origin: bottom right;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.25s ease;
    font-family: 'Inter', 'Poppins', sans-serif;
}

.chat-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}


/* Chat Header */
.chat-window-header {
    background: linear-gradient(135deg, #4A6CF7, #6C3FE8);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chat-window-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-window-header-avatar svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.chat-window-header-info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.chat-window-header-info p {
    margin: 2px 0 0;
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.2;
}

.chat-window-close {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.chat-window-close:hover {
    background: rgba(255, 255, 255, 0.3);
}


/* Chat Body */
.chat-window-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #F7F8FC;
}

.chat-window-body::-webkit-scrollbar {
    width: 5px;
}

.chat-window-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}


/* Chat Messages */
.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.chat-msg.visitor {
    align-self: flex-end;
    background: linear-gradient(135deg, #4A6CF7, #6C3FE8);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.admin {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chat-msg-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}

.chat-msg.admin .chat-msg-time {
    text-align: left;
}

.chat-msg.visitor .chat-msg-time {
    text-align: right;
}


/* Typing Indicator */
.chat-typing {
    align-self: flex-start;
    display: none;
    padding: 10px 18px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chat-typing.visible {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: typing-dot 1.4s infinite;
}

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

@keyframes typing-dot {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}


/* Chat Input */
.chat-window-footer {
    padding: 12px 14px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: #4A6CF7;
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4A6CF7, #6C3FE8);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(74, 108, 247, 0.4);
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}


/* Pre-chat Form */
.chat-pre-form {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    justify-content: center;
}

.chat-pre-form h3 {
    text-align: center;
    margin: 0 0 4px;
    font-size: 18px;
    color: #333;
    font-weight: 700;
}

.chat-pre-form p {
    text-align: center;
    margin: 0 0 8px;
    color: #888;
    font-size: 13px;
}

.chat-pre-form input {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.chat-pre-form input:focus {
    border-color: #4A6CF7;
}

.chat-pre-form .chat-start-btn {
    background: linear-gradient(135deg, #4A6CF7, #6C3FE8);
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Inter', sans-serif;
}

.chat-pre-form .chat-start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(74, 108, 247, 0.4);
}


/* Offline Message */
.chat-offline {
    text-align: center;
    padding: 20px;
    color: #888;
}

.chat-offline svg {
    width: 40px;
    height: 40px;
    fill: #ccc;
    margin-bottom: 8px;
}

.chat-offline p {
    margin: 4px 0;
    font-size: 13px;
}


/* ─── Mobile Responsive ────────────────────────────────── */

@media (max-width: 480px) {
    .chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .whatsapp-float {
        bottom: 90px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .chat-widget-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .chat-window {
        bottom: 80px;
        right: 16px;
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
    }
}
