/* =========================================
   Stumplex Social — Premium Hub
   ========================================= */

/* ---------- Discovery View (Home) ---------- */
#social-view-discovery {
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.discovery-header {
    margin-bottom: 32px;
}

.discovery-search {
    position: relative;
    max-width: 600px;
}

.discovery-search input {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 14px 18px 14px 48px;
    color: var(--text-primary);
    font-size: 1rem;
    box-shadow: var(--card-shadow);
    transition: all var(--transition);
}

.discovery-search input:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 4px rgba(48, 92, 222, 0.15);
}

.discovery-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.discovery-sections {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.discovery-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-badge {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
}

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.group-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.group-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.group-icon-large {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(48, 92, 222, 0.1);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.active-pill {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.active-pill .live-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

.group-card-info h4 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.group-card-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.group-card-footer {
    border-top: 1px solid var(--card-border);
    padding-top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.join-hint {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
}

/* Friends Horizontal List */
.friends-horizontal-list {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.friend-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    min-width: 100px;
    cursor: pointer;
    transition: all var(--transition);
}

.friend-bubble:hover {
    transform: scale(1.05);
}

.friend-avatar-large {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    border: 3px solid var(--body-bg);
    box-shadow: 0 0 0 2px var(--card-border);
    position: relative;
}

.friend-bubble.active .friend-avatar-large {
    box-shadow: 0 0 0 2px #10b981;
}

.friend-bubble .status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--body-bg);
}

.friend-bubble .status-dot.offline {
    background: #6b7280;
}

.friend-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ---------- Detail View (Room) ---------- */
.back-to-social-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
}

.back-to-social-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(-4px);
}

.room-header-top {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.room-header-text h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.room-header-text p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.social-layout {
    display: grid;
    grid-template-columns: 80px 1fr 280px;
    gap: 24px;
    height: calc(100vh - 220px);
    min-height: 500px;
}

/* Mini Sidebar */
.social-sidebar.mini {
    width: 80px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.social-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--card-border);
}

.social-tabs {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.social-tab-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition);
}

.social-tab-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(48, 92, 222, 0.2);
}

.social-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.social-list-item {
    width: 44px;
    height: 44px;
    position: relative;
    cursor: pointer;
}

.item-avatar-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}

.item-avatar {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

.social-list-item .status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--card-bg);
}

.social-list-item .status-dot.offline {
    background: #6b7280;
}

/* Main Area */
.social-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.room-view-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.room-inner-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
}

.room-stats-pill {
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.library-canvas {
    flex: 1;
    background-image: url('/assets/img/social/library_bg_v2.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    image-rendering: pixelated;
    position: relative;
    overflow: hidden;
}

.desk-slot {
    height: 120px;
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

.desk-slot:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent);
}

.desk-slot.occupied {
    background: rgba(48, 92, 222, 0.12);
    border: 2px solid var(--accent);
    cursor: default;
}

.desk-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
}

.user-avatar-active {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    box-shadow: 0 8px 24px rgba(48, 92, 222, 0.4);
    position: relative;
}

.focus-timer-pill {
    position: absolute;
    bottom: -12px;
    background: #000;
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    border: 1px solid var(--accent);
    white-space: nowrap;
}

/* Chat */
.social-chat {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    height: 220px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
}

.chat-header span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    display: flex;
    gap: 12px;
}

.chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.chat-content {
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 14px;
    border-radius: 14px;
    border-top-left-radius: 2px;
    max-width: 85%;
}

.chat-user {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 2px;
}

.chat-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--card-border);
    display: flex;
    gap: 12px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.chat-send-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
}

/* Leaderboard */
.leaderboard-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaderboard-panel.collapsed {
    width: 60px;
}

.leaderboard-panel.collapsed .lb-header,
.leaderboard-panel.collapsed .lb-list {
    opacity: 0;
    pointer-events: none;
}

.lb-header {
    padding: 24px;
    border-bottom: 1px solid var(--card-border);
}

.lb-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.lb-title-row h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.lb-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.lb-tabs {
    display: flex;
    gap: 6px;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px;
    border-radius: 10px;
}

.lb-tab {
    flex: 1;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

.lb-tab.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.lb-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.lb-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 6px;
    transition: background 0.3s;
}

.lb-item.top-3 {
    background: linear-gradient(90deg, rgba(48, 92, 222, 0.08), transparent);
}

.lb-rank {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-secondary);
    width: 24px;
}

.lb-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}

.lb-info {
    flex: 1;
}

.lb-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.lb-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ---------- Theme Overrides ---------- */
[data-theme="white"] .library-canvas {
    background: radial-gradient(circle at center, #f5f5f7 0%, #e8e8ed 100%);
}

[data-theme="white"] .desk-slot {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="white"] .chat-content {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="white"] .active-pill {
    background: rgba(16, 185, 129, 0.08);
}

/* ---------- Responsive ---------- */
@media (max-width: 1400px) {
    .social-layout {
        grid-template-columns: 80px 1fr;
    }

    .leaderboard-panel {
        display: none;
    }
}

@media (max-width: 1000px) {
    .social-layout {
        grid-template-columns: 1fr;
    }

    .social-sidebar.mini {
        display: none;
    }
}