/* ============================================
   Live Chat System - Stylesheet
   ============================================ */

/* Chat Widget Button */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
}

.chat-widget-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s ease;
    position: relative;
    font-size: 1.5rem;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.6);
}

.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--bg-dark);
}

/* Chat Modal */
.chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.chat-modal.active {
    display: flex;
}

.chat-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.chat-modal-content {
    position: relative;
    z-index: 10001;
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-modal-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 0;
}

.chat-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.chat-modal-close:hover {
    color: var(--text-primary);
}

.chat-start-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.chat-start-form .form-group {
    display: flex;
    flex-direction: column;
}

.chat-start-form label {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.chat-start-form input {
    padding: 0.875rem;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-start-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Chat Interface */
.chat-interface-container {
    position: relative;
    z-index: 10001;
    background: var(--bg-card);
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    height: 80vh;
    max-height: 700px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.chat-interface-header {
    background: var(--bg-darker);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.chat-header-info h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.chat-status {
    font-size: 0.875rem;
    color: var(--accent-color);
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--bg-dark);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100%;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlide 0.3s ease;
    max-width: 80%;
}

@keyframes messageSlide {
    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.admin {
    align-self: flex-start;
}

.chat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
}

.chat-message.user .chat-message-avatar {
    background: var(--gradient-1);
    color: white;
}

.chat-message.admin .chat-message-avatar {
    background: var(--gradient-3);
    color: white;
}

.chat-message-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-message-bubble {
    padding: 0.875rem 1.25rem;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message.user .chat-message-bubble {
    background: var(--gradient-1);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.admin .chat-message-bubble {
    background: var(--bg-darker);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.chat-message-image {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 0.5rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.chat-message-image:hover {
    transform: scale(1.02);
}

.chat-message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0 0.5rem;
}

.chat-message.user .chat-message-time {
    text-align: right;
}

.chat-input-container {
    padding: 1rem;
    background: var(--bg-darker);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 0.5rem 1rem;
}

.chat-emoji-btn,
.chat-image-btn,
.chat-send-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-emoji-btn:hover,
.chat-image-btn:hover {
    color: var(--accent-color);
}

.chat-send-btn {
    color: var(--primary-color);
}

.chat-send-btn:hover {
    color: var(--primary-light);
    transform: scale(1.1);
}

.chat-image-btn {
    position: relative;
}

#chatImageInput {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

#chatMessageInput {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    padding: 0.5rem 0;
    outline: none;
}

#chatMessageInput::placeholder {
    color: var(--text-secondary);
}

/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 80px;
    right: 30px;
    width: 300px;
    max-height: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    overflow: hidden;
}

.emoji-picker-content {
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
}

.emoji-item {
    font-size: 1.5rem;
    padding: 0.5rem;
    cursor: pointer;
    text-align: center;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.emoji-item:hover {
    background: var(--bg-darker);
}

/* System Message */
.chat-system-message {
    text-align: center;
    padding: 1rem;
    margin: 1rem 0;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.chat-system-message i {
    color: var(--accent-color);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.875rem 1.25rem;
    background: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-widget-button {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }
    
    .chat-interface-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chat-modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .emoji-picker {
        width: 280px;
        right: 10px;
    }
}

