/* public/css/community.css */
/* Styles for the Community channel panel */

#channel-community .channel-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--color-channel-content-bg); /* Secondary color group */
    /* Inset contour (inner border) using tertiary color - rounded corners like site */
    box-shadow: inset 0 0 0 2px var(--color-tertiary, #374151);
    border-radius: 0.375rem;
    overflow: hidden;
}

.community-layout {
    display: flex;
    flex-direction: column;
}

#community-editor-container {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--color-tertiary); /* Tertiary color group */
    border: 1px solid var(--color-border-secondary);
    border-radius: 0.375rem;
    /* Inset contour (inner border) using tertiary color - rounded corners like site */
    box-shadow: inset 0 0 0 2px var(--color-tertiary, #374151);
}

/* === Unified Banner Styling - Matches ai-tools-banner 3D effect === */
/* Applied to community tabs, daily header, achievements header */
#community-editor-tabs,
#daily-header,
#achievements-header {
    /* 3D gradient background matching ai-tools-banner */
    background: linear-gradient(180deg, 
        var(--color-accent-highlight-2) 0%, 
        color-mix(in srgb, var(--color-accent-highlight-2) 60%, var(--color-windows-bg)) 50%, 
        color-mix(in srgb, var(--color-accent-highlight-2) 40%, var(--color-channel-content-bg)) 100%);
    /* 3D border effect - multi-layer shadow contour - highlight-2 border */
    border: 1px solid var(--color-accent-highlight-2);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 0 8px color-mix(in srgb, var(--color-accent-highlight-2) 30%, transparent);
    transition: filter 0.2s ease, box-shadow 0.2s ease;
}

#community-editor-tabs:hover,
#daily-header:hover,
#achievements-header:hover {
    filter: brightness(1.1);
    box-shadow: 
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2),
        0 3px 6px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(0, 0, 0, 0.4),
        0 0 12px color-mix(in srgb, var(--color-accent-highlight-2) 40%, transparent);
}

/* === Community Editor Tabs === */
#community-editor-tabs {
    display: flex;
    flex-shrink: 0;
    justify-content: center;
    /* Square top corners */
    border-radius: 0 0 0 0;
}

.community-editor-tab {
    padding: 0.5rem 1.5rem;
    background-color: transparent;
    color: rgba(255,255,255,0.8);
    border: none;
    border-bottom: none;
    font-family: 'Bungee Inline', cursive;
    font-size: 0.75rem;
    letter-spacing: 0.8px;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.community-editor-tab:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

.community-editor-tab.active {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    background: linear-gradient(to bottom, 
        rgba(255,255,255,0.25) 0%, 
        rgba(255,255,255,0.15) 50%, 
        rgba(0,0,0,0.05) 100%);
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.3),
        0 -2px 4px rgba(0,0,0,0.2);
}

#community-editor-title-banner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.25rem 0.5rem;
    min-height: 2rem;
    background: linear-gradient(to bottom, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.1) 100%);
    border-bottom: 1px solid rgba(0,0,0,0.2);
}

.community-title-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, rgba(168,85,247,0.3) 0%, rgba(139,92,246,0.2) 100%);
    border: 1px solid rgba(168,85,247,0.5);
    border-radius: 0.375rem;
    color: #c084fc;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.community-title-btn:hover {
    background: linear-gradient(135deg, rgba(168,85,247,0.5) 0%, rgba(139,92,246,0.4) 100%);
    border-color: rgba(168,85,247,0.8);
    color: #e9d5ff;
    transform: scale(1.05);
}

#community-editor-content {
    flex-grow: 1;
    min-height: 0;
    position: relative;
}

.community-editor-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden by default */
    flex-direction: column;
    overflow: hidden !important;
    background-color: var(--color-background-windows);
}

.community-editor-panel.active {
    display: flex;
}

/* Table container for scrolling content */
#community-search-container,
#community-leaderboards-container {
    overflow-y: auto;
    max-height: 100%;
    height: 100%;
}

/* Table headers stay sticky when scrolling with BLACK opaque background */
.community-users-table-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
}

.community-users-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: rgba(0, 0, 0, 1) !important;
    opacity: 1 !important;
}

/* Search Panel */
#community-search-panel {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
}

#community-search-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

/* Leaderboards Panel */
#community-leaderboards-panel {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0.5rem;
    background-color: var(--color-windows-bg); /* Secondary color group */
}

/* Leaderboard inner content - always near-black */
#leaderboard-content {
    background-color: rgba(0, 0, 0, 0.95);
}

/* Leaderboard boxes - always near-black */
#leaderboard-content .bg-gray-900\/50,
#leaderboard-content > .space-y-2 > div {
    background-color: rgba(10, 10, 10, 0.95) !important;
}

#community-leaderboards-container {
    width: 100%;
    max-width: 800px;
}

.coming-soon-message {
    text-align: center;
    color: var(--color-text-secondary, #9ca3af);
    font-size: 1.25rem;
    font-weight: 600;
    padding: 2rem;
    background: rgba(255,255,255,0.05);
    border-radius: 0.5rem;
    border: 1px dashed var(--color-border-secondary, #4b5563);
}

/* Community Users Table Styles */
.community-users-section {
    width: 100%;
}

.community-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--color-tertiary, #374151);
    border-radius: 0.375rem;
}

.community-users-title {
    font-family: 'Bungee Inline', cursive;
    font-size: 1rem;
    color: var(--color-text-title, #fff);
}

.community-users-table-wrapper {
    overflow-x: auto;
}

.community-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.community-users-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-family: 'Bungee Inline', cursive;
    font-size: 0.7rem;
    color: var(--color-text-title, #fff);
    background: var(--color-tertiary, #374151);
    border-bottom: 2px solid var(--color-border-secondary, #4b5563);
    white-space: nowrap;
}

.community-users-table td {
    padding: 0.75rem 1rem;
    color: var(--color-text-main, #e5e7eb);
    border-bottom: 1px solid var(--color-border-secondary, #4b5563);
}

.community-users-table tr:hover td {
    background: rgba(255,255,255,0.05);
}

.community-user-cell {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.community-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.community-user-name {
    font-weight: 600;
    color: var(--color-text-main, #fff);
}

.community-user-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-text-secondary, #9ca3af);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background: #10b981;
}

.status-indicator.offline {
    background: #6b7280;
}

.status-indicator.live {
    background: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========== Community Search Panel Styles ========== */

#community-search-panel {
    flex-direction: column;
    align-items: stretch;
    padding: 0.5rem;
    height: 100%;
    overflow: hidden;
    background-color: var(--color-channel-content-bg, var(--color-windows-bg)); /* Secondary color group */
}

#community-search-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    overflow: hidden;
    background-color: var(--color-channel-content-bg, var(--color-windows-bg)); /* Secondary color group */
}

/* Filter Buttons Row */
#community-users-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px;
}

.community-filter-btn {
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.65rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.community-filter-btn[data-filter="all"] {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    color: #fff;
    border-color: rgba(168, 85, 247, 0.6);
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

.community-filter-btn[data-filter="live"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.community-filter-btn[data-filter="online"],
.community-filter-btn[data-filter="around"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.4);
    color: #3b82f6;
}

.community-filter-btn[data-filter="away"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
}

.community-filter-btn[data-filter="offline"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(107, 114, 128, 0.4);
    color: #6b7280;
}

.community-filter-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
}

.community-filter-btn.active {
    filter: brightness(1.3);
    box-shadow: 0 0 12px currentColor;
}

/* Action Buttons */
#randomize-community-users-btn,
#refresh-community-users-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

#randomize-community-users-btn {
    background: rgba(0, 0, 0, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--color-text-secondary, #9ca3af);
}

#randomize-community-users-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

#refresh-community-users-btn {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    color: #fff;
    border-color: rgba(168, 85, 247, 0.6);
}

#refresh-community-users-btn:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.5);
}

/* Search Input */
#community-users-search-input {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 12px;
    color: #fff;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    width: 100%;
}

#community-users-search-input:focus {
    border-color: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
    outline: none;
}

#community-users-search-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Loading State */
#community-users-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--color-text-secondary, #9ca3af);
}

#community-users-loading i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #a855f7;
}

/* Table Container */
#community-users-table-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background-color: rgba(10, 10, 15, 0.95); /* Near black background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 8px;
}

#community-users-table-container > .overflow-y-auto {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Table Styles */
.community-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.community-users-table thead {
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.2) 0%, rgba(0, 0, 0, 0.6) 100%) !important;
    border-bottom: 1px solid rgba(168, 85, 247, 0.3);
}

.community-users-table thead tr {
    display: table-row;
}

.community-users-table th {
    padding: 10px 8px;
    text-align: center;
    font-family: 'Bungee Inline', cursive;
    font-size: 0.6rem;
    color: var(--color-text-title, #fff);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: none;
    transition: all 0.2s ease;
}

.community-users-table th:first-child {
    text-align: left;
}

.community-users-table th i {
    margin-right: 4px;
    opacity: 0.8;
}

.community-users-table th .header-total-badge {
    font-size: 0.55rem;
    opacity: 0.6;
    font-weight: 400;
}

.community-users-table th.sortable {
    cursor: pointer;
}

.community-users-table th.sortable:hover {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.community-users-table th.sortable:hover i {
    color: #a855f7;
}

.community-users-table th.sorted {
    background: rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

/* Special column backgrounds */
.community-users-table th.bg-pink-900\/30 {
    background: rgba(236, 72, 153, 0.15) !important;
}

.community-users-table th.bg-purple-900\/30 {
    background: rgba(168, 85, 247, 0.15) !important;
}

.community-users-table tbody {
    display: block;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.community-users-table thead,
.community-users-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.community-users-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.community-users-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.15) 0%, rgba(139, 92, 246, 0.08) 50%, rgba(168, 85, 247, 0.1) 100%);
}

.community-users-table td {
    padding: 8px;
    color: var(--color-text-main, #e5e7eb);
    vertical-align: middle;
    text-align: center;
    border-bottom: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.community-users-table td:first-child {
    text-align: left;
}

/* User Cell Styling */
.community-users-table td:first-child > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-users-table .user-expand-btn {
    background: none;
    border: none;
    color: var(--color-text-muted, #6b7280);
    cursor: pointer;
    padding: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.community-users-table .user-expand-btn:hover {
    color: #a855f7;
    transform: scale(1.1);
}

.community-users-table .user-expand-btn.expanded {
    transform: rotate(90deg);
}

.community-users-table .user-avatar-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.community-users-table .user-avatar-cell img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
    cursor: pointer;
}

.community-users-table .user-avatar-cell img:hover {
    border-color: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.community-users-table .user-info-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.community-users-table .user-name-cell {
    font-weight: 600;
    color: var(--color-text-primary, #fff);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.community-users-table .user-name-cell:hover {
    color: #a855f7;
}

.community-users-table .user-song-count {
    font-size: 0.6rem;
    color: var(--color-text-muted, #6b7280);
}

/* Stats Columns */
.community-users-table td span[style*="color:#22c55e"] {
    color: #22c55e !important;
    font-weight: 600;
    text-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.community-users-table td span[style*="color:#3b82f6"] {
    color: #3b82f6 !important;
    font-weight: 600;
}

.community-users-table td span[style*="color:#ef4444"] {
    color: #ef4444 !important;
    font-weight: 600;
}

.community-users-table td span[style*="color:#fb923c"] {
    color: #fb923c !important;
    font-weight: 600;
}

.community-users-table td span[style*="color:#f9a8d4"] {
    color: #f9a8d4 !important;
    font-weight: 600;
}

.community-users-table td span[style*="color:#c084fc"] {
    color: #c084fc !important;
    font-weight: 600;
}

/* Special stat backgrounds */
.community-users-table td.bg-pink-900\/20 {
    background: rgba(236, 72, 153, 0.08) !important;
}

.community-users-table td.bg-purple-900\/20 {
    background: rgba(168, 85, 247, 0.08) !important;
}

/* Status Column */
.community-users-table td[style*="color:#6b7280"] {
    color: #6b7280 !important;
}

.community-users-table td[style*="color:#ffffff"] {
    color: #fff !important;
}

/* Pagination */
#community-users-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 12px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.6) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

#community-users-pagination button {
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.4);
    color: #c084fc;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.65rem;
}

#community-users-pagination button:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.4);
    border-color: #a855f7;
    color: #fff;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.4);
}

#community-users-pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#community-users-pagination span {
    font-size: 0.65rem;
    color: var(--color-text-muted, #6b7280);
}

/* No Results State */
#community-users-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--color-text-muted, #6b7280);
    font-size: 0.85rem;
}

#community-users-no-results i {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* Song Expansion Sub-row */
.community-song-expansion {
    display: none;
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%);
    border-left: 3px solid #a855f7;
}

.community-song-expansion.expanded {
    display: table-row;
}

.community-song-expansion td {
    padding: 12px 16px 12px 60px;
}

.community-song-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.community-song-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.community-song-item:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: #a855f7;
    transform: scale(1.05);
}

.community-song-item img {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    object-fit: cover;
}

.community-song-item span {
    color: var(--color-text-secondary, #9ca3af);
}

/* Responsive Table */
@media (max-width: 768px) {
    .community-users-table th:nth-child(n+4),
    .community-users-table td:nth-child(n+4) {
        display: none;
    }
    
    .community-users-table th:first-child,
    .community-users-table td:first-child {
        display: table-cell;
    }
}
