@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --bg-base: #05162e;
    --bg-surface: #051833;
    --bg-card: #092244;
    --bg-card-hover: #0d2c55;
    --primary: #6cb22f;
    --primary-hover: #5a9427;
    --secondary: #6cb22f;
    --primary-glow: rgba(108, 178, 47, 0.15);
    --gradient-primary: #6cb22f;
    --gradient-gold: #f59e0b;
    --text-main: #f8f8f9;
    --text-muted: #9ab3d5;
    --border: rgba(108, 178, 47, 0.15);
    --border-hover: rgba(108, 178, 47, 0.3);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Navbar variables */
    --navbar-bg: #051833;
    --navbar-text: #f8f8f9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* Header & Navigation */
header {
    background: var(--navbar-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo span {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-item {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--navbar-text);
}

.nav-item:hover, .nav-item.active {
    color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

/* User Profile Dropdown / Nav Actions */
.user-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-badge {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.4rem 0.8rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
}

.role-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.role-admin { background: #ef4444; color: #fff; }
.role-editor { background: #3b82f6; color: #fff; }
.role-contributor { background: #10b981; color: #fff; }
.role-user { background: #6b7280; color: #fff; }

/* Main Content Wrapper */
main.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    flex: 1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 1024px) {
    main.container.with-sidebar {
        grid-template-columns: 280px 1fr;
    }
}

/* Sidebar Widgets */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.widget {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.widget-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-list, .tag-cloud {
    list-style: none;
}

.category-item a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.category-item a:hover, .category-item.active a {
    color: var(--text-main);
    padding-left: 5px;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-badge {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

.tag-badge:hover, .tag-badge.active {
    background: var(--gradient-primary);
    color: #fff;
    border-color: transparent;
}

/* Leaderboard Widget */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.leaderboard-rank {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.leaderboard-item:nth-child(1) .leaderboard-rank {
    background: #f59e0b;
    color: #fff;
}
.leaderboard-item:nth-child(2) .leaderboard-rank {
    background: #94a3b8;
    color: #fff;
}
.leaderboard-item:nth-child(3) .leaderboard-rank {
    background: #b45309;
    color: #fff;
}

.leaderboard-user {
    flex: 1;
    margin-left: 0.8rem;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leaderboard-points {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--secondary);
}

/* Content Area & Sorting */
.content-header {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .content-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.sort-tabs {
    display: inline-flex;
    background: var(--bg-surface);
    padding: 0.3rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.sort-tab {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: transparent;
}

.sort-tab:hover {
    color: var(--text-main);
}

.sort-tab.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.2rem 0.5rem;
    width: 100%;
    max-width: 320px;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.5rem;
    font-size: 0.9rem;
    width: 100%;
}

.search-box input:focus {
    outline: none;
}

.search-box button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
}

.search-box button:hover {
    color: var(--text-main);
}

/* Grid Layout */
.apps-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1200px) {
    .apps-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* App Card Component */
.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: var(--transition);
}

.app-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.15);
}

.app-card-img {
    height: 180px;
    background: #181b26;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.app-card:hover .app-card-img img {
    transform: scale(1.05);
}

.app-card-img-placeholder {
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.85;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    color: #fff;
}

.app-card-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(10, 11, 16, 0.75);
    backdrop-filter: blur(5px);
    color: #fff;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.app-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.app-card-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.app-card-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.app-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.app-card-author {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.app-card-stats {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.app-card-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-card-rating {
    color: #f59e0b;
    font-weight: 700;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
}

/* Application Detail Page */
.app-detail-header {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 768px) {
    .app-detail-header {
        flex-direction: row;
        align-items: flex-start;
    }
}

.app-detail-image {
    width: 100%;
    max-width: 300px;
    height: 180px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border);
    align-self: center;
}

.app-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-detail-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.app-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-detail-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 2rem;
}

.app-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.app-detail-desc {
    font-size: 1rem;
    color: var(--text-main);
    margin-top: 0.5rem;
}

.app-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* App Showcase Container */
.app-showcase {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.app-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-iframe-wrapper {
    position: relative;
    width: 100%;
    height: 600px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fff; /* standard page bg */
    border: 1px solid var(--border);
}

.app-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Rating / Voting System UI */
.star-rating {
    display: inline-flex;
    gap: 0.2rem;
}

.star-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.star-btn.active, .star-btn:hover, .star-btn.hover {
    color: #f59e0b;
}

/* Comments Section */
.comments-section {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: 2rem;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.form-control {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.2rem;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.comment-author {
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-date {
    color: var(--text-muted);
}

.comment-body {
    color: var(--text-main);
    font-size: 0.95rem;
    white-space: pre-line;
}

/* Auth Pages (Login / Register) */
.auth-container {
    max-width: 450px;
    width: 100%;
    margin: 4rem auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow);
}

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

.auth-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

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

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

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--secondary);
    font-weight: 600;
}

/* Modals & Modern Dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 16, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal-box {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-close:hover {
    color: var(--text-main);
}

/* Toast/Alert notification banner */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.toast {
    background: var(--bg-surface);
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    transform: translateX(120%);
    transition: var(--transition);
}

.toast.active {
    transform: translateX(0);
}

.toast-success {
    border-left-color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-info {
    border-left-color: #3b82f6;
}

/* Advertisement slot styling */
.ad-slot-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem auto;
    padding: 0.5rem;
    max-width: 100%;
    overflow: hidden;
}

.ad-slot-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    width: 100%;
    margin-bottom: 0.25rem;
}

.ad-slot-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    min-height: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.ad-slot-header-banner {
    max-width: 728px;
    width: 100%;
}

.ad-slot-sidebar {
    max-width: 300px;
    min-height: 250px;
    width: 100%;
}

/* Footer styling */
footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 3rem 2rem 2rem;
    margin-top: auto;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
    }
}

.footer-brand {
    max-width: 400px;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 3rem;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-column h4 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.footer-column a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-column a:hover {
    color: var(--text-main);
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
    }
}

/* Miscellaneous utility classes */
.flex-row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-approved { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-rejected { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

/* Theme Variables for Light Mode */
:root.theme-light {
    --bg-base: #f8f8f9;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --primary: #6cb22f;
    --primary-hover: #5a9427;
    --secondary: #052249;
    --primary-glow: rgba(108, 178, 47, 0.1);
    --gradient-primary: #6cb22f;
    --gradient-gold: #f59e0b;
    --text-main: #080808;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow: 0 10px 40px rgba(8, 8, 8, 0.04);
    
    /* Navbar in light mode: solid white background with navy text */
    --navbar-bg: #ffffff;
    --navbar-text: #052249;
}

:root.theme-light body {
    background-color: var(--bg-base) !important;
}

/* Logo switching based on theme */
html.theme-light .logo-dark-theme {
    display: none !important;
}
html.theme-light .logo-light-theme {
    display: block !important;
}
html:not(.theme-light) .logo-dark-theme {
    display: block !important;
}
html:not(.theme-light) .logo-light-theme {
    display: none !important;
}

/* Lab text suffix color based on theme */
.logo-lab-text {
    color: #ffffff;
}
html.theme-light .logo-lab-text {
    color: #052249;
}

/* Theme Toggle Button Styles */
.theme-toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
    margin-left: 0.5rem;
}

.theme-toggle-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: scale(1.05);
}

.theme-toggle-icon {
    stroke: var(--text-main);
}

/* Toggle visibility based on light/dark mode */
html.theme-light .icon-moon {
    display: none !important;
}

html.theme-light .icon-sun {
    display: block !important;
}

html:not(.theme-light) .icon-moon {
    display: block !important;
}

html:not(.theme-light) .icon-sun {
    display: none !important;
}

/* Responsiveness media queries */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        text-align: center;
    }
    
    .nav-links {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .user-menu {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.8rem;
        flex-direction: column;
        align-items: center;
    }
    
    .theme-toggle-btn {
        margin-left: 0;
    }

    main.container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
}

/* User Dropdown Menu Styles */
.user-dropdown-container {
    position: relative;
    display: inline-block;
}

.user-dropdown-trigger {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.user-dropdown-trigger:hover,
.user-dropdown-trigger.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.navbar-avatar-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.navbar-username {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-chevron {
    transition: var(--transition);
}

.user-dropdown-trigger.active .dropdown-chevron {
    transform: rotate(180deg);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 0.75rem 0;
    display: none;
    flex-direction: column;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transform: translateY(-10px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.user-dropdown-menu.show {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

.user-dropdown-header {
    padding: 0.5rem 1.25rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-points {
    font-weight: 800;
    color: var(--secondary);
    font-size: 0.9rem;
}

.dropdown-info-text {
    padding: 0.5rem 1.25rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.dropdown-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 0.5rem 0;
}

.dropdown-item {
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    transition: var(--transition);
}

.dropdown-item svg {
    opacity: 0.7;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(108, 178, 47, 0.1);
    color: var(--primary);
}

.dropdown-item:hover svg {
    opacity: 1;
    color: var(--primary);
}

.dropdown-item.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.dropdown-item.logout-link:hover svg {
    color: #ef4444;
}

/* Tabbed Profile Dashboard Styles */
.profile-dashboard {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    margin: 2rem auto;
    max-width: 1000px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.profile-sidebar {
    background: rgba(0, 0, 0, 0.2);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.profile-sidebar-header {
    text-align: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.profile-sidebar-avatar {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.profile-sidebar-avatar-fallback {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2.2rem;
    margin: 0 auto 1rem;
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.profile-sidebar-username {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--text-main);
}

.profile-tab-btn {
    background: transparent;
    border: 0;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: var(--transition);
}

.profile-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.profile-tab-btn.active {
    color: var(--text-main);
    background: rgba(108, 178, 47, 0.15);
    border: 1px solid var(--border);
}

.profile-content {
    padding: 2rem;
}

.profile-tab-panel {
    display: none;
}

.profile-tab-panel.active {
    display: block;
}

/* Avatar Upload styling */
.avatar-upload-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
}

.avatar-preview-wrapper {
    position: relative;
}

.avatar-preview-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.avatar-preview-fallback {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.8rem;
    border: 2px solid var(--primary);
}

.avatar-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.avatar-upload-label {
    background: var(--primary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.avatar-upload-label:hover {
    background: var(--primary-hover);
}

.avatar-upload-input {
    display: none;
}

/* Responsive adjustments for profile */
@media (max-width: 768px) {
    .profile-dashboard {
        grid-template-columns: 1fr;
    }
    
    .profile-sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
        padding: 1.5rem;
        flex-direction: row;
        overflow-x: auto;
        align-items: center;
        gap: 1rem;
    }
    
    .profile-sidebar-header {
        display: none;
    }
    
    .profile-tab-btn {
        flex-shrink: 0;
    }
    
    .profile-content {
        padding: 1.5rem;
    }
}
