/* 
 * Social Hub V2 - Complete Redesign
 * A modern, premium social interface for Aether Chronicles
 */

/* ===== Reset Social Hub ===== */
#screen-social * {
    box-sizing: border-box;
}

/* ===== Main Container ===== */
#screen-social {
    position: fixed;
    top: 60px; /* Below universal bar */
    left: 0;
    right: 0;
    bottom: 0;
    background: #0a0a0a;
    display: none;
    z-index: 100;
}

#screen-social.active {
    display: block;
}

/* ===== Social Hub Layout ===== */
.social-hub-v2 {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    grid-template-rows: 80px 1fr;
    grid-template-areas:
        "header header header"
        "nav content activity";
    gap: 0;
}

/* ===== Header Section ===== */
.social-header {
    grid-area: header;
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 2px solid #2a2a4e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: relative;
    overflow: hidden;
}

.social-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    animation: headerShine 8s infinite;
}

@keyframes headerShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.social-header-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

.social-header-actions {
    display: flex;
    gap: 12px;
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.header-action-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* ===== Navigation Panel ===== */
.social-nav {
    grid-area: nav;
    background: #0f0f1f;
    border-right: 1px solid #1a1a2e;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.social-nav-section {
    margin-bottom: 30px;
}

.social-nav-title {
    color: #666;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0 20px;
    margin-bottom: 10px;
}

.social-nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    gap: 15px;
}

.social-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: #667eea;
    transform: scaleY(0);
    transition: transform 0.2s ease;
}

.social-nav-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #fff;
    padding-left: 25px;
}

.social-nav-item.active {
    background: rgba(102, 126, 234, 0.2);
    color: #667eea;
}

.social-nav-item.active::before {
    transform: scaleY(1);
}

.social-nav-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.social-nav-label {
    font-size: 15px;
    font-weight: 500;
}

.social-nav-badge {
    margin-left: auto;
    background: #ff4757;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===== Content Area ===== */
.social-content-area {
    grid-area: content;
    background: #0a0a0a;
    overflow: hidden;
    position: relative;
}

.social-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 30px;
    overflow-y: auto;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.3s ease;
    display: none;
}

.social-page.active {
    opacity: 1;
    transform: translateX(0);
    display: block;
}

/* ===== Activity Panel ===== */
.social-activity {
    grid-area: activity;
    background: #0f0f1f;
    border-left: 1px solid #1a1a2e;
    padding: 20px;
    overflow-y: auto;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.activity-title {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.activity-filter {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
}

.activity-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.activity-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(102, 126, 234, 0.3);
}

/* ===== Profile Page ===== */
.profile-page {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    height: 100%;
}

.profile-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.profile-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.profile-avatar-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.profile-avatar-main {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid #667eea;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    object-fit: cover;
    background: #2a2a4e;
}

.profile-avatar-status {
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: #4caf50;
    border-radius: 50%;
    border: 4px solid #1a1a2e;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.profile-username {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
}

.profile-title-display {
    color: #667eea;
    font-size: 16px;
    margin-bottom: 20px;
}

.profile-stats-mini {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.profile-stat-mini {
    text-align: center;
}

.profile-stat-mini-value {
    font-size: 20px;
    font-weight: 700;
    color: #667eea;
}

.profile-stat-mini-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.profile-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
}

.profile-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.profile-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

/* ===== Friends Page ===== */
.friends-page {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.friends-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.friends-search {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    max-width: 500px;
}

.friends-search-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 30px;
    padding: 12px 25px;
    color: #fff;
    font-size: 15px;
    transition: all 0.3s ease;
}

.friends-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.friend-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.friend-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent, rgba(102, 126, 234, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.friend-card:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.friend-card:hover::before {
    opacity: 1;
}

.friend-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 15px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    position: relative;
    background: #2a2a4e;
}

.friend-online-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: #4caf50;
    border-radius: 50%;
    border: 3px solid #0a0a0a;
}

.friend-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.friend-status-text {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.friend-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.friend-action-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.friend-action-icon:hover {
    background: #667eea;
    border-color: #667eea;
    transform: scale(1.1);
}

/* ===== Messages Page ===== */
.messages-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    height: 100%;
    background: #0a0a0a;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.messages-sidebar {
    background: #0f0f1f;
    border-right: 1px solid #1a1a2e;
    display: flex;
    flex-direction: column;
}

.messages-search {
    padding: 20px;
    border-bottom: 1px solid #1a1a2e;
}

.messages-list {
    flex: 1;
    overflow-y: auto;
}

.message-thread {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

.message-thread:hover {
    background: rgba(102, 126, 234, 0.1);
}

.message-thread.active {
    background: rgba(102, 126, 234, 0.2);
}

.message-thread-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 15px;
    position: relative;
    background: #2a2a4e;
}

.message-thread-info {
    flex: 1;
}

.message-thread-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 3px;
}

.message-thread-preview {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-thread-meta {
    text-align: right;
}

.message-thread-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.message-thread-unread {
    background: #667eea;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.messages-conversation {
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
}

.conversation-header {
    background: #0f0f1f;
    padding: 20px;
    border-bottom: 1px solid #1a1a2e;
    display: flex;
    align-items: center;
    gap: 15px;
}

.conversation-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-bubble {
    max-width: 70%;
    display: flex;
    gap: 10px;
}

.message-bubble.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-bubble-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #2a2a4e;
}

.message-bubble-content {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 18px;
    padding: 12px 18px;
    position: relative;
}

.message-bubble.own .message-bubble-content {
    background: #667eea;
}

.message-bubble-text {
    color: #fff;
    font-size: 15px;
    line-height: 1.4;
}

.message-bubble-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

.conversation-input {
    background: #0f0f1f;
    padding: 20px;
    border-top: 1px solid #1a1a2e;
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.message-input-wrapper {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-input {
    flex: 1;
    background: none;
    border: none;
    color: #fff;
    font-size: 15px;
    outline: none;
    resize: none;
    max-height: 100px;
}

.message-send-btn {
    width: 45px;
    height: 45px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.message-send-btn:hover {
    background: #5a6ed8;
    transform: scale(1.05);
}

/* ===== Global Chat Page ===== */
.chat-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-header {
    background: linear-gradient(90deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.chat-online-count {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4caf50;
    font-size: 14px;
}

.chat-messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #0a0a0a;
}

.chat-message-item {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-message-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #2a2a4e;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-message-avatar:hover {
    transform: scale(1.1);
}

.chat-message-body {
    flex: 1;
}

.chat-message-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 5px;
}

.chat-message-username {
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
}

.chat-message-username:hover {
    text-decoration: underline;
}

.chat-message-time {
    font-size: 12px;
    color: #666;
}

.chat-message-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    line-height: 1.5;
}

.chat-input-container {
    background: #0f0f1f;
    padding: 20px 30px;
    border-top: 1px solid #1a1a2e;
}

/* ===== Empty States ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state-title {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.empty-state-text {
    font-size: 16px;
    color: #666;
    max-width: 400px;
    margin: 0 auto 30px;
}

.empty-state-action {
    display: inline-block;
    background: #667eea;
    color: #fff;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.empty-state-action:hover {
    background: #5a6ed8;
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* ===== Responsive Design ===== */
@media (max-width: 1400px) {
    .social-hub-v2 {
        grid-template-columns: 240px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .social-hub-v2 {
        grid-template-columns: 220px 1fr;
        grid-template-areas:
            "header header"
            "nav content";
    }
    
    .social-activity {
        display: none;
    }
}

@media (max-width: 768px) {
    .social-hub-v2 {
        grid-template-columns: 1fr;
        grid-template-rows: 60px auto 1fr;
        grid-template-areas:
            "header"
            "nav"
            "content";
    }
    
    .social-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        border-right: none;
        border-bottom: 1px solid #1a1a2e;
    }
    
    .social-nav-section {
        display: flex;
        margin: 0;
    }
    
    .social-nav-item {
        white-space: nowrap;
    }
    
    .profile-page {
        grid-template-columns: 1fr;
    }
    
    .messages-page {
        grid-template-columns: 1fr;
    }
    
    .messages-sidebar {
        display: none;
    }
    
    .friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}