/*
 * WebSocket Base CSS - Core styling for WebSocket widgets
 * Base styles for the modular WebSocket system
 * Compatible with ALMUS MES design system
 */


.websocket-widget {
    position: relative;
    font-family: inherit;
}

.websocket-integration-widget {
    margin-bottom: 10px;
}


.websocket-connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 10px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6c757d;
    transition: background-color 0.3s ease;
}

.status-indicator.status-connected {
    background-color: #28a745;
    animation: pulse-green 2s infinite;
}

.status-indicator.status-disconnected {
    background-color: #dc3545;
}

.status-indicator.status-error {
    background-color: #ffc107;
    animation: pulse-yellow 1s infinite;
}

.status-text {
    color: #495057;
    font-weight: 500;
}

.connection-details {
    color: #6c757d;
    margin-left: auto;
}


.websocket-debug-panel {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 11px;
}

.websocket-debug-panel .debug-header {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 8px 12px;
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    border-radius: 6px 6px 0 0;
}

.websocket-debug-panel .debug-header strong {
    color: #495057;
    font-size: 12px;
}

.websocket-debug-panel .toggle-debug {
    padding: 2px 8px;
    font-size: 10px;
    border: none;
    background: none;
    color: #007bff;
    cursor: pointer;
    margin-left: auto;
}

.websocket-debug-panel .debug-content {
    padding: 12px;
}

.websocket-debug-panel .debug-section {
    margin-bottom: 15px;
}

.websocket-debug-panel .debug-section:last-child {
    margin-bottom: 0;
}

.websocket-debug-panel .debug-section h6 {
    margin: 0 0 8px 0;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.websocket-debug-panel pre {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 8px;
    margin: 0;
    font-size: 10px;
    line-height: 1.4;
    max-height: 150px;
    overflow-y: auto;
}

.websocket-debug-panel .connection-status {
    display: flex;
    gap: 15px;
    align-items: center;
}

.websocket-debug-panel .integration-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.websocket-debug-panel .integration-list li {
    padding: 3px 0;
    color: #6c757d;
}

.websocket-debug-panel .message-log {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 8px;
    font-family: 'Courier New', monospace;
    line-height: 1.3;
}

.websocket-debug-panel .log-entry {
    margin-bottom: 2px;
    word-break: break-all;
}

.websocket-debug-panel .log-entry .timestamp {
    color: #6c757d;
    margin-right: 8px;
}

.websocket-debug-panel .log-entry.log-error .message {
    color: #dc3545;
}

.websocket-debug-panel .log-entry.log-warn .message {
    color: #ffc107;
}

.websocket-debug-panel .log-entry.log-info .message {
    color: #17a2b8;
}


@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    50% {
        opacity: 0.8;
        box-shadow: 0 0 0 4px rgba(40, 167, 69, 0);
    }
}

@keyframes pulse-yellow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}


.websocket-integration-widget {
    position: relative;
}

.users-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.user-item {
    padding: 4px 8px;
    background-color: rgba(0, 123, 255, 0.1);
    border: 1px solid rgba(0, 123, 255, 0.2);
    border-radius: 12px;
    font-size: 12px;
    color: #495057;
}

.user-item.current-user {
    background-color: rgba(40, 167, 69, 0.1);
    border-color: rgba(40, 167, 69, 0.3);
    font-weight: 600;
    color: #28a745;
}

.connection-status {
    font-size: 11px;
    color: #6c757d;
    font-style: italic;
}


@media (max-width: 768px) {
    .websocket-connection-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .connection-details {
        margin-left: 0;
        font-size: 10px;
    }

    .users-list {
        flex-direction: column;
        gap: 4px;
    }

    .websocket-debug-panel {
        font-size: 10px;
    }

    .websocket-debug-panel pre {
        font-size: 9px;
    }
}


.websocket-widget:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    /* Fixed: Use scoped selectors instead of global * selector */
    .websocket-widget * {
        animation: none !important;
        transition: none !important;
    }

    .status-indicator {
        animation: none !important;
        transition: none !important;
    }
}


@media print {
    .websocket-widget,
    .websocket-debug-panel,
    .websocket-connection-status {
        display: none !important;
    }
}

.websocket-hidden {
    display: none !important;
}

.websocket-disabled {
    pointer-events: none;
    opacity: 0.6;
}

.websocket-loading {
    position: relative;
}

.websocket-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.skin-almus .websocket-widget {
    /* Integration with ALMUS theme - using default styling */
    color: inherit;
}

.skin-almus .status-indicator.status-connected {
    background-color: #fdca00; /* ALMUS yellow accent */
}

.skin-almus .user-item.current-user {
    background-color: rgba(253, 202, 0, 0.1);
    border-color: rgba(253, 202, 0, 0.3);
    color: #112E5D; /* ALMUS dark blue */
}