/* Connection Status Styles */
.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    min-width: 100px;
    z-index: 1000;
}

/* Status icon */
.connection-status .status-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
}

/* Connected state - green */
.connection-status.connected {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

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

/* Disconnected state - red */
.connection-status.disconnected {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.connection-status.disconnected .status-icon {
    background-color: #dc3545;
    box-shadow: 0 0 4px rgba(220, 53, 69, 0.5);
}

/* Error state - yellow/orange */
.connection-status.error {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.connection-status.error .status-icon {
    background-color: #ffc107;
    box-shadow: 0 0 4px rgba(255, 193, 7, 0.5);
}

/* Checking state - blue with pulse */
.connection-status.checking {
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.connection-status.checking .status-icon {
    background-color: #17a2b8;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Pulse animation for checking state */
@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Status text */
.connection-status .status-text {
    white-space: nowrap;
    font-size: 11px;
    letter-spacing: 0.3px;
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .connection-status.connected {
        background-color: rgba(40, 167, 69, 0.2);
        border: 1px solid rgba(40, 167, 69, 0.4);
        color: #90ee90;
    }

    .connection-status.disconnected {
        background-color: rgba(220, 53, 69, 0.2);
        border: 1px solid rgba(220, 53, 69, 0.4);
        color: #ffb3b3;
    }

    .connection-status.error {
        background-color: rgba(255, 193, 7, 0.2);
        border: 1px solid rgba(255, 193, 7, 0.4);
        color: #ffe066;
    }

    .connection-status.checking {
        background-color: rgba(23, 162, 184, 0.2);
        border: 1px solid rgba(23, 162, 184, 0.4);
        color: #87ceeb;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .connection-status {
        font-size: 10px;
        padding: 4px 8px;
        min-width: 80px;
    }
    
    .connection-status .status-text {
        font-size: 9px;
    }
    
    .connection-status .status-icon {
        width: 6px;
        height: 6px;
    }
}

/* Integration with existing header styles */
header .connection-status {
    margin-left: auto;
    order: -1; /* Place before other header elements */
}

/* For mobile responsive menu */
@media (max-width: 768px) {
    header .connection-status {
        position: absolute;
        top: 50%;
        right: 120px; /* Position between theme toggle and sidebar toggle */
        transform: translateY(-50%);
        z-index: 1001;
    }
}