/* Socket.IO Chat Styles */

/* Messaging Header - sticky with high z-index */
[data-controller="socket-chat"] .barracks-header-panel {
    position: sticky;
    top: 0;
    z-index: 1020;
}

/* Header dropdown positioning */
[data-controller="socket-chat"] .barracks-header-panel .dropdown {
    position: relative;
}

/* Header dropdown z-index fix */
[data-controller="socket-chat"] .barracks-header-panel .dropdown-menu {
    z-index: 1051;
    position: absolute;
}

/* Typing indicator in header */
.typing-indicator-text {
    color: #28a745 !important;
    font-style: italic;
}

.typing-indicator-text i {
    font-size: 10px;
}

/* WhatsApp-style Message Bubbles */
.message-item {
    display: flex;
    margin-bottom: 8px;
    animation: slideIn 0.2s ease-out;
}

.message-item.message-sent {
    justify-content: flex-end;
}

.message-item.message-received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
}

.message-sent .message-bubble {
    background-color: #dcf8c6;
    color: #000;
    border-bottom-right-radius: 2px;
}

.message-received .message-bubble {
    background-color: #fff;
    color: #000;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-content {
    word-wrap: break-word;
    margin-bottom: 2px;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #667781;
    margin-top: 2px;
}

.message-time {
    font-size: 11px;
}

.message-status {
    display: inline-flex;
    align-items: center;
}

.message-status i {
    font-size: 14px;
}

/* Pending message (sending) */
.message-pending .message-bubble {
    opacity: 0.7;
}

.message-pending .message-status i {
    animation: pulse 1s infinite;
}

/* Connection status indicator */
.connection-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.connection-indicator.connected {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.connection-indicator.disconnected {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.connection-indicator.error {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

/* Online status indicator */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.status-indicator.online {
    background-color: #28a745;
    box-shadow: 0 0 4px rgba(40, 167, 69, 0.5);
}

.status-indicator.offline {
    background-color: #6c757d;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    font-size: 0.875rem;
    color: #6c757d;
}

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

.typing-indicator .dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: #6c757d;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

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

.message-item.new {
    animation: slideIn 0.3s ease-out;
}

/* Pulse animation for new messages */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

.message-item.highlighted {
    animation: pulse 0.6s;
}

/* SweetAlert2 Dark Mode */
.swal2-popup.dark-popup {
    background-color: #1a1a1a !important;
    border: 1px solid #444 !important;
}

.swal2-popup.dark-popup .swal2-title {
    color: #ffffff !important;
}

.swal2-popup.dark-popup .swal2-html-container {
    color: #e0e0e0 !important;
}

.swal2-popup.dark-popup .swal2-icon.swal2-warning {
    border-color: #ffc107 !important;
    color: #ffc107 !important;
}

.swal2-popup.dark-popup .swal2-icon.swal2-warning [class^='swal2-icon-content'] {
    color: #ffc107 !important;
}
