/* MODERN DARK SAAS & STUDENT COMMUNITY STYLES */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg-primary: #090d16;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --accent-glow: #6366f1;
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --border-glass: rgba(255, 255, 255, 0.08);
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden { display: none !important; }

/* GLASSMORPHISM */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: 1.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

/* AUTH SCREEN */
.auth-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-background {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-glow);
    top: -100px;
    left: -100px;
    animation: float 8s ease-in-out infinite alternate;
}

.orb-2 {
    width: 450px;
    height: 450px;
    background: var(--accent-pink);
    bottom: -100px;
    right: -100px;
    animation: float 10s ease-in-out infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(30px) scale(1.1); }
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-badge {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-glow), var(--accent-pink));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 1rem;
    color: white;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.5px;
    background: linear-gradient(to right, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
}

.auth-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-tab.active {
    background: var(--accent-glow);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.auth-tab.admin-tab:hover {
    color: var(--danger);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.2rem;
}

.auth-form.active {
    display: flex;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.input-group label i {
    margin-right: 6px;
    color: var(--accent-glow);
}

.input-group input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: var(--accent-glow);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-glow), #4f46e5);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(99, 102, 241, 0.5);
}

.admin-btn {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

/* APP LAYOUT */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid var(--border-glass);
    border-radius: 0;
    z-index: 10;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 2rem;
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.5px;
}

.logo-badge-sm {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--accent-glow), var(--accent-pink));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    position: relative;
}

.nav-item i {
    width: 20px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: white;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 20px;
    background: var(--accent-glow);
    border-radius: 0 4px 4px 0;
}

.badge-count {
    margin-left: auto;
    background: var(--accent-pink);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

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

.user-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-mini-card img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

.user-mini-info h4 {
    font-size: 0.9rem;
    font-weight: 700;
}

.user-mini-info p {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
}

.btn-logout,
.btn-logout-sm {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-logout:hover,
.btn-logout-sm:hover {
    background: var(--danger);
    color: white;
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-glass);
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.menu-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
}

/* MAIN CONTENT AREA */
.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.view-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* HERO BANNER */
.hero-banner {
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    margin-bottom: 1rem;
}

.hero-text h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 1rem;
}

.hero-text p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hero-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-content: center;
}

.stat-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    padding: 1.25rem;
    border-radius: 1rem;
    text-align: center;
}

.stat-card i {
    font-size: 1.25rem;
    color: var(--accent-glow);
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* PANELS & GRIDS */
.grid-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.panel {
    padding: 1.5rem;
}

.panel h3,
.panel h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-list,
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.room-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.room-info strong {
    font-size: 0.95rem;
    display: block;
}

.room-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.btn-sm {
    background: var(--accent-glow);
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
}

.btn-sm-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
}

.feed-item img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.feed-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.feed-item strong {
    color: white;
}

/* CHAT UI */
.chat-container-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 8rem);
    padding: 0;
    overflow: hidden;
}

.chat-sidebar {
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
}

.chat-search {
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
}

.chat-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    padding: 8px 12px;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    outline: none;
}

.chat-channels {
    flex: 1;
    overflow-y: auto;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.2s ease;
}

.channel-item:hover,
.channel-item.active {
    background: rgba(99, 102, 241, 0.1);
}

.channel-item img,
.channel-item i {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.channel-item h4 {
    font-size: 0.9rem;
    font-weight: 700;
}

.channel-item p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-main-area {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header-bar {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.online-indicator {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 70%;
}

.message.received img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.msg-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    padding: 10px 14px;
    border-radius: 12px;
}

.msg-content h5 {
    font-size: 0.8rem;
    color: var(--accent-glow);
    margin-bottom: 2px;
}

.msg-content p {
    font-size: 0.9rem;
}

.msg-time {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
    text-align: right;
    margin-top: 4px;
}

.message.sent {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message.sent .msg-content {
    background: var(--accent-glow);
    border: none;
}

.message.sent .msg-content h5,
.message.sent .msg-content p {
    color: white;
}

.chat-input-bar {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-glass);
    display: flex;
    gap: 10px;
}

.chat-input-bar input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-glass);
    padding: 12px 16px;
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    outline: none;
}

/* FRIENDS & GAMES GRIDS */
.flex-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.friend-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
}

.friend-card img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
}

.friend-card h4 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.status-text {
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.status-text.online { color: var(--success); }
.status-text.offline { color: var(--text-muted); }

.friend-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.2);
}

.game-img {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: white;
}

.game-info {
    padding: 1.25rem;
}

.game-info h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.game-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.game-info .btn-primary {
    width: 100%;
    padding: 8px;
    font-size: 0.9rem;
}

/* LEADERBOARD TABLE */
.leaderboard-table-wrapper {
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.9rem;
}

.leaderboard-table th {
    color: var(--text-muted);
    font-weight: 600;
}

.leaderboard-table td img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 10px;
    object-fit: cover;
}

.rank-1 td { color: #fbbf24; font-weight: 700; }
.rank-2 td { color: #e5e7eb; font-weight: 700; }
.rank-3 td { color: #d97706; font-weight: 700; }

/* PROFILE & SETTINGS */
.profile-header-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.profile-header-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.badge-role {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
}

.profile-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.p-stat {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.p-stat h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.p-stat p {
    font-size: 1.25rem;
    font-weight: 800;
}

.settings-group {
    margin-top: 1.5rem;
}

.settings-group h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

/* ADMIN & GAME MODALS */
.admin-modal,
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.admin-content,
.game-modal-content {
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
}

.btn-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
}

.admin-tabs {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
}

.admin-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    padding-bottom: 4px;
}

.admin-tab-btn.active {
    color: var(--danger);
    border-bottom: 2px solid var(--danger);
}

.admin-tab-content {
    display: none;
}

.admin-tab-content.active {
    display: block;
}

.btn-danger-sm {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* RESPONSIVE MEDIA QUERIES */
@media(max-width: 900px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        background: var(--bg-secondary);
        z-index: 200;
    }
    .sidebar.mobile-open {
        left: 0;
    }
    .mobile-header {
        display: flex;
    }
    .main-content {
        padding: 5rem 1rem 1rem 1rem;
        height: 100vh;
    }
    .hero-banner {
        grid-template-columns: 1fr;
    }
    .grid-two-col {
        grid-template-columns: 1fr;
    }
    .chat-container-grid {
        grid-template-columns: 1fr;
        height: calc(100vh - 7rem);
    }
    .chat-sidebar {
        display: none;
    }
}