/* ========================================
   LIVE CHAT WIDGET (TikTok Style)
   ======================================== */

.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    transform: translateY(600px) !important;
    transition: transform 0.3s ease !important;
    animation: none !important;
}

.chat-widget.active {
    transform: translateY(0) !important;
}

.chat-header {
    background: linear-gradient(135deg, var(--secondary-color), #FF6B9D);
    color: var(--white);
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header h3 i {
    font-size: 1.5rem;
}

.chat-close {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #F8F9FA;
}

.chat-message {
    margin-bottom: 15px;
    animation: slideIn 0.3s ease !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    text-align: right;
}

.message-bubble {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 20px;
    max-width: 70%;
    word-wrap: break-word;
}

.chat-message.bot .message-bubble {
    background: var(--white);
    color: var(--text-color);
    border: 2px solid var(--medium-gray);
    text-align: left;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--secondary-color), #FF6B9D);
    color: var(--white);
}

.chat-message.own .message-bubble {
    background: linear-gradient(135deg, var(--secondary-color), #FF6B9D);
    color: var(--white);
}

.chat-message.system {
    text-align: center;
    margin: 10px 0;
}

.system-message {
    background: var(--medium-gray) !important;
    color: var(--text-light) !important;
    font-size: 0.85rem;
    padding: 8px 15px !important;
    display: inline-block;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.85rem;
}

.message-header strong {
    color: var(--primary-color);
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.chat-welcome i {
    font-size: 3rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.chat-welcome p {
    margin: 10px 0;
}

.chat-username {
    background: var(--light-gray);
    padding: 10px;
    border-radius: 10px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.chat-change-name-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: transform 0.2s ease !important;
}

.chat-change-name-btn:hover {
    transform: scale(1.1) !important;
    background: #a00e1f;
}

.chat-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-settings-btn {
    background: transparent;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

.chat-settings-btn:hover {
    transform: scale(1.1) !important;
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff0000;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.chat-header small {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8rem;
    display: block;
    margin-top: 2px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 5px;
    display: block;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--medium-gray);
    background: var(--white);
    border-radius: 0 0 20px 20px;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--medium-gray);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--secondary-color);
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--secondary-color), #FF6B9D);
    color: var(--white);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    transform: scale(1.05) !important;
    transition: transform 0.2s ease !important;
}

.chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--secondary-color), #FF6B9D);
    color: var(--white);
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(206, 17, 38, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease !important;
}

.chat-toggle-btn:hover {
    transform: scale(1.1) !important;
}

.chat-toggle-btn.hidden {
    display: none;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    padding: 10px;
}

.typing-indicator.active {
    display: block;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-light);
    border-radius: 50%;
    animation: typing 1.4s infinite !important;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0) !important;
    }
    30% {
        transform: translateY(-10px) !important;
    }
}

/* ========================================
   NAME ENTRY SCREEN
   ======================================== */

.chat-name-entry {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.name-entry-content {
    text-align: center;
    max-width: 350px;
    width: 100%;
}

.name-entry-icon {
    font-size: 4rem;
    color: var(--secondary-color);
    margin-bottom: 20px;
    animation: pulse 2s infinite !important;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.name-entry-content h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.name-entry-content > p {
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 1rem;
}

.name-entry-form {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    pointer-events: auto !important;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
    pointer-events: auto !important;
}

.form-group label {
    display: block;
    color: var(--text-color);
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 1rem;
}

.form-group label i {
    color: var(--secondary-color);
    margin-right: 5px;
}

.name-input {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--medium-gray);
    border-radius: 10px;
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.3s ease !important;
    animation: none !important;
    pointer-events: auto !important;
    user-select: text !important;
    cursor: text !important;
    background: white !important;
}

.name-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(206, 17, 38, 0.1);
}

.name-hint {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 5px;
}

.name-submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--secondary-color), #FF6B9D);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer !important;
    transition: transform 0.2s ease !important;
    pointer-events: auto !important;
}

.name-submit-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(206, 17, 38, 0.3);
}

.name-submit-btn:active {
    transform: translateY(0) !important;
}

.name-submit-btn i {
    margin-right: 8px;
}

.name-privacy {
    color: var(--text-light);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.name-privacy i {
    color: #28a745;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: calc(100% - 40px);
        height: calc(100% - 40px);
        bottom: 20px;
        right: 20px;
        left: 20px;
        margin: 0 auto;
    }
    
    .chat-toggle-btn {
        right: 20px;
    }
}
