/**
 * Taimal AI Chat Widget Styles
 * Floating live chat for www.taimal.shop
 */

/* ============================================================================
   CSS VARIABLES
   ============================================================================ */

:root {
    --taimal-primary: #C41E3A;
    --taimal-primary-dark: #8B0000;
    --taimal-gold: #FFD700;
    --taimal-cream: #FFF8E7;
    --taimal-persona-color: #43A047;
    --taimal-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --taimal-radius: 16px;
    --taimal-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
}

/* ============================================================================
   FLOATING ACTION BUTTON
   ============================================================================ */

.taimal-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--taimal-primary) 0%, var(--taimal-primary-dark) 100%);
    border: none;
    cursor: pointer;
    box-shadow: var(--taimal-shadow);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.taimal-chat-fab:hover {
    transform: scale(1.1);
}

.taimal-chat-fab.hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.taimal-chat-fab .fab-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    z-index: 1;
}

.taimal-chat-fab .fab-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--taimal-primary);
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

/* ============================================================================
   CHAT WINDOW
   ============================================================================ */

.taimal-chat-window {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 100px);
    background: #fff;
    border-radius: var(--taimal-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.taimal-chat-window.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   HEADER
   ============================================================================ */

.taimal-chat-header {
    background: linear-gradient(135deg, var(--taimal-primary) 0%, var(--taimal-primary-dark) 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-info {
    display: flex;
    flex-direction: column;
}

.header-title {
    font-family: var(--taimal-font);
    font-size: 16px;
    font-weight: 600;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.85;
}

.header-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.header-close:hover {
    opacity: 1;
}

/* ============================================================================
   PERSONA SELECTOR
   ============================================================================ */

.taimal-persona-selector {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--taimal-cream);
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.persona-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: white;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--taimal-font);
}

.persona-btn:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.persona-btn.active {
    border-color: var(--taimal-persona-color);
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.persona-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.persona-name {
    font-size: 11px;
    font-weight: 500;
    color: #666;
}

.persona-btn.active .persona-name {
    color: var(--taimal-persona-color);
}

/* ============================================================================
   MESSAGES AREA
   ============================================================================ */

.taimal-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9f9f9;
}

.welcome-message {
    background: linear-gradient(135deg, rgba(196, 30, 58, 0.1) 0%, rgba(255, 215, 0, 0.1) 100%);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    font-family: var(--taimal-font);
}

.welcome-message p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
}

.welcome-message .welcome-eng {
    font-size: 12px;
    color: #666;
    margin-bottom: 0;
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: message-in 0.3s ease;
}

@keyframes message-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    font-family: var(--taimal-font);
}

.chat-message.user .message-content {
    background: var(--taimal-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Typing Indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--taimal-primary);
    border-radius: 50%;
    animation: typing-bounce 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-6px);
    }
}

/* ============================================================================
   INPUT AREA
   ============================================================================ */

.taimal-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.taimal-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #eee;
    border-radius: 24px;
    font-size: 14px;
    font-family: var(--taimal-font);
    outline: none;
    transition: border-color 0.2s;
}

.taimal-chat-input:focus {
    border-color: var(--taimal-primary);
}

.taimal-chat-input::placeholder {
    color: #999;
}

.taimal-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--taimal-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.taimal-chat-send:hover {
    background: var(--taimal-primary-dark);
    transform: scale(1.05);
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.taimal-chat-footer {
    padding: 8px;
    text-align: center;
    background: #f5f5f5;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.taimal-chat-footer a {
    font-size: 11px;
    color: #999;
    text-decoration: none;
    font-family: var(--taimal-font);
}

.taimal-chat-footer a:hover {
    color: var(--taimal-primary);
}

/* ============================================================================
   MOBILE RESPONSIVENESS
   ============================================================================ */

@media (max-width: 480px) {
    .taimal-chat-fab {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }

    .taimal-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: calc(100vh - 60px);
        max-height: calc(100vh - 60px);
        border-radius: var(--taimal-radius) var(--taimal-radius) 0 0;
    }

    .taimal-persona-selector {
        gap: 4px;
        padding: 8px;
    }

    .persona-btn {
        padding: 6px 12px;
    }

    .persona-name {
        display: none;
    }
}