:root {
    --primary: #00C853;
    --primary-dark: #00A844;
    --primary-light: #E8F5E9;
    --bg: #F5F5F5;
    --white: #FFFFFF;
    --text-main: #1A1A1A;
    --text-muted: #777777;
    --border: #E0E0E0;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --radius-lg: 20px;
    --radius-md: 14px;
    --error: #FF3D71;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Google Sans Flex', -apple-system, sans-serif;
}
html, body {
    height: 100%;
}
body {
    background-color: var(--bg);
    color: var(--text-main);
    overflow-x: hidden;
    font-family: 'Google Sans Flex', -apple-system, sans-serif;
}
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden;
    min-height: calc(100vh - 40px);
}

/* ensure filters menu hidden by default unless opened */
.filters-menu { 
    display: none; 
}

/* Desktop: center the filters menu with backdrop */
@media (min-width: 601px) {
    .filters-menu.open {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1250;
        background: rgba(0, 0, 0, 0.22);
        backdrop-filter: blur(2px);
        align-items: flex-start;
        justify-content: center;
        padding-top: 80px; /* push below top bar */
    }

    .filters-menu .filters-menu-inner {
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 28px;
        width: 360px;
        margin: 0 auto;
    }
}
.sidebar {
    padding: 24px;
    position: sticky;
    top: 20px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-lg);
    align-self: start;
}
.logo {
    font-family: 'Bowlby One SC', cursive;
    font-size: 26px;
    color: var(--primary);
    margin-bottom: 30px;
    text-decoration: none;
    text-align: center;
}
.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
}
.nav-item:hover, .nav-item.active {
    background: var(--primary);
    color: var(--white);
}
.main-content {
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.create-post-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.post-input {
    background: var(--bg);
    border: none;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
}
.post-input::placeholder {
    color: var(--text-muted);
}
.create-post-box .post-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
}
.create-post-box .post-actions i {
    color: var(--text-muted);
    cursor: pointer;
    width: 20px;
    height: 20px;
}
.create-post-box .post-actions i:hover {
    color: var(--primary);
}
input[type="checkbox"]:checked + .anon-icon {
    color: var(--primary) !important;
}
input[type="checkbox"]:checked + .update-icon {
    color: var(--primary);
}
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 8px 22px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover {
    background: var(--primary-dark);
}
.profile-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 30px;
}
.profile-banner {
    height: 200px;
    background: var(--bg);
    position: relative;
    background-size: cover;
    background-position: center;
}
.profile-info {
    padding: 0 40px 40px 40px;
    text-align: center;
    position: relative;
}
.profile-avatar-wrapper {
    width: 150px;
    height: 150px;
    margin: -75px auto 20px auto;
    position: relative;
}
.profile-avatar-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 6px solid var(--white);
    background: var(--white);
    object-fit: cover;
}
.profile-name {
    font-size: 24px;
    font-weight: 800;
}
.profile-username {
    color: var(--text-muted);
    font-size: 16px;
    margin-bottom: 20px;
}
.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
}
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.stat-value {
    font-weight: 800;
    font-size: 18px;
}
.stat-label {
    font-size: 14px;
    color: var(--text-muted);
}
.profile-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-primary:hover {
    background: var(--primary-dark);
}
.btn-secondary {
    background: var(--white);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.btn-secondary:hover { 
    background: var(--bg);
}
.top-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 90;
}
@media (max-width: 600px) {
    body { overflow-x: hidden; overflow-y: auto; }
}
.top-bar i {
    width: 22px;
    height: 22px;
    color: var(--text-main);
    cursor: pointer;
    flex-shrink: 0;
}
.feed {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 100%;
    margin: 0;
}
.post-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: visible;
}
.post-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.user-name {
    font-weight: 700;
    font-size: 15px;
    word-break: break-all;
}
.post-image {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    display: block;
}
.post-actions {
    padding: 15px 20px;
    display: flex;
    gap: 20px;
}
.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
}
.action-btn:hover {
    color: var(--primary);
}
.post-caption {
    padding: 0 20px 20px 20px;
    font-size: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}
.post-caption .caption-text {
    display: block;
    margin-top: 4px;
}
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 10px 0;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}
.bottom-nav i {
    color: var(--text-muted);
    cursor: pointer;
    width: 24px;
    height: 24px;
}
.bottom-nav-create {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-top: -24px;
    box-shadow: 0 4px 12px rgba(0, 200, 83, 0.4);
    transition: all 0.2s;
}
.bottom-nav-create i {
    color: var(--white) !important;
    width: 24px;
    height: 24px;
}
.bottom-nav-create.open {
    transform: rotate(45deg);
}
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-content {
    background: var(--white);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    padding: 25px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    color: var(--text-main);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}
#notifications-list, #search-results, #comments-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}
#notifications-list::-webkit-scrollbar, #search-results::-webkit-scrollbar, #comments-list::-webkit-scrollbar {
    width: 6px;
}
#notifications-list::-webkit-scrollbar-thumb, #search-results::-webkit-scrollbar-thumb, #comments-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}
.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.comment-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.comment-content {
    background: var(--bg);
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
}
.comment-user {
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
}
.comment-text {
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}
.search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}
.search-item:hover {
    background: var(--bg);
}
.search-item img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}
.notif-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-item img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.notif-item div {
    font-size: 14px;
    line-height: 1.4;
}
.feed-mode-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--white);
}
.feed-mode {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.feed-mode.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.filter-btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--white);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}
.filter-btn-icon i {
    width: 16px;
    height: 16px;
    color: var(--text-main);
}
@media (max-width: 1100px) {
    .app-container { grid-template-columns: 72px 1fr; }
    .nav-item span { display: none; }
}
@media (max-width: 600px) {
    .app-container { grid-template-columns: 1fr; padding: 0; }
    .sidebar { display: none; }
    .bottom-nav { display: flex; padding: 10px 20px; }
    .main-content { padding: 0 0 80px 0; }
    .top-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--white); position: sticky; top: 0; z-index: 90; border-bottom: none; }
    .floating-logout { display: none !important; }
    #desktop-create-box { display: none !important; }

    /* === FILTERS === */
    .feed-filters {
        display: none !important;
    }
    .feed-mode-bar {
        display: flex;
        padding: 6px 16px;
        gap: 8px;
        align-items: center;
        background: var(--white);
    }
    .filter-btn-icon {
        display: flex;
    }
    .feed-mode {
        padding: 6px 16px;
        font-size: 13px;
    }

    /* Mini filters menu (anchored top-right on mobile with backdrop) */
    .filters-menu {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 1250;
        display: none;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(3px);
        align-items: flex-start;
        justify-content: flex-end;
        padding-top: 90px;
        padding-right: 10px;
    }
    .filters-menu.open { display: flex; }
    .filters-menu .filters-menu-inner {
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 28px;
        width: 320px;
        box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
        backdrop-filter: blur(6px);
    }
    .filters-menu .filter-btn {
        display: flex !important;
        align-items: center;
        gap: 14px;
        width: 100%;
        text-align: left;
        padding: 14px 16px;
        margin-bottom: 14px;
        border-radius: 14px;
        border: 1px solid transparent;
        background: transparent;
        font-size: 15px;
        cursor: pointer;
        transition: all 0.18s ease;
        box-shadow: none !important;
        color: var(--text-main);
    }
    .filters-menu .filter-btn:hover {
        background: var(--bg);
        border-color: var(--primary);
    }
    .filters-menu .filter-btn.active {
        background: var(--primary);
        color: var(--white);
        border-color: var(--primary);
        font-weight: 800;
    }
    .filters-menu .filter-btn:last-child { margin-bottom: 0; }
    .feed-filters .filter-btn:active {
        transform: scale(0.95);
    }

    /* hide original horizontal filters on mobile — use the toggle menu instead */
    .feed-filters { display: none !important; }

    /* === POSTS === */
    .feed {
        gap: 12px !important;
        padding: 0 !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
    .post-card {
        margin: 12px !important;
        border-radius: 12px;
        box-shadow: 0 6px 20px rgba(0,0,0,0.04);
        border: 1px solid var(--border);
    }
    .post-card:first-child { border-top: none; }
    .post-card:last-child { margin-bottom: 20px !important; }
    .post-card.has-image {
        height: auto !important;
        display: block !important;
        max-height: none !important;
    }
    .post-card.has-image .post-header { flex-shrink: 0; padding: 12px 16px; }
    .post-card.has-image .post-caption { flex-shrink: 0; max-height: none; overflow-y: visible; padding: 8px 16px; }
    .post-card.has-image .post-image {
        width: 100% !important;
        height: auto !important;
        max-height: 70vh !important;
        object-fit: contain !important;
        display: block !important;
    }
    .post-card.has-image .post-actions { flex-shrink: 0; padding: 12px 16px; }
    .post-header { padding: 12px 16px; }
    .post-caption { padding: 8px 16px 12px 16px; font-size: 14px; }
    .post-actions { padding: 12px 16px; gap: 15px; }
}
.mobile-create-panel {
    display: none;
    position: fixed;
    bottom: 60px;
    left: 0;
    width: 100%;
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 16px 20px;
    z-index: 999;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    animation: slideUp 0.25s ease;
}
.mobile-create-panel.open {
    display: block;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.mobile-create-inner {
    max-width: 600px;
    margin: 0 auto;
}
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    background: var(--primary);
    color: var(--white);
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 6px 20px rgba(0, 200, 83, 0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    min-width: 260px;
    justify-content: center;
    text-align: center;
}
@keyframes toast-in {
    from { transform: translateY(100px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.toast.error {
    background: var(--error);
    box-shadow: 0 6px 20px rgba(255, 61, 113, 0.3);
}
.profile-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.profile-card .profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.profile-picture {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
}
.profile-card .profile-info {
    flex: 1;
    padding: 0;
    text-align: left;
    position: static;
}
.profile-card .profile-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}
.profile-card .profile-title {
    font-size: 13px;
    color: var(--text-muted);
}
.verified-badge {
    color: var(--primary);
}
.profile-card .profile-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0;
    gap: 0;
}
.profile-card .stat {
    text-align: center;
}
.profile-card .stat-value {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}
.profile-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
}
.feed-filters {
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    gap: 0;
}
.feed-filters::-webkit-scrollbar { display: none; }
.feed-filters .filter-btn {
    scroll-snap-align: start;
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    flex: 1;
    justify-content: center;
    padding: 12px 16px;
}
.feed-filters .filter-btn:last-of-type {
    border-right: none;
}
.feed-filters .filter-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
    margin: 0 4px;
}
.feed-filters .feed-mode {
    flex: none;
    border: none;
    margin: 0;
}
.filter-btn {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.filter-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
