
.chat-btn {
    position: fixed;
    bottom: 130px; 
    right: 60px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #00eeff 0%, #3eb8ff 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 247, 255, 0.4);
    z-index: 1001;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.discord-btn {
    position: fixed;
    bottom: 40px;
    right: 20px;       
    left: auto;        
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #7289da, #5b6eae);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(114, 137, 218, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 212, 170, 0.6);
    background: linear-gradient(135deg, #00b894 0%, #00d4aa 100%);
}

.chat-btn.is-open {
    background: #21683f;
    box-shadow: 0 10px 30px rgba(11, 116, 222, 0.5);
}

.chat-btn.is-open i {
    font-size: 22px;
}

.discord-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 12px 40px rgba(114, 137, 218, 0.6);
    background: linear-gradient(135deg, #5b6eae 0%, #7289da 100%);
}

.chat-btn i, .discord-btn i {
    color: white;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.chat-btn:hover i, .discord-btn:hover i {
    transform: scale(1.1);
}


.chat-live-indicator {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    background: #2ecc71;
    border-radius: 50%;
    border: 2px solid white;
    animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}


.modal.chat-modal-container {
    position: fixed;
    /* Ensure the chat modal anchors above the chat button, not the page top-left */
    top: 100px;        /* override any global .modal { top: 0 } */
    left: auto;       /* override any global .modal { left: 0 } */
    bottom: calc(150px + 60px + 16px); /* chat button bottom + size + gap */
    right: 115px;      /* align horizontally with the chat button */
    width: 400px;
    height: 700px;
    background: transparent;
    backdrop-filter: none;
    z-index: 1002;
}

.modal-content.chat-modal {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 2px solid #00d4aa;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    width: 100%;
    height: 100%;
    margin: 0; 
    overflow: hidden;
    backdrop-filter: blur(25px);
    animation: slide-up-in 180ms ease-out;
}

@keyframes slide-up-in {
    from { transform: translateY(8px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}


.chat-modal .modal-header {
    background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    padding: 15px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.chat-modal .modal-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-modal .modal-header h3::after {
    content: '';
    width: 10px;
    height: 10px;
    background: #2ecc71;
    border-radius: 50%;
    animation: pulse 2s infinite;
    margin-left: 10px;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.6);
}


.chat-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1a2e;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    padding: 25px;
    overflow-y: auto;
    background: linear-gradient(145deg, #1a1a2e, #0f0f23);
    position: relative;
}

.chat-modal .modal-body {
    height: calc(100% - 70px);
    padding: 0;
}


.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    margin: 5px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border-radius: 4px;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00b894, #009688);
}


.chat-message {
    margin-bottom: 25px;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-message.new-message {
    animation: slideInMessage 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    opacity: 0.9;
}

.chat-message.user .chat-message-header {
    flex-direction: row-reverse;
}

.chat-sender {
    font-weight: 700;
    color: #00d4aa;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.chat-message.admin .chat-sender {
    color: #ff6b6b;
}

.chat-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    font-weight: 500;
}


.chat-text {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: white;
    padding: 16px 22px;
    border-radius: 25px;
    display: inline-block;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.6;
    position: relative;
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.4);
    font-size: 15px;
    font-weight: 500;
}

.chat-message.admin .chat-text {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}



.chat-messages .chat-message.admin-note,
.chat-message.admin-note {
    background: transparent !important;
    border: none !important;
    margin: 0.5rem 0 !important;
    padding: 0.5rem !important;
    text-align: center !important;
    box-shadow: none !important;
}

.chat-messages .chat-message.admin-note .chat-text,
.chat-message.admin-note .chat-text {
    background: transparent !important;
    color: #808080 !important;
    font-style: italic !important;
    font-size: 0.9rem !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    display: block !important;
    max-width: 100% !important;
    margin: 0 !important;
}

.chat-messages .chat-message.admin-note .chat-sender,
.chat-message.admin-note .chat-sender {
    color: #808080 !important;
    font-size: 0.8rem !important;
}


.chat-image-container {
    position: relative;
    margin: 12px 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    max-width: 320px;
    transition: transform 0.3s ease;
}

.chat-image-container:hover {
    transform: translateY(-2px);
}

.chat-image {
    width: 100%;
    height: auto;
    max-height: 250px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s ease;
    border-radius: 20px;
}

.chat-image:hover {
    transform: scale(1.02);
}

.chat-image-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    padding: 12px 18px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-weight: 600;
}

.chat-image-container:hover .chat-image-overlay {
    opacity: 1;
}

.chat-message.user .chat-image-container {
    margin-left: auto;
}

.chat-message.admin .chat-image-container {
    margin-right: auto;
}


.chat-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 8px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
}

.status-dot.sending {
    background: #f39c12;
    box-shadow: 0 0 8px rgba(243, 156, 18, 0.6);
}

.status-dot.delivered {
    background: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.6);
}

.status-dot.read {
    background: #2ecc71;
    box-shadow: 0 0 8px rgba(46, 204, 113, 0.6);
}


.chat-input-container {
    padding: 25px 30px;
    background: linear-gradient(145deg, #16213e, #1a1a2e);
    border-top: 1px solid rgba(0, 212, 170, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
}

.image-btn {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
    font-size: 18px;
}

.image-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.6);
}

#chatMessageInput {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(0, 212, 170, 0.3);
    color: white;
    padding: 16px 22px;
    border-radius: 30px;
    outline: none;
    font-size: 15px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-weight: 500;
}

#chatMessageInput:focus {
    border-color: #00d4aa;
    box-shadow: 0 0 0 4px rgba(0, 212, 170, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

#chatMessageInput::placeholder {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.send-btn {
    background: linear-gradient(135deg, #00d4aa, #00b894);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(0, 212, 170, 0.4);
    font-size: 18px;
}

.send-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 170, 0.6);
    background: linear-gradient(135deg, #00b894, #009688);
}

.send-btn:active {
    transform: scale(0.95);
}


.delete-message-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
    font-weight: 500;
}

.delete-message-btn:hover {
    background: rgba(255, 82, 82, 0.9);
    color: white;
    border-color: rgba(255, 82, 82, 0.5);
    transform: translateY(-1px);
}


.admin-chat-messages {
    background: linear-gradient(145deg, #1a1a2e, #0f0f23);
    border-radius: 20px;
    padding: 25px;
    min-height: 450px;
    max-height: 550px;
    overflow-y: auto;
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.admin-chat-input-container {
    background: linear-gradient(145deg, #16213e, #1a1a2e);
    border-radius: 30px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.conversation-item {
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(8px);
    border-left-color: #00d4aa;
}

.conversation-item.active {
    background: rgba(0, 212, 170, 0.2);
    border-left-color: #00d4aa;
    border-color: rgba(0, 212, 170, 0.3);
}

.conversation-item.unread {
    border-left-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
    border-color: rgba(243, 156, 18, 0.3);
}

.unread-badge {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}


.file-upload-container {
    position: relative;
    display: inline-block;
}

.file-upload-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    font-size: 18px;
}

.file-upload-btn:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}


@media (max-width: 768px) {
    .chat-btn, .discord-btn {
        width: 55px;
        height: 55px;
        bottom: 15px;
    }
    
    .chat-btn {
        bottom: 85px;
    }
    
    .discord-btn {
        bottom: 15px;
    }
    
    .chat-btn i, .discord-btn i {
        font-size: 22px;
    }
    
    .modal.chat-modal-container {
        top: 80px;
        right: 12px;
        width: calc(100vw - 24px);
        height: 66vh;
        bottom: calc(85px + 55px + 12px);
    }
    .modal-content.chat-modal {
        border-radius: 14px;
    }
    
    .chat-container { height: 100%; }
    
    .chat-messages { padding: 20px; }
    
    .chat-input-container {
        padding: 20px 25px;
    }
    
    #chatMessageInput {
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .image-btn, .send-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}


.new-message-highlight {
    animation: highlightNewMessage 3s ease-out;
}

@keyframes highlightNewMessage {
    0% {
        background: rgba(0, 212, 170, 0.3);
        transform: scale(1.02);
    }
    50% {
        background: rgba(0, 212, 170, 0.2);
        transform: scale(1.01);
    }
    100% {
        background: rgba(255, 255, 255, 0.05);
        transform: scale(1);
    }
}


.live-indicator {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    display: inline-block;
    animation: pulse 2s infinite;
    margin-left: 8px;
}

.chat-live-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-left: 10px;
}