:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --bg-main: #0a0b0d;
    --bg-card: #1a1b1e;
    --bg-hover: #2a2b2e;
    --border: #2f3136;
    --text: #ffffff;
    --text-muted: #b9bbbe;
}

/* === Theme variable fallbacks === */
/* If a preset doesn't define one of these, we have safe defaults */
:root {
    --theme-hover: #2a2b35;
    --theme-accent-dark: #4f46e5;
    --theme-shadow: rgba(0,0,0,0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--theme-bg);
    color: var(--text);
    line-height: 1.6;
}

/* ===== TOP HEADER ===== */
.top-header {
    background: var(--theme-card);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 2rem;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 3rem;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-accent);
}

.logo-section i {
    font-size: 2rem;
}

/* ===== MAIN NAVIGATION ===== */
.main-nav {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.main-nav button {
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.main-nav button:hover {
    background: var(--theme-hover);
    color: var(--text);
}

.main-nav button.active {
    background: var(--theme-accent);
    color: white;
}

.main-nav button i {
    font-size: 1.25rem;
}

.nav-badge {
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* ===== HEADER ACTIONS ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--theme-text-secondary);
}

.search-box input {
    background: var(--theme-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    color: var(--text);
    width: 250px;
    font-size: 0.95rem;
}

.search-box input:focus {
    outline: none;
    border-color: var(--theme-accent);
}

.logout-btn {
    background: var(--danger);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: opacity 0.2s;
}

.logout-btn:hover {
    opacity: 0.9;
}

/* ===== PAGE CONTAINER ===== */
.page-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* ===== FEED LAYOUT ===== */
.feed-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 2rem;
}

/* ===== LEFT SIDEBAR ===== */
.sidebar-left {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.profile-card {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.profile-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 1rem;
    border: 3px solid var(--theme-accent);
}

.profile-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.profile-card p {
    color: var(--theme-text-secondary);
    margin-bottom: 1.5rem;
}

.btn-view-profile {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
}

.quick-stats {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    color: var(--theme-text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--theme-accent);
}

/* ===== FEED MAIN ===== */
.feed-main {
    min-width: 0;
}

/* ===== POST CREATOR ===== */
.post-creator {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.post-creator h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

.create-area {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.create-area textarea {
    flex: 1;
    background: var(--theme-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text);
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
}

.create-area textarea:focus {
    outline: none;
    border-color: var(--theme-accent);
}

.create-actions {
    display: flex;
    justify-content: flex-end;
}

.btn-post {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-post:hover {
    background: var(--theme-accent-dark);
}

/* ===== POST ITEM ===== */
.post-item {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.post-author {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.author-info h4 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.author-info span {
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
}

.post-body p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
    font-size: 1rem;
}

.post-img {
    width: 100%;
    border-radius: 12px;
    margin-top: 1rem;
}

.post-stats {
    display: flex;
    gap: 2rem;
    padding: 1rem 0;
    color: var(--theme-text-secondary);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.post-stats i {
    margin-right: 0.5rem;
}

.post-actions {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
}

.post-actions button {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--theme-text-secondary);
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.post-actions button:hover {
    background: var(--theme-hover);
    color: var(--text);
}

.post-actions button.liked {
    color: var(--danger);
    border-color: var(--danger);
}

/* ===== COMMENTS ===== */
.comments-area {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
    margin-top: 1rem;
}

.comment-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.comment-content {
    background: var(--theme-bg);
    padding: 1rem;
    border-radius: 12px;
    flex: 1;
}

.comment-content strong {
    display: block;
    margin-bottom: 0.5rem;
}

.comment-content p {
    margin-bottom: 0.5rem;
}

.comment-time {
    color: var(--theme-text-secondary);
    font-size: 0.85rem;
}

.comment-input-box {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.comment-input-box input {
    flex: 1;
    background: var(--theme-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.75rem 1rem;
    color: var(--text);
}

.comment-input-box input:focus {
    outline: none;
    border-color: var(--theme-accent);
}

/* ===== RIGHT SIDEBAR ===== */
.sidebar-right {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.online-section,
.friend-requests-section {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.online-section h3,
.friend-requests-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.online-friend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    margin-bottom: 0.5rem;
}

.online-friend:hover {
    background: var(--theme-hover);
}

.online-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    position: absolute;
    left: 32px;
    bottom: 8px;
    border: 2px solid var(--theme-card);
}

.request-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    background: var(--theme-bg);
    margin-bottom: 1rem;
}

.request-info {
    flex: 1;
}

.request-info strong {
    display: block;
    margin-bottom: 0.75rem;
}

.request-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-accept,
.btn-decline {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
}

.btn-accept {
    background: var(--theme-accent);
    color: white;
}

.btn-decline {
    background: var(--theme-hover);
    color: var(--theme-text-secondary);
}

/* ===== PROFILE LAYOUT ===== */
.profile-layout {
    max-width: 900px;
    margin: 0 auto;
}

.profile-container {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.profile-header-card {
    position: relative;
}

.cover-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
}

.profile-main-info {
    padding: 2rem;
    padding-top: 2.5rem;
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    margin-top: -60px;
    background: var(--theme-card);
    position: relative;
    z-index: 1;
}

.profile-pic {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 5px solid var(--theme-card);
}

.profile-text {
    flex: 1;
    padding-top: 80px;
}

.profile-text h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.profile-text p {
    color: var(--theme-text-secondary);
}

.btn-edit {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-stats-row {
    display: flex;
    justify-content: space-around;
    padding: 2rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat-box {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--theme-accent);
    margin-bottom: 0.5rem;
}

.stat-text {
    color: var(--theme-text-secondary);
    font-size: 0.95rem;
}

.edit-profile-section {
    padding: 2rem;
}

.edit-profile-section h2 {
    margin-bottom: 2rem;
}

.edit-form {
    max-width: 600px;
}

.form-row {
    margin-bottom: 1.5rem;
}

.form-row label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--theme-text-secondary);
    font-weight: 500;
}

.form-row input,
.form-row textarea {
    width: 100%;
    background: var(--theme-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}

.form-row input:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--theme-accent);
}

.button-row {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-save,
.btn-cancel {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

.btn-save {
    background: var(--theme-accent);
    color: white;
}

.btn-cancel {
    background: var(--theme-hover);
    color: var(--text);
}

/* ===== FRIENDS LAYOUT ===== */
.friends-layout {
    max-width: 1000px;
    margin: 0 auto;
}

.friends-layout h1 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

.section-card {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.section-card h2 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

.friend-box {
    background: var(--theme-bg);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    position: relative;
}

.friend-pic {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.friend-online-badge {
    width: 16px;
    height: 16px;
    background: var(--success);
    border: 3px solid var(--theme-bg);
    border-radius: 50%;
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(20px);
}

.friend-box h4 {
    margin-bottom: 0.5rem;
}

.friend-box p {
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.btn-primary-sm,
.btn-secondary-sm {
    width: 100%;
    padding: 0.6rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 0.5rem;
}

.btn-primary-sm {
    background: var(--theme-accent);
    color: white;
}

.btn-secondary-sm {
    background: var(--theme-hover);
    color: var(--text);
}

/* ===== MESSAGES LAYOUT ===== */
.messages-layout {
    max-width: 100%;
}

.messages-wrapper {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    height: calc(100vh - 180px);
    display: grid;
    grid-template-columns: 350px 1fr;
    overflow: hidden;
}

.conversations-sidebar {
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 1.5rem;
}

.btn-new-chat {
    background: var(--theme-accent);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.conversation {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    position: relative;
    transition: background 0.2s;
}

.conversation:hover {
    background: var(--theme-hover);
}

.conversation.active {
    background: var(--theme-hover);
}

.conv-online-dot {
    width: 12px;
    height: 12px;
    background: var(--success);
    border: 2px solid var(--theme-card);
    border-radius: 50%;
    position: absolute;
    left: 50px;
    top: 45px;
}

.conv-details {
    flex: 1;
    min-width: 0;
}

.conv-details h4 {
    margin-bottom: 0.25rem;
}

.conv-details p {
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-time {
    text-align: right;
}

.conv-time small {
    color: var(--theme-text-secondary);
    font-size: 0.8rem;
}

.unread-badge {
    background: var(--theme-accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    margin-top: 0.5rem;
}

.chat-area {
    display: flex;
    flex-direction: column;
}

.chat-top {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-top h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.chat-top small {
    color: var(--success);
    font-size: 0.9rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message-row {
    display: flex;
}

.message-row.sent {
    justify-content: flex-end;
}

.message-row.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 60%;
    padding: 1rem 1.5rem;
    border-radius: 18px;
}

.message-row.received .message-bubble {
    background: var(--theme-bg);
}

.message-row.sent .message-bubble {
    background: var(--theme-accent);
    color: white;
}

.message-bubble p {
    margin-bottom: 0.5rem;
}

.message-bubble small {
    font-size: 0.8rem;
    opacity: 0.7;
}

.chat-input-area {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 1rem;
}

.chat-input-area input {
    flex: 1;
    background: var(--theme-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.75rem 1.5rem;
    color: var(--text);
    font-size: 1rem;
}

.chat-input-area input:focus {
    outline: none;
    border-color: var(--theme-accent);
}

.btn-send {
    background: var(--theme-accent);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.no-chat-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--theme-text-secondary);
    gap: 1rem;
}

.no-chat-selected i {
    font-size: 5rem;
    opacity: 0.3;
}

/* ===== GROUPS LAYOUT ===== */
.groups-layout {
    max-width: 1000px;
    margin: 0 auto;
}

.groups-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.groups-header h1 {
    font-size: 2rem;
}

.btn-create-group {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.groups-grid-lg {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.group-card-lg {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.group-image {
    width: 140px;
    height: 140px;
    border-radius: 12px;
    margin: 0 auto 1.5rem;
}

.group-card-lg h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.group-card-lg p {
    color: var(--theme-text-secondary);
    margin-bottom: 1rem;
}

.group-privacy {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--theme-bg);
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
    margin-bottom: 1rem;
}

.btn-joined,
.btn-join {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-joined {
    background: var(--theme-bg);
    color: var(--theme-text-secondary);
}

.btn-join {
    background: var(--theme-accent);
    color: white;
}

/* ===== MODALS ===== */
.modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: var(--theme-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-head {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-head h3 {
    font-size: 1.5rem;
}

.modal-head button {
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-friend {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
}

.modal-friend:hover {
    background: var(--theme-hover);
}

.modal-online-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    position: absolute;
    right: 1rem;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--theme-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-text-secondary);
}

/* Improved Mobile */
@media (max-width: 768px) {
    .feed-layout-MOBILE { display: block !important; width: 100% !important; max-width: 100vw !important; padding: 0 !important; }
    .feed-column { width: 100% !important; max-width: 100% !important; }
    .nav-bar { overflow-x: auto !important; flex-wrap: nowrap !important; justify-content: flex-start !important; padding: 8px 5px !important; gap: 2px !important; }
    .nav-bar button { flex-shrink: 0 !important; padding: 8px 10px !important; min-width: auto !important; }
    .nav-bar button span { display: none !important; }
    .nav-bar button i { font-size: 18px !important; }
    .sidebar-left, .sidebar-right { display: none !important; }
    .create-post-card, .post-card, .profile-header-card { margin: 8px !important; border-radius: 10px !important; }
    .post-actions { flex-wrap: wrap !important; }
    .post-actions button { flex: 1 !important; font-size: 12px !important; padding: 8px 4px !important; }
    .profile-main-info { flex-direction: column !important; text-align: center !important; }
    .profile-pic { margin-top: -40px !important; }
    .btn-edit { font-size: 12px !important; padding: 6px 12px !important; }
    .cover-image { height: 130px !important; }
}
@media (max-width: 480px) {
    .nav-bar { padding: 6px 2px !important; }
    .nav-bar button { padding: 6px 6px !important; }
    .post-card, .create-post-card { margin: 4px !important; border-radius: 8px !important; }
    body { font-size: 14px !important; }
}

@media (max-width: 768px) {
    .nav-bar { flex-wrap: nowrap; overflow-x: auto; padding: 8px 10px !important; gap: 2px !important; -webkit-overflow-scrolling: touch; }
    .nav-bar button { font-size: 11px !important; padding: 6px 8px !important; white-space: nowrap; min-width: auto !important; }
    .nav-bar button span { display: none; }
    .nav-bar button i { font-size: 16px !important; }
    .feed-layout-MOBILE { grid-template-columns: 1fr !important; padding: 0 8px !important; }
    .sidebar-left, .sidebar-right { display: none !important; }
    .create-post-card, .post-card { border-radius: 8px !important; margin-bottom: 10px !important; }
    .profile-container { padding: 0 8px !important; }
    .profile-header-card { border-radius: 8px !important; }
    .profile-main-info { flex-direction: column !important; text-align: center !important; padding: 10px !important; }
    .profile-pic { margin-top: -40px !important; width: 80px !important; height: 80px !important; }
    .profile-stats { flex-wrap: wrap !important; }
    .profile-stat { min-width: 70px !important; }
    .post-actions { flex-wrap: wrap !important; gap: 4px !important; }
    .post-actions button { font-size: 12px !important; padding: 6px 10px !important; flex: 1 !important; min-width: 0 !important; }
    .chat-container { height: calc(100vh - 120px) !important; }
    .chat-sidebar { width: 100% !important; }
    .chat-main { width: 100% !important; }
    h1 { font-size: 20px !important; }
    .cover-image { height: 120px !important; }
    .btn-edit { font-size: 12px !important; padding: 6px 12px !important; }
}

@media (max-width: 480px) {
    .nav-bar { padding: 6px 4px !important; }
    .nav-bar button { padding: 6px !important; }
    .post-card { margin: 0 -8px 10px !important; border-radius: 0 !important; }
    .profile-main-info > div { flex-direction: column !important; gap: 6px !important; }
}

/* === MOBILE FIX === */
@media (max-width: 768px) {
    .feed-layout { display: block !important; }
    .sidebar-left, .sidebar-right { display: none !important; }
    .feed-main { width: 100% !important; max-width: 100% !important; }
    .page-container { padding: 0 8px !important; margin: 10px auto !important; }
    .nav-bar { overflow-x: auto !important; flex-wrap: nowrap !important; padding: 8px 5px !important; gap: 2px !important; }
    .nav-bar button { flex-shrink: 0 !important; padding: 8px 10px !important; min-width: auto !important; }
    .nav-bar button span { display: none !important; }
    .nav-bar button i { font-size: 18px !important; }
    .create-post-card, .post-card { border-radius: 10px !important; }
    .post-actions { flex-wrap: wrap !important; }
    .post-actions button { flex: 1 !important; font-size: 12px !important; padding: 8px 4px !important; }
    .profile-layout { padding: 0 !important; }
    .profile-container { padding: 0 8px !important; }
    .profile-header-card { border-radius: 10px !important; }
    .profile-main-info { flex-direction: column !important; text-align: center !important; gap: 10px !important; }
    .profile-pic { margin-top: -40px !important; }
    .profile-stats { flex-wrap: wrap !important; gap: 10px !important; }
    .cover-image { height: 130px !important; }
    .btn-edit { font-size: 12px !important; padding: 6px 12px !important; }
    .chat-container { flex-direction: column !important; height: auto !important; }
    .conversations-sidebar { width: 100% !important; max-height: 300px !important; }
    .chat-main { width: 100% !important; }
    .logout-btn span { display: none !important; }
}
@media (max-width: 480px) {
    .nav-bar { padding: 5px 2px !important; }
    .nav-bar button { padding: 6px 6px !important; }
    .post-card, .create-post-card { margin-bottom: 8px !important; }
    .page-container { padding: 0 4px !important; }
}
/* ========== ESA MOBILE APP ========== */
@media screen and (max-width: 768px) {
    * { box-sizing: border-box !important; }
    
    body { overflow-x: hidden !important; width: 100vw !important; }
    
    /* Nav - icon only horizontal scroll */
    .nav-bar {
        display: flex !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        padding: 6px 4px !important;
        gap: 0 !important;
        -webkit-overflow-scrolling: touch;
    }
    .nav-bar button {
        flex: 0 0 auto !important;
        padding: 8px 12px !important;
        min-width: auto !important;
        font-size: 16px !important;
    }
    .nav-bar button span { display: none !important; }
    .nav-bar button i { font-size: 18px !important; margin: 0 !important; }
    .nav-bar .logo { font-size: 14px !important; }
    .nav-bar .logo span { display: none !important; }
    .nav-bar input[type="text"] { width: 100px !important; font-size: 12px !important; padding: 6px !important; }
    .logout-btn { padding: 6px 10px !important; font-size: 12px !important; }
    .logout-btn span, .logout-btn .btn-text { display: none !important; }
    
    /* Feed - single column, no sidebars */
    .feed-layout {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0 !important;
        padding: 0 !important;
    }
    .sidebar-left { display: none !important; }
    .sidebar-right { display: none !important; }
    .feed-main { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    
    .page-container { padding: 0 6px !important; margin: 8px auto !important; max-width: 100vw !important; }
    
    /* Cards */
    .create-post-card, .post-card {
        border-radius: 10px !important;
        margin-bottom: 10px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .post-card img.post-image { max-height: 300px !important; width: 100% !important; }
    .post-card video { max-height: 300px !important; width: 100% !important; }
    
    /* Post actions row */
    .post-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 4px !important;
        padding: 8px !important;
    }
    .post-actions button {
        flex: 1 1 auto !important;
        font-size: 12px !important;
        padding: 8px 6px !important;
        min-width: 0 !important;
    }
    
    /* Profile */
    .profile-layout { padding: 0 !important; width: 100% !important; }
    .profile-container { padding: 0 6px !important; width: 100% !important; }
    .profile-header-card { border-radius: 10px !important; width: 100% !important; }
    .profile-main-info {
        flex-direction: column !important;
        text-align: center !important;
        align-items: center !important;
        gap: 8px !important;
        padding: 10px !important;
    }
    .profile-main-info > div:last-child { margin-left: 0 !important; }
    .profile-pic { margin-top: -40px !important; width: 80px !important; height: 80px !important; }
    .profile-text { text-align: center !important; }
    .profile-stats { flex-wrap: wrap !important; justify-content: center !important; gap: 8px !important; }
    .profile-stat { min-width: 65px !important; }
    .cover-image { height: 120px !important; }
    .btn-edit { font-size: 11px !important; padding: 6px 10px !important; }
    
    /* Messages */
    .chat-container { flex-direction: column !important; height: auto !important; min-height: 70vh !important; }
    .conversations-sidebar { width: 100% !important; max-height: 250px !important; overflow-y: auto !important; }
    .chat-main { width: 100% !important; min-height: 400px !important; }
    
    /* Groups */
    .group-grid { grid-template-columns: 1fr !important; }
    
    /* Search */
    .search-input { width: 80px !important; }
    
    /* Modals */
    div[style*="position:fixed"] > div { width: 90vw !important; max-width: 90vw !important; }
}

@media screen and (max-width: 480px) {
    .nav-bar button { padding: 6px 8px !important; }
    .nav-bar { padding: 4px 2px !important; }
    h1 { font-size: 18px !important; }
    .page-container { padding: 0 2px !important; }
}

/* Standalone PWA adjustments */
@media (display-mode: standalone) {
    body { padding-top: env(safe-area-inset-top) !important; }
    .nav-bar { padding-top: env(safe-area-inset-top) !important; }
}

/* ===== FEATURES CSS ===== */
.modal-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.6);display:flex;align-items:center;justify-content:center;z-index:9999;animation:fadeIn 0.2s ease}
.modal-box{background:var(--theme-card,#16162a);border:1px solid var(--theme-border,#2a2a3e);border-radius:12px;padding:24px;max-width:420px;width:90%;box-shadow:0 4px 16px rgba(0,0,0,0.4);animation:slideUp 0.25s ease}
.modal-box h3{margin:0 0 8px;font-size:18px;color:var(--theme-text,#eee)}
.modal-box p{margin:0 0 20px;color:var(--theme-text-secondary,#aaa);font-size:14px}
.modal-actions{display:flex;gap:12px;justify-content:flex-end}
.btn-cancel{padding:8px 20px;border-radius:8px;border:1px solid var(--theme-border,#2a2a3e);background:var(--theme-bg,#0a0a1a);color:var(--theme-text,#eee);cursor:pointer;font-size:14px}
.btn-cancel:hover{opacity:0.8}
.btn-danger{padding:8px 20px;border-radius:8px;border:none;background:#e74c3c;color:white;cursor:pointer;font-size:14px}
.btn-danger:hover{background:#c0392b}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes slideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
.loading-spinner{width:32px;height:32px;border:3px solid var(--theme-border,#2a2a3e);border-top-color:var(--theme-accent,#6366f1);border-radius:50%;animation:spin 0.8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.no-more-posts{text-align:center;padding:20px;color:var(--theme-text-secondary,#aaa);font-size:14px}
.session-warning{position:fixed;top:20px;left:50%;transform:translateX(-50%);background:var(--theme-card,#16162a);border:1px solid #f39c12;border-radius:12px;padding:16px 24px;box-shadow:0 4px 16px rgba(0,0,0,0.4);z-index:10000;display:flex;align-items:center;gap:16px;max-width:480px}
.btn-extend{padding:8px 16px;border-radius:8px;border:none;background:var(--theme-accent,#6366f1);color:white;cursor:pointer;font-weight:500}
.toast{padding:12px 20px;border-radius:10px;color:white;font-size:14px;font-weight:500;box-shadow:0 4px 16px rgba(0,0,0,0.4);opacity:0;transform:translateX(40px);transition:all 0.3s ease;pointer-events:auto;max-width:360px}
.toast-show{opacity:1;transform:translateX(0)}
.toast-success{background:#27ae60}
.toast-error{background:#e74c3c}
.toast-info{background:#3498db}
.toast-warning{background:#f39c12}


/* ===== THEME OVERRIDE - applies --theme-* vars to all elements ===== */
body { background-color: var(--theme-bg) !important; color: var(--theme-text) !important; }
.nav-bar, nav, header, [class*="navbar"], [class*="nav-"] { background-color: var(--theme-navbar, var(--theme-card)) !important; }
.sidebar, [class*="sidebar"] { background-color: var(--theme-card) !important; }
.card, .post-card, [class*="card"], [style*="background:#16162a"], [style*="background: #16162a"], [style*="background:#1e1e2e"], [style*="background: #1e1e2e"] { background-color: var(--theme-card) !important; border-color: var(--theme-border) !important; }
[style*="background:#0a0a1a"], [style*="background: #0a0a1a"], [style*="background:#0f0f23"], [style*="background: #0f0f23"] { background-color: var(--theme-bg) !important; }
[style*="background:#1a1a2e"], [style*="background: #1a1a2e"] { background-color: var(--theme-input) !important; }
[style*="color:#eee"], [style*="color: #eee"], [style*="color:#eeeeee"], [style*="color:#fff"], [style*="color: #fff"], [style*="color:white"] { color: var(--theme-text) !important; }
[style*="color:#aaa"], [style*="color: #aaa"], [style*="color:#aaaaaa"], [style*="color:#888"], [style*="color:#999"], [style*="color:#ccc"] { color: var(--theme-text-secondary) !important; }
[style*="border-color:#2a2a3e"], [style*="border-color: #2a2a3e"], [style*="border:1px solid #2a2a3e"], [style*="border:1px solid #333"], [style*="border: 1px solid #333"], [style*="border:1px solid #2a2a3e"] { border-color: var(--theme-border) !important; }
input, textarea, select { background-color: var(--theme-input) !important; color: var(--theme-text) !important; border-color: var(--theme-border) !important; }
input::placeholder, textarea::placeholder { color: var(--theme-text-secondary) !important; }
button[style*="background:#6366f1"], [style*="background: #6366f1"], .btn-primary { background-color: var(--theme-accent) !important; }


/* ============================================================
   PHASE 4 â€” Clean layout, theme-aware, single source of truth
   Replaces all earlier Phase 2 / 3 / 3.1 work (now removed).
   Uses --theme-* vars throughout so theme selector works.
   ============================================================ */

/* Layout grid */
.feed-layout {
    display: grid;
    grid-template-columns: 320px 1fr 340px;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px 24px;
}
.sidebar-left, .sidebar-right {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-self: start;
    position: sticky;
    top: 16px;
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    overflow: hidden;
}
/* Sidebar children become sections of the unified panel, not floating cards */
.sidebar-left > *, .sidebar-right > * {
    border-radius: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--theme-border) !important;
}
.sidebar-left > *:last-child, .sidebar-right > *:last-child {
    border-bottom: none !important;
}

/* Override the 680px cap on feed-main */
.feed-main {
    max-width: none !important;
    min-width: 0;
}

/* === LEFT SIDEBAR === */
.profile-card {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 16px 12px;
    text-align: center;
}
.profile-card img {
    width: 64px; height: 64px;
    border-radius: 50%;
    border: 2px solid var(--theme-accent);
    object-fit: cover;
}
.profile-card h3 { margin: 8px 0 2px; font-size: 14px; color: var(--theme-text); }
.profile-card p { margin: 0 0 10px; font-size: 11px; color: var(--theme-text-secondary); }
.btn-view-profile {
    width: 100%;
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 7px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-view-profile:hover { background: var(--theme-accent-dark); }
.btn-view-profile:active { transform: scale(0.98); }

.sidebar-nav {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 6px;
    display: flex;
    flex-direction: column;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    color: var(--theme-text);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.nav-link:hover { background: var(--theme-hover); }
.nav-link i {
    width: 18px;
    color: var(--theme-accent);
    font-size: 14px;
    text-align: center;
}

.stats-row {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.stat {
    text-align: center;
    padding: 6px 4px;
    background: var(--theme-bg);
    border-radius: 6px;
}
.stat-num {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--theme-accent);
}
.stat-lbl {
    display: block;
    font-size: 10px;
    color: var(--theme-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* === STORIES RAIL === */
.stories-rail {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    margin-bottom: 12px;
    scrollbar-width: thin;
}
.stories-rail::-webkit-scrollbar { height: 4px; }
.stories-rail::-webkit-scrollbar-thumb {
    background: var(--theme-hover);
    border-radius: 2px;
}
.story-add, .story-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    min-width: 70px;
    transition: transform 0.15s;
}
.story-add:hover, .story-item:hover { transform: translateY(-2px); }
.story-add-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 2px dashed var(--theme-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--theme-accent);
    font-size: 18px;
}
.story-item img {
    width: 56px; height: 56px;
    border-radius: 50%;
    border: 2px solid var(--theme-accent);
    object-fit: cover;
}
.story-add span, .story-item span {
    margin-top: 4px;
    font-size: 11px;
    color: var(--theme-text-secondary);
    max-width: 70px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === COMPOSER === */
.composer {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}
.composer-header {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.composer-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.composer-header textarea {
    flex: 1;
    background: var(--theme-bg);
    border: 1px solid transparent;
    border-radius: 18px;
    padding: 10px 14px;
    color: var(--theme-text);
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.15s;
    font-family: inherit;
}
.composer-header textarea:focus {
    outline: none;
    border-color: var(--theme-accent);
}
.composer-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--theme-border);
}
.composer-btn {
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s;
}
.composer-btn:hover {
    background: var(--theme-hover);
    color: var(--theme-accent);
}
.composer-privacy {
    background: var(--theme-bg);
    color: var(--theme-text);
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 12px;
    margin-left: auto;
    cursor: pointer;
}
.btn-post {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s, transform 0.1s;
}
.btn-post:hover { background: var(--theme-accent-dark); }
.btn-post:active { transform: scale(0.98); }
.composer-image-preview {
    position: relative;
    margin-top: 10px;
}
.composer-image-preview img {
    max-height: 200px;
    border-radius: 8px;
}
.composer-remove-img {
    position: absolute;
    top: 6px; right: 6px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    cursor: pointer;
}

/* === POSTS === */
.post-item {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    transition: border-color 0.15s;
}
.post-item:hover { border-color: var(--theme-accent); }
.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.post-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
}
.post-author { flex: 1; min-width: 0; }
.post-author h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--theme-text);
    cursor: pointer;
}
.post-author h4:hover { color: var(--theme-accent); }
.post-author span {
    font-size: 12px;
    color: var(--theme-text-secondary);
    cursor: pointer;
}
.post-menu-wrap { position: relative; }
.post-menu-btn {
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}
.post-menu-btn:hover { background: var(--theme-hover); }
.post-menu-dropdown {
    position: absolute;
    right: 0; top: 32px;
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 4px;
    min-width: 160px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    color: var(--theme-text);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}
.menu-item:hover { background: var(--theme-hover); }
.menu-item i { color: var(--theme-accent); width: 14px; }
.menu-danger { color: #ff6b6b; }
.menu-danger i { color: #ff6b6b !important; }

.post-body { margin-bottom: 8px; }
.post-text p {
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--theme-text);
    font-size: 14px;
}
.post-edit textarea {
    width: 100%;
    background: var(--theme-bg);
    color: var(--theme-text);
    border: 1px solid var(--theme-accent);
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
}
.post-edit-actions { display: flex; gap: 8px; margin-top: 8px; }
.btn-save {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.btn-cancel {
    background: var(--theme-hover);
    color: var(--theme-text);
    border: none;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
}
.post-shared {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 8px 0;
    background: var(--theme-bg);
    border-radius: 6px;
    font-size: 13px;
    color: var(--theme-text-secondary);
}
.post-shared strong { color: var(--theme-accent); cursor: pointer; }
.post-shared-view { color: var(--theme-accent); cursor: pointer; margin-left: auto; font-size: 11px; }

.link-preview {
    display: block;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    text-decoration: none;
}
.link-preview img { width: 100%; max-height: 250px; object-fit: cover; }
.link-preview-body { padding: 10px 12px; }
.link-site { font-size: 11px; text-transform: uppercase; color: var(--theme-text-secondary); }
.link-title { font-weight: 600; font-size: 14px; color: var(--theme-text); margin: 4px 0; }
.link-desc { font-size: 12px; color: var(--theme-text-secondary); line-height: 1.4; }

.post-img {
    width: 100%;
    border-radius: 8px;
    margin-top: 8px;
    max-height: 500px;
    object-fit: cover;
}

.post-stats {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px;
    color: var(--theme-text-secondary);
    font-size: 12px;
}
.post-stats span i { margin-right: 4px; }

.post-actions {
    display: flex;
    gap: 0;
    padding: 4px 0;
    margin-top: 4px;
    border-top: 1px solid var(--theme-border);
}
.action-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s;
}
.action-btn:hover {
    background: var(--theme-hover);
    color: var(--theme-accent);
}
.action-btn.liked { color: var(--theme-accent); }

.post-comments {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid var(--theme-border);
}
.comment-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.comment-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}
.comment-body {
    background: var(--theme-bg);
    padding: 8px 12px;
    border-radius: 12px;
    flex: 1;
}
.comment-body strong {
    display: block;
    font-size: 12px;
    color: var(--theme-text);
}
.comment-body p {
    margin: 2px 0 0;
    font-size: 13px;
    color: var(--theme-text);
}

.comment-form { margin-top: 8px; }
.comment-input {
    width: 100%;
    background: var(--theme-bg);
    border: 1px solid var(--theme-border);
    border-radius: 18px;
    padding: 8px 14px;
    color: var(--theme-text);
    font-size: 13px;
    transition: border-color 0.15s;
}
.comment-input:focus {
    outline: none;
    border-color: var(--theme-accent);
}

/* === RIGHT SIDEBAR === */
.side-section {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 10px;
    padding: 12px;
}
.side-section h3 {
    margin: 0 0 8px;
    font-size: 12px;
    color: var(--theme-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.online-friend {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    color: var(--theme-text);
}
.online-friend:hover { background: var(--theme-hover); }
.online-friend-avatar { position: relative; }
.user-avatar-sm {
    width: 32px; height: 32px;
    border-radius: 50%;
}
.online-dot {
    position: absolute;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--theme-card);
    bottom: 0; right: 0;
}
.side-empty {
    text-align: center;
    padding: 20px 8px;
}
.side-empty i {
    font-size: 28px;
    color: var(--theme-border);
    margin-bottom: 6px;
    display: block;
}
.side-empty p {
    font-size: 12px;
    color: var(--theme-text-secondary);
    margin: 0;
}

.request-item {
    display: flex;
    gap: 10px;
    padding: 8px;
    margin-bottom: 6px;
}
.request-info { flex: 1; }
.request-info strong {
    font-size: 13px;
    color: var(--theme-text);
    display: block;
}
.request-actions { display: flex; gap: 6px; margin-top: 6px; }
.btn-accept {
    background: var(--theme-accent);
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}
.btn-decline {
    background: var(--theme-hover);
    color: var(--theme-text);
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

/* === MENTION DROPDOWN === */
.mention-dropdown {
    background: var(--theme-card);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    padding: 4px;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
}
.mention-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--theme-text);
}
.mention-item:hover { background: var(--theme-hover); }
.mention-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .feed-layout { grid-template-columns: 1fr; }
    .sidebar-left, .sidebar-right { display: none; }
}
/* Right sidebar fill content */
.suggested-item, .activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
}
.suggested-item:hover, .activity-item:hover {
    background: var(--theme-hover);
}
.suggested-info, .activity-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.suggested-info strong, .activity-info strong {
    font-size: 13px;
    color: var(--theme-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.suggested-info span, .activity-info span {
    font-size: 11px;
    color: var(--theme-text-secondary);
}
.user-avatar-xs {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.btn-add-friend {
    background: var(--theme-accent);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}
.btn-add-friend:hover {
    background: var(--theme-accent-dark);
}
.shortcut-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 8px;
    color: var(--theme-text);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}
.shortcut-row:hover {
    background: var(--theme-hover);
}
.shortcut-row i {
    width: 18px;
    color: var(--theme-accent);
    font-size: 14px;
    text-align: center;
}



/* ============================================================
   PHASE 4 FINAL — Consolidated layout overrides
   ============================================================ */

.page-container {
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.feed-layout {
    grid-template-columns: 320px minmax(0, 620px) 340px !important;
    justify-content: space-between !important;
    gap: 0 !important;
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 20px 16px !important;
    align-items: start !important;
}

.feed-main {
    margin-top: 0 !important;
}
.sidebar-left, .sidebar-right {
    margin-top: 60px !important;
}

.sidebar-nav {
    padding: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}
.nav-link {
    padding: 12px 14px !important;
    font-size: 14px !important;
    gap: 14px !important;
    border-radius: 8px !important;
    margin: 0 !important;
}
.nav-link i {
    width: 22px !important;
    font-size: 16px !important;
}