/* Widget de chat flottant */

.chat-floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    min-width: 140px;
    height: 50px;
    padding: 0 20px;
    border-radius: 25px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    z-index: 999;
    transition: transform 0.3s, box-shadow 0.3s, width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.chat-floating-button::before {
    content: '💬';
    font-size: 1.3rem;
}

.chat-floating-button::after {
    content: 'Chat';
}

.chat-floating-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 30px rgba(102, 126, 234, 0.7);
}

.chat-floating-button:active {
    transform: translateY(-1px);
}

.chat-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    border: 2px solid white;
    animation: bounce 0.5s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.chat-badge:empty {
    display: none;
}

.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: #1a1b26;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-widget.open {
    display: flex;
}

.chat-widget.minimized {
    height: 60px;
}

.chat-widget.minimized .chat-widget-body,
.chat-widget.minimized .chat-widget-footer,
.chat-widget.minimized .chat-char-counter {
    display: none;
}

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

.chat-widget-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    user-select: none;
}

.chat-widget-header:active {
    cursor: grabbing;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-icon {
    font-size: 1.3rem;
}

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

.online-indicator {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.chat-header-buttons {
    display: flex;
    gap: 8px;
}

.chat-btn-reset,
.chat-btn-minimize,
.chat-btn-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.chat-btn-reset:hover,
.chat-btn-minimize:hover,
.chat-btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-btn-reset:active,
.chat-btn-minimize:active,
.chat-btn-close:active {
    transform: scale(0.95);
}

.chat-btn-reset {
    font-size: 1.3rem;
}

.chat-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-rules-mini {
    background: rgba(239, 68, 68, 0.1);
    padding: 8px 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-chat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
}

.chat-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: fadeIn 0.3s;
}

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

.chat-message.own-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.message-content {
    flex: 1;
    max-width: 70%;
}

.own-message .message-content {
    text-align: right;
}

.message-header {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 4px;
}

.own-message .message-header {
    justify-content: flex-end;
}

.message-author {
    font-weight: 600;
    font-size: 0.8rem;
    color: #e0e0e0;
}

.message-time {
    font-size: 0.7rem;
    color: #888;
}

.admin-delete-msg,
.admin-mute-user {
    margin-left: 8px;
    padding: 2px 6px;
    background: rgba(255, 59, 48, 0.2);
    border: 1px solid rgba(255, 59, 48, 0.5);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.admin-mute-user {
    background: rgba(255, 159, 10, 0.2);
    border-color: rgba(255, 159, 10, 0.5);
}

.admin-delete-msg:hover {
    background: rgba(255, 59, 48, 0.4);
    transform: scale(1.1);
}

.admin-mute-user:hover {
    background: rgba(255, 159, 10, 0.4);
    transform: scale(1.1);
}

.message-text {
    background: #0d0e14;
    padding: 8px 12px;
    border-radius: 12px;
    word-wrap: break-word;
    color: #e0e0e0;
    line-height: 1.4;
    font-size: 0.9rem;
}

.own-message .message-text {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.chat-widget-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    display: flex;
    gap: 8px;
    background: #16171f;
}

.chat-input {
    flex: 1;
    background: #0d0e14;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    max-height: 80px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.btn-send-message {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.btn-send-message:hover {
    transform: scale(1.1);
}

.btn-send-message:active {
    transform: scale(0.95);
}

.chat-char-counter {
    position: absolute;
    bottom: 55px;
    right: 60px;
    font-size: 0.7rem;
    color: #888;
    background: #1a1b26;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget {
        width: calc(100% - 20px);
        right: 10px;
        bottom: 80px;
        height: 500px;
    }
    
    .chat-floating-button {
        min-width: 120px;
        height: 45px;
        padding: 0 15px;
        bottom: 15px;
        right: 15px;
        font-size: 0.9rem;
    }
    
    .chat-floating-button::before {
        font-size: 1.1rem;
    }
}

@media (max-width: 480px) {
    .chat-widget {
        height: calc(100vh - 100px);
        bottom: 10px;
    }
    
    .chat-floating-button::after {
        content: '';
    }
    
    .chat-floating-button {
        min-width: 50px;
        padding: 0 12px;
    }
}
