:root {
    /* Color Palette - Premium Dark Theme (Default) */
    --bg-body: #0f1115;
    --bg-surface: #181b21;
    --bg-surface-glass: rgba(24, 27, 33, 0.7);
    --primary: #3b82f6;
    /* Vivid Blue */
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #8b5cf6;
    /* Violet */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #2d313a;
    --card-hover-border: #4b5563;
    --input-bg: rgba(0, 0, 0, 0.2);
    --dropdown-shadow: rgba(0, 0, 0, 0.6);

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition: 0.2s ease-in-out;
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.8);
    --text-main: #111827;
    --text-muted: #4b5563;
    --border: #e5e7eb;
    --card-hover-border: #3b82f6;
    --input-bg: #ffffff;
    --dropdown-shadow: rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-layout {
    flex: 1;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: transparent;
    color: var(--text-main);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-ghost {
    background: var(--bg-surface-glass);
}

.btn-ghost:hover {
    background: var(--bg-surface);
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.action-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.action-btn.active.like-btn {
    color: #ef4444;
}

.action-btn.active.save-btn {
    color: #3b82f6;
}

.action-icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.action-btn.active .action-icon {
    fill: currentColor;
}

.follow-btn {
    border: 1px solid var(--primary) !important;
    background: var(--primary) !important;
    color: white !important;
    padding: 2px 12px !important;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 8px var(--primary-glow);
}

.follow-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.follow-btn.following {
    background: transparent !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
    box-shadow: none;
}

.follow-btn.following:hover {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.follow-btn.following:hover {
    font-size: 0 !important;
    transition: font-size 0s !important;
}

.follow-btn.following:hover::after {
    content: 'Unfollow';
    font-size: 0.75rem !important;
}

/* ==========================================================================
   Navbar & Navigation
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: var(--bg-surface-glass);
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-md) 0;
}

.theme-toggle-btn-navbar {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    transition: background 0.2s;
}

.theme-toggle-btn-navbar:hover {
    background: var(--bg-surface) !important;
}

.nav-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--spacing-md);
}

.logo {
    display: flex;
    align-items: center;
    height: 64px;
}

.logo-img {
    height: 60px;
    width: auto;
    object-fit: contain;
    transition: transform var(--transition);
}

.logo:hover .logo-img {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
}

.nav-auth {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.nav-link {
    font-weight: 500;
    color: var(--text-muted);
    position: relative;
    padding: 0.5rem 0;
    font-size: 1.05rem;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-main);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    border-radius: var(--radius-full);
}

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: var(--bg-surface);
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    z-index: 1100;
    padding: var(--spacing-sm);
    margin-top: 0.5rem;
}

.nav-dropdown.active .nav-dropdown-content {
    display: block;
    animation: fadeIn 0.2s ease;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    transition: background var(--transition);
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--spacing-sm) 0;
}

/* ==========================================================================
   Layout Structures
   ========================================================================== */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    justify-items: center;
}

.main-layout .sidebar-right {
    display: none;
}

@media (min-width: 1024px) {
    .main-layout.with-sidebar {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: var(--spacing-xl);
        align-items: start;
    }

    .main-layout.with-sidebar .sidebar-right {
        display: block;
    }
}

/* Kebab Menu & Dropdown */
.post-options-dropdown {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    overflow: visible !important;
}

.kebab-btn {
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
    position: relative;
    z-index: 1001;
}

.kebab-btn svg {
    pointer-events: none;
}

.kebab-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.options-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 5px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 160px;
    overflow: hidden;
    z-index: 2000;
}

.options-menu.active {
    display: block;
}

.options-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
}

.options-menu-item:hover {
    background: var(--surface-hover);
}

.options-menu-item.danger {
    color: #ef4444;
}

.options-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface);
    width: 100%;
    max-width: 400px;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.feed-layout .feed {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    align-items: start;
    width: 100%;
}

.single-column-layout .feed {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xl);
    max-width: 800px;
    margin: 0 auto;
}

.wide-layout .feed {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}

.feed {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-md);
    align-items: start;
    width: 100%;
}

.feed .card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
}

/* ==========================================================================
   Cards & Post Styling
   ========================================================================== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    overflow: visible;
    z-index: 1;
}

.card:hover,
.card:focus-within {
    z-index: 50;
}

.post-above-image,
.post-content,
.post-meta-footer,
.post-actions,
.author-avatar,
.author-name,
.follow-btn,
.btn,
.action-btn,
.comments-section {
    position: relative;
}

.reset-filter-btn {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 20px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.reset-filter-btn:hover {
    color: var(--text-main);
    background: var(--surface-hover);
    border-color: var(--border);
}

.card-wide {
    max-width: 100% !important;
}

.card:hover {
    border-color: var(--card-hover-border);
}

.card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.card p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

.post-above-image {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
    position: relative;
    z-index: 2;
}

.post-header-refined {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    flex-shrink: 0;
    overflow: visible !important;
}

.avatar,
.author-avatar,
.profile-avatar,
.account-avatar,
.notif-avatar,
.follow-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
    overflow: hidden;
    line-height: 1;
    border: 1px solid var(--border);
}

.follow-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.follow-user-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.follow-user-item:last-child {
    border-bottom: none;
}

.follow-user-link {
    font-weight: 600;
    color: var(--text-main);
}

.follows-modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.follows-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.follows-list {
    padding: 1rem;
    overflow-y: auto;
}

.account-avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem auto;
}

.avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    border: 2px solid var(--bg-surface);
}

.avatar-upload-btn:hover {
    transform: scale(1.1);
    background: var(--accent);
}


.author-avatar {
    width: 44px;
    height: 44px;
}

.author-info-stack {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-grow: 1;
}

.name-follow-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.author-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
}

.author-role-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.post-description-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    display: block;
    overflow: hidden;
    position: relative;
    max-width: 100%;
    word-break: break-word;
}

.post-description-full {
    display: block !important;
    -webkit-line-clamp: unset !important;
    line-clamp: unset !important;
    overflow: visible !important;
}

.read-more-link {
    font-size: 0.85rem;
    font-style: italic;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    display: inline-block;
    margin-top: 4px;
}

.read-more-link:hover {
    color: var(--accent);
}

.post-content {
    color: var(--text-main);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin: 0;
}

.post-image-container {
    width: 100%;
    max-width: 100%;
    max-height: 350px;
    /* Reduced from 650px for better vertical density */
    overflow: hidden;
    cursor: pointer;
    border-radius: var(--radius-md);
    margin-top: 4px;
    margin-bottom: 4px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition);
}

.post-image-container:hover {
    transform: scale(1.02);
}

.post-image-container img,
.post-image-container video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: auto;
    /* Allow natural height */
    object-fit: contain;
    display: block;
    z-index: 1;
}


/* Removed overlay for cleaner image look */

.post-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    border-top: 1px solid var(--border);
    padding-top: var(--spacing-md);
    margin-top: auto;
}

.post-meta-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.post-category-tag {
    color: var(--primary);
    font-weight: 600;
}

/* ==========================================================================
   Compact Grid & Pills (Browse Page)
   ========================================================================== */
.post-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.post-compact-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: transform var(--transition), border-color var(--transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    text-decoration: none;
    color: inherit;
}

.post-compact-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.trending-project-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    margin: -0.25rem -0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.trending-project-link:hover {
    background: var(--surface-hover);
    transform: translateX(4px);
    color: var(--primary);
}

.popular-category-pill {
    display: inline-block;
    padding: 6px 14px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.popular-category-pill:hover {
    background: var(--primary-glow) !important;
    border-color: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--primary-glow);
    color: var(--text-main);
}

.post-compact-card .compact-image {
    width: 100%;
    aspect-ratio: 9/16;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: #111827;
}

.post-compact-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.post-compact-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.category-filters-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    background: var(--bg-surface);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    position: sticky;
    top: 80px;
    z-index: 900;
    backdrop-filter: blur(10px);
}

.filters-row {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.filter-dropdown {
    position: relative;
    display: inline-block;
}

.filter-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    min-width: 220px;
    box-shadow: 0 10px 30px var(--dropdown-shadow);
    z-index: 950;
    margin-top: 0.5rem;
}

.filter-dropdown.active .filter-dropdown-content {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

.filter-dropdown-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-dropdown-btn:hover,
.filter-dropdown-btn.active {
    border-color: var(--primary);
    color: var(--text-main);
    background: var(--primary-glow);
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-row {
    display: flex;
    gap: var(--spacing-md);
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
    /* Let row handle gap or keep spacing if multiline, but usually distinct */
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-muted);
    font-weight: 500;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: inherit;
    transition: border-color var(--transition);
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

select.form-input {
    background-color: var(--bg-surface);
    color: var(--text-main);
    cursor: pointer;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.category-card {
    padding: 1rem;
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 600;
    color: var(--text-muted);
}

.category-card.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* ==========================================================================
   Profile & Account Pages
   ========================================================================== */
.profile-header {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.profile-cover {
    height: 160px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
}

.profile-info {
    padding: var(--spacing-lg);
    display: flex;
    align-items: flex-end;
    gap: var(--spacing-xl);
    margin-top: -60px;
}

.profile-avatar {
    width: 150px;
    height: 150px;
    border: 4px solid var(--bg-body);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform var(--transition);
}

.profile-name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.profile-stats {
    display: flex;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-sm);
}

.stat-item {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: color var(--transition);
}

.stat-item:hover {
    color: var(--text-main);
}

.stat-count {
    color: var(--text-main);
    font-weight: 700;
}

.account-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: 100%;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.account-header {
    background: linear-gradient(to right, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    padding: var(--spacing-xl);
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.account-avatar {
    width: 120px;
    height: 120px;
    border: 4px solid var(--bg-surface);
    box-shadow: 0 0 20px var(--dropdown-shadow);
}

.account-body {
    padding: var(--spacing-xl);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border);
}

/* ==========================================================================
   Modals & Overlays
   ========================================================================== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    backdrop-filter: blur(8px);
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Center content vertically */
}

.lightbox-content img,
.lightbox-content video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    /* Ensure full image is visible */
    display: block;
    margin: auto;
}

.lightbox-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    color: white;
    font-size: 2rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2001;
}

.follows-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.follows-modal {
    background: var(--bg-surface);
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Admin & Moderation
   ========================================================================== */
.role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(128, 128, 128, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.role-admin {
    background: #ef4444 !important;
    color: white !important;
    border-color: #ef4444 !important;
}

.role-moderator {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

.role-og {
    background: #a855f7 !important;
    color: white !important;
    border-color: #a855f7 !important;
    margin-left: 4px;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
    font-weight: 800;
}

.mod-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 50;
    display: flex;
    gap: 0.5rem;
}

.delete-icon-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    display: grid;
    place-items: center;
    opacity: 0.7;
}

.delete-icon-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    opacity: 1;
}

.comment-delete-btn {
    opacity: 0.6;
    margin-left: 8px;
    cursor: pointer;
    color: #ef4444;
    transition: opacity var(--transition);
}

.comment-delete-btn:hover {
    opacity: 1;
}

/* ==========================================================================
   Notifications
   ========================================================================== */
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-surface);
    transform: translate(25%, -25%);
    z-index: 10;
}

.notif-dropdown-content {
    min-width: 320px !important;
    max-height: 480px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .notif-dropdown-content {
        position: fixed !important;
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        z-index: 10001;
    }
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    transition: background var(--transition);
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
}

.notif-item:last-child {
    border-bottom: none;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item.unread {
    background: rgba(59, 130, 246, 0.05);
}

.notif-avatar {
    width: 40px;
    height: 40px;
}

.notif-body {
    flex-grow: 1;
}

.notif-text {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notif-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notif-post-preview {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

.notif-empty {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================================================
   Animations & Media Queries
   ========================================================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1100px) {
    .feed {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .home-hero {
        padding: 2rem 1rem;
        text-align: center;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-btn {
        width: 100%;
        justify-content: center;
    }

    .main-layout {
        padding-top: var(--spacing-md);
        padding-bottom: var(--spacing-md);
    }

    .container {
        padding: 0 var(--spacing-md);
    }

    .navbar {
        padding: var(--spacing-sm) 0;
    }
}

@media (max-width: 768px) {

    /* Layout Reset */
    .feed,
    .feed-layout .feed {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .main-layout {
        gap: var(--spacing-md);
    }

    /* Navbar Mobile Layout */
    .nav-content {
        display: flex;
        flex-direction: column;
        gap: 0;
        align-items: stretch;
        padding-top: 5px;
    }

    .logo {
        text-align: left;
        margin-bottom: 5px;
        font-size: 1.25rem;
        /* Remove padding-left to align with container */
    }

    .navbar {
        padding: var(--spacing-sm) 0;
    }

    .nav-links {
        justify-content: flex-start;
        gap: 1.25rem;
        width: 100%;
        overflow-x: auto;
        padding: 0.5rem 0;
        /* Remove side padding to align with container */
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid var(--border);
        margin: 0;
        /* Optional: Negative margin to allow full-width scroll while keeping start aligned */
        /* margin-left: -var(--spacing-md);
            margin-right: -var(--spacing-md);
            padding-left: var(--spacing-md);
            padding-right: var(--spacing-md); */
    }

    .nav-link {
        white-space: nowrap;
        font-size: 1rem;
    }

    .nav-auth {
        justify-content: space-between;
        width: 100%;
        padding: 0.5rem 0;
        /* Align with container */
        background: var(--bg-surface);
    }

    .theme-toggle-btn-navbar {
        top: 12px !important;
        /* Visual alignment with logo */
        right: var(--spacing-md) !important;
        /* Align with container padding */
        transform: none !important;
        position: absolute;
    }

    /* Card Adjustments for Small Screens */
    .card {
        border-radius: var(--radius-md);
        padding: var(--spacing-sm);
        margin-left: 0;
        margin-right: 0;
        border-left: none;
        border-right: none;
        border-radius: 0;
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }

    /* Ensure containers don't overflow */
    .post-content,
    .post-header-refined {
        width: 100%;
        overflow: hidden;
    }

    .post-header-refined {
        flex-direction: row;
        /* Keep row but ensure text truncates */
    }

    .author-info-stack {
        min-width: 0;
        /* Allow flex child to shrink properly */
    }

    .author-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Browse Page Filters */
    .category-filters-container {
        top: 0;
        /* Reset sticky top if header changes or keeps sticky */
        overflow-x: auto;
        justify-content: flex-start;
        padding: var(--spacing-sm);
        margin-bottom: var(--spacing-md);
    }

    .filters-row {
        flex-wrap: nowrap;
    }

    /* Profile & Account Mobile */
    .profile-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
        margin-top: -75px;
        gap: var(--spacing-md);
        padding-top: 0;
    }

    .profile-avatar {
        width: 120px;
        height: 120px;
        margin: 0 auto;
    }

    .profile-name {
        justify-content: center;
        flex-wrap: wrap;
        font-size: 1.5rem;
        text-align: center;
    }

    .profile-stats {
        justify-content: center;
        width: 100%;
    }

    .account-header {
        padding: var(--spacing-lg);
    }

    .account-avatar {
        width: 100px;
        height: 100px;
    }

    .form-row {
        flex-direction: column;
        gap: var(--spacing-lg);
        /* Restore gap between stacked groups */
    }

    .info-row {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: flex-start;
    }

    /* Fix h1 in grid */
    .section-title {
        grid-column: 1 / -1;
    }

    /* Shared Components Mobile */
    .feed-tabs {
        gap: 1.25rem;
        margin-bottom: 1rem;
    }

    .search-bar-form {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .search-input-wrapper {
        width: 100%;
    }

    .search-type-toggle {
        justify-content: center;
    }

    .filters-row {
        gap: 0.5rem !important;
    }

    .filter-dropdown-btn {
        padding: 6px 10px !important;
        font-size: 0.85rem !important;
    }

    .explore-header {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .stack-on-mobile {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
}

/* ==========================================================================
   Feed Tabs & Search Bar Components
   ========================================================================== */
.feed-tabs {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    display: flex;
    gap: 2rem;
    grid-column: 1 / -1;
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE 10+ */
}

.feed-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.feed-tabs a {
    font-weight: 600;
    text-decoration: none;
    position: relative;
    padding-bottom: 0.5rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.feed-tabs a.active {
    color: var(--primary);
}

.feed-tabs a.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

.search-bar-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
    max-width: 800px;
}

/* Base Responsive Grid */
.responsive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    width: 100%;
    align-items: start;
}

@media (max-width: 600px) {
    .responsive-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Badges & Projects
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    line-height: 1;
}

.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-completed {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-paused {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.project-card {
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* ==========================================================================
   Home Hero Section
   ========================================================================== */
.home-hero {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.home-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 0 auto;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.hero-btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .home-hero {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: 2rem;
    }
}

/* Follows Overlay Styles */
.follows-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.follows-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 450px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.follows-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.follows-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.follows-close {
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.follows-close:hover {
    color: var(--text-color);
}

.follows-list {
    padding: 0.5rem;
    overflow-y: auto;
    flex: 1;
}

.follow-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    transition: background 0.2s;
    gap: 1rem;
}

.follow-user-item:hover {
    background: var(--surface-hover);
}

.follow-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.follow-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.follow-user-link {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.follow-user-link:hover {
    color: var(--primary);
}

/* Lightbox */
.lightbox {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-content img,
.lightbox-content video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 35px;
    cursor: pointer;
    line-height: 1;
    transition: transform 0.2s;
    z-index: 10001;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.main-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1000;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.5fr repeat(2, 1fr);
    gap: 4rem;
    margin-bottom: 3rem;
}

.footer-brand .footer-logo {
    display: inline-block;
    margin-bottom: 1.5rem;
}

.footer-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.footer-brand p {
    max-width: 320px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.footer-links {
    display: contents;
}

.footer-col-end {
    margin-left: auto;
}

@media (max-width: 768px) {
    .footer-links {
        display: contents;
    }

    .footer-col-end {
        margin-left: 0;
    }
}

.footer-col h4 {
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.footer-col a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: var(--primary);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 2rem;
    font-size: 0.85rem;
    text-align: center;
}

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }

    .footer-brand p {
        margin: 0 auto;
    }
}

.comment-user-link {
    cursor: pointer;
    position: relative;
    z-index: 10;
    display: inline-block;
}

.comment-user-link:hover strong,
.comment-user-link:hover div {
    text-decoration: underline;
    color: var(--primary) !important;
}

/* Comment Image Styles */
.comment-image-wrapper {
    margin-top: 8px;
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-body);
}

.comment-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.comment-image-preview-container {
    margin-bottom: 8px;
    position: relative;
    display: none;
    width: fit-content;
}

.comment-image-preview {
    max-width: 100px;
    max-height: 100px;
    border-radius: 4px;
    border: 1px solid var(--primary);
}

.remove-comment-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid var(--bg-surface);
}