/* ===============================================
   Chat Widget Styles - InfoTech Zone Store
   =============================================== */

/* Floating Chat Button */
.chat-widget-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
    border-radius: 50% !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4) !important;
    cursor: pointer !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: none !important;
    outline: none !important;
    /* Remove black focus border */
    color: white !important;
    /* Force icons White */
}

.chat-widget-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5) !important;
}

.chat-widget-btn .icon-chat,
.chat-widget-btn .icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-widget-btn svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chat-widget-btn .icon-close svg {
    stroke: white !important;
    /* Force Stroke to be white for Cross Icon */
}

/* Icon Animation States */
.chat-widget-btn .icon-chat {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.chat-widget-btn .icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.chat-widget-btn.active {
    transform: rotate(0);
    /* Don't rotate button itself, allow inner icons */
}

.chat-widget-btn.active .icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chat-widget-btn.active .icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Chat Panel */
.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    /* Increased Height */
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-panel.active {
    display: flex;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chat-header-avatar svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.chat-header-info {
    flex: 1;
}

.chat-header-title {
    font-weight: 600;
    font-size: 1rem;
    margin: 0;
}

.chat-header-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

.chat-header-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-header-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.chat-message.user {
    background: #6366f1;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.ai {
    background: white;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-message.typing {
    background: white;
    padding: 16px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

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

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

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Chat Input */
.chat-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #6366f1;
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    background: #6366f1;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.chat-send-btn:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

/* WhatsApp Fallback */
.chat-whatsapp-link {
    padding: 12px 16px;
    background: #bbf7d0;
    /* Stronger green bg for light mode */
    border-top: 1px solid #86efac;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #14532d;
    /* Dark green text */
    font-size: 0.85rem;
    font-weight: 600;
    /* Bolder text */
    text-decoration: none;
    transition: background 0.2s;
}

.chat-whatsapp-link:hover {
    background: #dcfce7;
}

.chat-whatsapp-link svg {
    width: 18px;
    height: 18px;
    fill: #16a34a;
}

/* Dark Mode */
html[data-theme='dark'] .chat-panel {
    background: #1e293b;
}

html[data-theme='dark'] .chat-messages {
    background: #0f172a;
}

html[data-theme='dark'] .chat-message.ai {
    background: #334155;
    color: #f8fafc;
}

html[data-theme='dark'] .chat-input-area {
    background: #1e293b;
    border-top-color: #334155;
}

html[data-theme='dark'] .chat-input {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

html[data-theme='dark'] .chat-input::placeholder {
    color: #64748b;
}

html[data-theme='dark'] .chat-whatsapp-link {
    background: #064e3b;
    /* Deep green */
    border-top-color: #065f46;
    color: #4ade80;
    /* Bright green text */
}

html[data-theme='dark'] .chat-whatsapp-link svg {
    fill: #4ade80;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 20px 20px 0 0;
    }

    .chat-widget-btn {
        bottom: 16px !important;
        right: 16px !important;
    }

    /* Fix: Hide floating button when chat is open on mobile to prevent overlap */
    .chat-widget-btn.active {
        display: none !important;
    }
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

html[data-theme='dark'] .chat-messages::-webkit-scrollbar-thumb {
    background: #475569;
}