/**
 * CODDB Online Users System - Styles
 * CSS for online user display components
 */

/* ===== ONLINE USERS LIST ===== */
.online-users-container {
    background: var(--bg-secondary, #2a2a2a);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.online-users-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #444);
}

.online-users-title {
    font-weight: 600;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-count {
    background: var(--accent-color, #00d4aa);
    color: var(--bg-primary, #1a1a1a);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.online-users-list {
    max-height: 300px;
    overflow-y: auto;
}

.online-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.online-user:hover {
    background: var(--bg-hover, rgba(255, 255, 255, 0.05));
}

/* ===== USER AVATAR ===== */
.user-avatar {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color, #444);
}

.status-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--bg-secondary, #2a2a2a);
}

.status-online {
    background: #4ade80; /* Green */
}

.status-away {
    background: #facc15; /* Yellow */
}

.status-busy {
    background: #ef4444; /* Red */
}

.status-invisible,
.status-offline {
    background: #6b7280; /* Gray */
}

/* ===== USER INFO ===== */
.user-info {
    flex: 1;
    min-width: 0;
}

.username {
    display: block;
    font-weight: 500;
    color: var(--text-primary, #ffffff);
    font-size: 13px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text {
    display: block;
    color: var(--text-secondary, #a0a0a0);
    font-size: 11px;
    line-height: 1.2;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.last-seen {
    display: block;
    color: var(--text-muted, #777);
    font-size: 10px;
    line-height: 1.2;
    margin-top: 1px;
}

/* ===== TYPING INDICATORS ===== */
.typing-indicators {
    background: var(--bg-secondary, #2a2a2a);
    border-radius: 6px;
    padding: 8px 12px;
    margin: 8px 0;
    border-left: 3px solid var(--accent-color, #00d4aa);
    display: none;
}

.typing-text {
    color: var(--text-secondary, #a0a0a0);
    font-size: 12px;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

.typing-indicator {
    color: var(--accent-color, #00d4aa);
    font-size: 11px;
    font-style: italic;
    margin-left: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ===== ONLINE STATUS IN CHANNELS ===== */
.channel-item .online-count {
    margin-left: auto;
    background: var(--bg-tertiary, #3a3a3a);
    color: var(--text-secondary, #a0a0a0);
    font-size: 11px;
    padding: 1px 6px;
}

.channel-item.active .online-count {
    background: var(--accent-color, #00d4aa);
    color: var(--bg-primary, #1a1a1a);
}

/* ===== COMPACT MODE ===== */
.online-users-compact .online-user {
    padding: 4px 8px;
}

.online-users-compact .user-avatar {
    width: 24px;
    height: 24px;
}

.online-users-compact .status-indicator {
    width: 8px;
    height: 8px;
}

.online-users-compact .username {
    font-size: 12px;
}

.online-users-compact .status-text,
.online-users-compact .last-seen {
    font-size: 10px;
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .online-users-container {
        padding: 8px;
    }
    
    .online-user {
        padding: 6px;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .username {
        font-size: 12px;
    }
    
    .status-text,
    .last-seen {
        font-size: 10px;
    }
}

/* ===== EMPTY STATE ===== */
.online-users-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted, #777);
    font-size: 12px;
}

.online-users-empty::before {
    content: "👥";
    display: block;
    font-size: 24px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* ===== LOADING STATE ===== */
.online-users-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-secondary, #a0a0a0);
    font-size: 12px;
}

.online-users-loading::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color, #444);
    border-top: 2px solid var(--accent-color, #00d4aa);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== ADMIN INDICATORS ===== */
.online-user[data-role="admin"] .username::after {
    content: "👑";
    margin-left: 4px;
    font-size: 10px;
}

.online-user[data-role="moderator"] .username::after {
    content: "🛡️";
    margin-left: 4px;
    font-size: 10px;
}

/* ===== ACTIVITY INDICATORS ===== */
.user-activity {
    font-size: 10px;
    color: var(--text-muted, #777);
    margin-top: 2px;
}

.user-activity.active {
    color: var(--accent-color, #00d4aa);
}

/* ===== DARK MODE OVERRIDES ===== */
[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --bg-hover: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #666666;
    --border-color: #333333;
    --accent-color: #00d4aa;
}

/* ===== LIGHT MODE OVERRIDES ===== */
[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --bg-hover: rgba(0, 0, 0, 0.05);
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --accent-color: #0d6efd;
}

/* ===== ACCESSIBILITY ===== */
.online-user:focus {
    outline: 2px solid var(--accent-color, #00d4aa);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .typing-text,
    .typing-indicator,
    .online-users-loading::before {
        animation: none;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .status-indicator {
        border-width: 3px;
    }
    
    .online-count {
        border: 1px solid currentColor;
    }
}
