/**
 * T-Shirt Elephant AI Chat Widget
 * Styled to match the main website design
 * Colors: #1776C8 (primary), #2B90E7 (accent), #125A9C (dark)
 */

/* ============================================
   Widget Container
   ============================================ */
#te-chat-widget {
    font-family: 'Open Sans', sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

/* ============================================
   Toggle Button
   ============================================ */
.te-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1776C8 0%, #125A9C 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(23, 118, 200, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.te-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(23, 118, 200, 0.5);
}

.te-chat-button:active {
    transform: translateY(0);
}

.te-chat-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* Pulse animation for new visitors */
.te-chat-button.te-pulse {
    animation: te-pulse 2s infinite;
}

@keyframes te-pulse {
    0% {
        box-shadow: 0 4px 15px rgba(23, 118, 200, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(23, 118, 200, 0.7), 0 0 0 10px rgba(23, 118, 200, 0.1);
    }
    100% {
        box-shadow: 0 4px 15px rgba(23, 118, 200, 0.4);
    }
}

/* ============================================
   Chat Window
   ============================================ */
.te-chat-window {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    height: 520px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#te-chat-widget.te-chat-open .te-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Hide toggle button when chat is open on mobile */
@media (max-width: 480px) {
    #te-chat-widget.te-chat-open .te-chat-button {
        display: none;
    }
}

/* ============================================
   Chat Header
   ============================================ */
.te-chat-header {
    background: linear-gradient(135deg, #1776C8 0%, #125A9C 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.te-chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

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

.te-chat-header-title .te-header-icon i {
    font-size: 14px;
}

.te-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    line-height: 1;
}

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

/* ============================================
   Messages Container
   ============================================ */
.te-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

/* Custom scrollbar */
.te-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.te-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* ============================================
   Welcome Message
   ============================================ */
.te-welcome-message {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.te-welcome-message h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.te-welcome-message h4 i {
    color: #1776C8;
}

.te-welcome-message p {
    margin: 0;
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================
   Quick Action Buttons
   ============================================ */
.te-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.te-quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: #333;
}

.te-quick-action:hover {
    border-color: #1776C8;
    background: #f0f7ff;
    transform: translateX(4px);
}

.te-quick-action-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.te-quick-action-icon i {
    font-size: 18px;
    color: #1776C8;
}

/* ============================================
   Chat Messages
   ============================================ */
.te-message {
    margin-bottom: 12px;
    max-width: 85%;
    animation: te-message-in 0.3s ease;
}

@keyframes te-message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.te-message-user {
    margin-left: auto;
    background: linear-gradient(135deg, #1776C8 0%, #2B90E7 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    font-size: 14px;
    line-height: 1.5;
}

.te-message-bot {
    margin-right: auto;
    background: white;
    color: #333;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.te-message-bot a {
    color: #1776C8;
    text-decoration: none;
}

.te-message-bot a:hover {
    text-decoration: underline;
}

/* ============================================
   Typing Indicator
   ============================================ */
.te-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 16px;
    background: white;
    border-radius: 18px 18px 18px 4px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.te-typing-dot {
    width: 8px;
    height: 8px;
    background: #1776C8;
    border-radius: 50%;
    animation: te-typing-bounce 1.4s infinite ease-in-out;
}

.te-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes te-typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* ============================================
   Input Area
   ============================================ */
.te-chat-input-area {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 12px;
    flex-shrink: 0;
}

#te-chat-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 14px;
    font-family: 'Open Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#te-chat-input:focus {
    border-color: #1776C8;
    box-shadow: 0 0 0 3px rgba(23, 118, 200, 0.1);
}

#te-chat-input::placeholder {
    color: #999;
}

#te-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1776C8 0%, #125A9C 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#te-chat-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(23, 118, 200, 0.4);
}

#te-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#te-chat-send svg {
    width: 20px;
    height: 20px;
    fill: white;
    margin-left: 2px;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 480px) {
    #te-chat-widget {
        bottom: 0;
        right: 0;
        left: 0;
    }

    .te-chat-button {
        position: fixed;
        bottom: 20px;
        right: 20px;
    }

    .te-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
    }

    #te-chat-widget.te-chat-open .te-chat-window {
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   Status Indicator (Online)
   ============================================ */
.te-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 2px;
}

.te-status-dot {
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: te-status-pulse 2s infinite;
}

@keyframes te-status-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ============================================
   Powered By Footer
   ============================================ */
.te-chat-footer {
    text-align: center;
    padding: 8px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    font-size: 11px;
    color: #999;
}

.te-chat-footer a {
    color: #1776C8;
    text-decoration: none;
}
