/* Active Users Display Styling */

/* Header positioning */
.logo-section .active-users-display-header {
    margin-left: auto; /* Push to the right side of logo section */
}

.active-users-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--color-background, #f3f4f6);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 20px;
    font-size: 14px;
    transition: all 0.3s ease;
    user-select: none;
}

.active-users-container.connected {
    opacity: 1;
}

.active-users-container.disconnected {
    opacity: 0.5;
}

.active-users-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Pulse Indicator */
.pulse-indicator {
    width: 8px;
    height: 8px;
    background-color: #10b981; /* Green */
    border-radius: 50%;
    position: relative;
}

.pulse-indicator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    background-color: inherit;
    border-radius: 50%;
    animation: pulse 2s ease-out infinite;
}

/* Pulse animation speeds */
.pulse-indicator.pulse-fast::before {
    animation: pulse 1s ease-out infinite;
}

.pulse-indicator.pulse-medium::before {
    animation: pulse 1.5s ease-out infinite;
}

.pulse-indicator.pulse-slow::before {
    animation: pulse 2.5s ease-out infinite;
}

.pulse-indicator.pulse-none {
    background-color: #9ca3af; /* Gray */
}

.pulse-indicator.pulse-none::before {
    animation: none;
}

@keyframes pulse {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.5);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2);
    }
}

/* User Count */
.user-count {
    font-weight: 600;
    color: var(--color-text, #1f2937);
    min-width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.user-count.updating {
    transform: scale(1.1);
}

/* User Label */
.user-label {
    color: var(--color-text-secondary, #6b7280);
    font-size: 13px;
    white-space: nowrap;
}

/* Breakdown Display */
.users-breakdown {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border, #e5e7eb);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 0;
}

.page-name {
    color: var(--color-text-secondary, #6b7280);
}

.page-count {
    font-weight: 600;
    color: var(--color-text, #1f2937);
    background: var(--color-surface, #f9fafb);
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

.no-activity {
    font-size: 12px;
    color: var(--color-text-secondary, #9ca3af);
    margin: 0;
    padding: 4px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .active-users-container {
        font-size: 12px;
        padding: 4px 10px;
        gap: 6px;
    }

    .user-label {
        display: none; /* Hide label on mobile to save space */
    }

    .active-users-content {
        gap: 4px;
    }

    .pulse-indicator {
        width: 6px;
        height: 6px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .active-users-container {
        background: var(--color-background-dark, #1f2937);
        border-color: var(--color-border-dark, #374151);
    }

    .user-count {
        color: var(--color-text-dark, #f9fafb);
    }

    .user-label {
        color: var(--color-text-secondary-dark, #9ca3af);
    }

    .page-count {
        background: var(--color-surface-dark, #374151);
        color: var(--color-text-dark, #f9fafb);
    }
}

/* Theme-specific colors (integrate with existing theme system) */
[data-theme="dark"] .active-users-container {
    background: var(--color-background, #1f2937);
    border-color: var(--color-border, #374151);
}

[data-theme="dark"] .user-count {
    color: var(--color-text, #f9fafb);
}

[data-theme="dark"] .user-label {
    color: var(--color-text-secondary, #9ca3af);
}

[data-theme="dark"] .page-count {
    background: var(--color-surface, #374151);
    color: var(--color-text, #f9fafb);
}

/* Colorblind-friendly themes */
[data-theme="colorblind"] .pulse-indicator,
[data-theme="colorblind-dark"] .pulse-indicator {
    /* Use high-contrast colors for colorblind mode */
    background-color: #2563eb; /* Blue instead of green */
}

/* Halloween theme integration */
[data-theme="halloween"] .active-users-container {
    background: #1a0f2e;
    border-color: #ff6b35;
}

[data-theme="halloween"] .pulse-indicator {
    background-color: #ff6b35; /* Orange pulse */
}

[data-theme="halloween"] .user-count {
    color: #ff6b35;
}

[data-theme="halloween"] .user-label {
    color: #b794f6;
}

/* Hover effect */
.active-users-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Animation for first load */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.active-users-container {
    animation: slideIn 0.5s ease-out;
}
