/* Theme System - Black & White with Light/Dark Mode */

:root {
    /* Light Mode (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f5f5;
    --bg-tertiary: #e0e0e0;
    --text-primary: #000000;
    --text-secondary: #333333;
    --text-tertiary: #666666;
    --border-color: #d0d0d0;
    --hover-bg: #e8e8e8;
    --accent: #000000;
    --accent-hover: #333333;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-primary: #000000;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-tertiary: #999999;
    --border-color: #333333;
    --hover-bg: #2a2a2a;
    --accent: #ffffff;
    --accent-hover: #cccccc;
    --shadow: rgba(255, 255, 255, 0.1);
    --shadow-strong: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    line-height: 1.6;
    letter-spacing: 0.3px;
}

p {
    line-height: 1.8;
    letter-spacing: 0.4px;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.theme-toggle:hover {
    opacity: 0.7;
}

/* BETA badge */
.beta {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    vertical-align: super;
    margin-left: 4px;
    letter-spacing: 1px;
}

/* Left Sidebar Navigation */
.navbar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    width: 120px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 100;
}

/* Hide mobile nav toggle and overlay on desktop */
.mobile-nav-toggle,
.mobile-nav-overlay,
.mobile-header {
    display: none;
}

.logo {
    font-size: 20px;
    font-weight: 900;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 15px;
    display: block;
    text-align: center;
    line-height: 1.2;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.nav-links a,
.nav-links button {
    color: var(--text-tertiary);
    text-decoration: none;
    transition: all 0.2s;
    padding: 15px;
    border-radius: 10px;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-links a:hover,
.nav-links button:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.theme-toggle {
    margin-top: auto;
    margin-bottom: 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    margin-left: max(140px, calc((100vw - 880px) / 2));
    padding: 20px;
}

.post-compose {
    background: var(--bg-secondary);
    border-radius: 15px;
    padding: 12px 0 12px 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    position: relative;
}

.post-compose textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    resize: none;
    height: 30px;
    max-height: 300px;
    overflow-y: auto;
    outline: none;
}

.compose-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-left: auto;
    flex: 1;
}

.char-count {
    color: var(--text-tertiary);
    font-size: 14px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border: 2px solid var(--accent);
}

.compose-footer {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.post-compose {
    position: relative;
}

/* Terminal/monospace font for ASCII art */
.post-content.monospace,
.comment-text.monospace {
    font-family: 'Courier New', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: pre;
    overflow-x: auto;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px var(--shadow-strong);
    background: var(--accent-hover);
}

.btn-primary:disabled,
.btn-primary[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background: var(--accent);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 14px;
}

.post {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 15px;
}

.post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.avatar {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    position: relative;
}

.avatar-container {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 52px;
    flex-shrink: 0;
}

.follow-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    overflow: hidden;
    display: block;
    background: var(--bg-primary);
    position: relative;
}

.avatar-container .online-status {
    position: absolute;
    bottom: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

/* Larger dot for profile page */
.profile-avatar-container .online-status {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid var(--bg-primary);
}

.online-status.online {
    background: #00ff00;
}

.online-status.offline {
    background: #808080;
}

.follow-btn-icon {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--bg-primary);
    transition: all 0.2s;
    opacity: 1;
}

.follow-btn-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px var(--shadow-strong);
}

.follow-btn-icon:active {
    transform: scale(0.95);
}

.follow-icon {
    width: 14px;
    height: 14px;
    stroke: var(--bg-primary);
    fill: none;
    stroke-width: 2.5;
    pointer-events: none;
}

.post-user {
    flex: 1;
}

.display-name {
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: none;
    display: block;
}

.display-name:hover {
    text-decoration: underline;
}

.username {
    color: var(--text-tertiary);
    font-size: 14px;
}

.post-time {
    color: var(--text-tertiary);
    font-size: 14px;
}

.post-content {
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.8;
    letter-spacing: 0.4px;
    margin-bottom: 15px;
}

/* Collapsible long posts */
.post-collapse-wrap {
    position: relative;
    max-height: 280px;
    overflow: hidden;
}
.post-collapse-wrap.expanded {
    max-height: none;
    overflow: visible;
}
.post-collapse-fade {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 110px;
    background: linear-gradient(to bottom, transparent, var(--bg-secondary));
    cursor: pointer;
}
.post-collapse-btn {
    font-size: 14px;
    color: var(--accent);
    cursor: pointer;
    padding: 2px 0 10px;
    font-weight: 500;
    display: inline-block;
}
.post-collapse-btn:hover { text-decoration: underline; }

.post-actions {
    display: flex;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* Pinned post banner */
.pinned-banner {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    padding: 4px 0 8px 0;
    opacity: 0.8;
}

/* Pinned comment highlight */
.pinned-comment {
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    border-radius: 10px;
    padding: 6px 8px;
    border-left: 3px solid var(--accent);
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    padding: 8px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.comment-icon,
.trust-icon,
.repost-icon,
.heart-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.like-btn.liked .heart-icon,
.like-comment-btn.liked .heart-icon,
.remote-like-btn.liked .heart-icon {
    fill: #ff0000;
    stroke: #ff0000;
}

.trust-btn.trusted .trust-icon,
.trust-comment-btn.trusted .trust-icon,
.remote-trust-btn.trusted .trust-icon {
    fill: currentColor;
}

.action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.like-btn.liked,
.like-comment-btn.liked,
.remote-like-btn.liked {
    color: #ff0000 !important;
}

.remote-boost-btn.boosted,
.remote-boost-btn.boosted .repost-icon {
    color: var(--accent) !important;
    stroke: var(--accent);
}

.remote-trust-btn.trusted {
    color: var(--accent) !important;
}

.action-btn.liked {
    color: var(--text-primary);
}

.count {
    margin-left: 4px;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

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

.modal-content h2,
.modal-content h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 15px;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    outline: none;
    border-color: var(--accent);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
}

/* Forms */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    max-width: 400px;
    width: 100%;
}

.auth-box h1 {
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
}

.auth-intro {
    margin-bottom: 24px;
    padding: 14px 16px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.auth-intro p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 8px;
}

.auth-intro p:last-child {
    margin-bottom: 0;
}

.auth-intro-note {
    color: var(--text-tertiary) !important;
    font-size: 13px !important;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group small {
    color: var(--text-tertiary);
    font-size: 12px;
    display: block;
    margin-top: 5px;
}

.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.alert-success {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--accent);
}

.auth-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-tertiary);
}

.auth-link a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-link a:hover {
    text-decoration: underline;
}

/* Repost styles */
.repost-header {
    color: var(--text-tertiary);
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: 500;
}

.original-post {
    border-left: 3px solid var(--border-color);
    padding-left: 15px;
    margin-top: 15px;
    background: var(--bg-tertiary);
    padding: 15px;
    border-radius: 8px;
}

.original-post-header {
    margin-bottom: 8px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.original-post-content {
    color: var(--text-primary);
}

.original-badge {
    display: inline-block;
    background: var(--accent);
    color: var(--bg-primary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    font-weight: 600;
}

/* Three-dots menu */
.post-menu, .comment-menu {
    position: relative;
    margin-left: auto;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.menu-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.context-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 1000;
    min-width: 150px;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-item:hover {
    background: var(--hover-bg);
}

/* Comments */
.comments-section {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.comment-form,
.reply-form {
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
}

.comment-input, .reply-input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 18px;
    font-family: inherit;
    resize: none;
    min-height: 80px;
    box-sizing: border-box;
    display: block;
}

.comment-input:focus, .reply-input:focus {
    outline: none;
}

/* Thread wrapper — block container; .comment inside is the flex row */
.comment-thread {
    padding: 4px 0;
}

/* Separator between top-level thread units */
.comments-list > .comment-thread + .comment-thread {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

/* Pinned comment thread gets accent border instead */
.comments-list > .comment-thread.pinned-comment {
    border-left: 3px solid var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, transparent);
    border-radius: 10px;
    padding: 6px 8px 4px 10px;
    margin-bottom: 10px;
}

.comment,
.reply {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
    padding: 2px 0;
}

/* Left column: avatar + optional connector line (flex column, same as thread view) */
.comment-left {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 32px;
}

/* Connector line inside .comment-left (actual DOM element, not pseudo) */
.comment-connector-line {
    flex: 1;
    width: 2px;
    background: var(--text-tertiary);
    border-radius: 1px;
    margin-top: 6px;
    margin-bottom: 10px;
}

.comment-content,
.reply-content {
    flex: 1;
    min-width: 0;
}

/* "Replying to @username" label */
.reply-to-label,
.ti-replying-to {
    display: none;
}

.reply-to-link {
    color: var(--accent);
    text-decoration: none;
}

.reply-to-link:hover {
    text-decoration: underline;
}

.comment-avatar-wrapper, .reply-avatar-wrapper {
    position: relative;
    display: inline-block;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-primary);
}

.comment-avatar, .reply-avatar {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    position: relative;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    position: relative;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.comment-author, .reply-author {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 18px;
    text-decoration: none;
}

.comment-author:hover, .reply-author:hover {
    text-decoration: underline;
}

.comment-time, .reply-time {
    color: var(--text-tertiary);
    font-size: 18px;
}

.comment-text, .reply-text {
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.5;
    margin-bottom: 4px;
}

.comment-actions, .reply-actions {
    display: flex;
    gap: 4px;
    margin-top: 2px;
}

.comment-action-btn {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-action-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.comment-action-btn.liked {
    color: var(--text-primary);
}

/* Thread / permalink view — styles that supplement post.php inline styles */
/* (Most thread styles live inline in post.php <style> block) */

/* Reply form layout inside .comment-replies */
.reply-form {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 6px;
}

.reply-form-spacer {
    flex-shrink: 0;
    width: 32px;
}

.reply-form-inputs {
    flex: 1;
    min-width: 0;
}

.comment-replies {
    margin-top: 0;
    padding-left: 0;
    margin-left: 0;
    border-left: none;
    box-sizing: border-box;
}

/* Profile */
.profile-avatar-container {
    position: relative;
    display: inline-block;
    width: 128px;
    height: 128px;
    margin-bottom: 20px;
}

.profile-avatar-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--border-color);
    overflow: hidden;
    display: block;
    background: var(--bg-primary);
    position: relative;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
}

.profile-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab {
    background: none;
    border: none;
    color: var(--text-tertiary);
    padding: 12px 20px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

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

.tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-tertiary);
    transition: 0.3s;
    border-radius: 26px;
    border: 2px solid var(--border-color);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-tertiary);
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent);
    border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
    background-color: var(--bg-primary);
}

/* Follow Button Styles */
.follow-btn[data-following="true"] {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.follow-btn[data-following="true"]:hover {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
    font-size: 0;
}

.follow-btn[data-following="true"]:hover::before {
    content: "Unfollow";
    font-size: 14px;
}

/* Mute Button Styles */
.btn-outline {
    background-color: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-tertiary);
    border-color: var(--text-tertiary);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

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

/* Image Upload Component */
.image-upload-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    width: 100%;
}

.image-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: background 0.2s;
}

.image-preview-remove:hover {
    background: rgba(220, 53, 69, 0.9);
}

#addPhotosBtn {
    transition: opacity 0.2s;
}

#addPhotosBtn:hover {
    opacity: 0.7;
}

/* Post Images Display */
.post-images {
    margin-top: 12px;
    display: grid;
    gap: 8px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 320px;
    max-width: 480px;
}

.post-images.count-1 {
    grid-template-columns: 1fr;
}

.post-images.count-2 {
    grid-template-columns: 1fr 1fr;
}

.post-images.count-3 {
    grid-template-columns: 2fr 1fr;
}

.post-images.count-3 .post-image:first-child {
    grid-row: 1 / 3;
}

.post-images.count-4 {
    grid-template-columns: 1fr 1fr;
}

.post-images.count-5 {
    grid-template-columns: 1fr 1fr;
}

.post-images.count-5 .post-image:first-child {
    grid-column: 1 / 3;
}

.post-image {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--bg-tertiary);
    max-height: 320px;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

.post-image img:hover {
    transform: scale(1.05);
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet and smaller */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 70px 15px 15px 15px; /* Top padding for mobile header */
        margin-left: 0;
    }

    /* Navigation */
    /* Hide navbar on tablet/mobile, show via hamburger menu */
    .navbar {
        width: 100px;
        padding: 15px 10px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
    }

    .navbar.mobile-nav-open {
        transform: translateX(0);
    }

    .nav-links {
        margin-top: 50px;
    }

    .nav-links a,
    .nav-links button {
        padding: 10px;
        justify-content: center;
    }

    .nav-links svg {
        width: 24px !important;
        height: 24px !important;
    }

    .logo {
        display: none; /* Hide logo in navbar on mobile */
    }

    /* Mobile header with centered logo */
    .mobile-header {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 55px;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-color);
        z-index: 999;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-header .logo {
        display: block;
        font-size: 18px;
        font-weight: 900;
        color: var(--text-primary);
        text-decoration: none;
        margin: 0;
    }

    /* Mobile hamburger button */
    .mobile-nav-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1002;
        background: transparent;
        border: none;
        padding: 8px;
        cursor: pointer;
        color: var(--text-primary);
    }

    .mobile-nav-toggle svg {
        display: block;
        width: 24px;
        height: 24px;
    }

    /* Mobile nav overlay */
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .mobile-nav-overlay.active {
        display: block;
    }

    /* Posts */
    .post {
        padding: 15px;
        margin-bottom: 12px;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .post-header {
        gap: 10px;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    .post-content {
        font-size: 15px;
        line-height: 1.5;
    }

    .post-actions {
        gap: 12px;
        flex-wrap: wrap;
    }

    .action-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    /* Post compose */
    .post-compose {
        padding: 15px;
    }

    .post-compose textarea {
        font-size: 15px;
        padding: 12px;
    }

    /* Comments */
    .comment,
    .reply {
        gap: 8px;
        margin-bottom: 12px;
    }

    .comment-avatar-wrapper,
    .reply-avatar-wrapper {
        width: 28px;
        height: 28px;
    }

    .comment-input,
    .reply-input {
        font-size: 18px;
        padding: 10px 12px;
        min-height: 70px;
        min-width: 0; /* Allow textarea to shrink */
    }

    .comment-form,
    .reply-form {
        gap: 8px;
        margin-bottom: 12px;
        width: 100%;
        box-sizing: border-box;
    }

    .submit-comment,
    .submit-reply {
        padding: 6px 10px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .comment-replies {
        margin-left: 0;
    }

    /* Profile */
    .profile-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .profile-avatar-container {
        margin-bottom: 15px;
    }

    .profile-stats {
        width: 100%;
        justify-content: space-around;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-width: 100%;
        margin: 20px;
        padding: 20px;
    }

    /* Context menus */
    .context-menu {
        min-width: 180px;
    }

    /* Image upload */
    .image-previews {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    /* Post images */
    .post-images {
        gap: 6px;
    }
}

/* Mobile phones */
@media (max-width: 480px) {
    .container {
        padding: 70px 12px 12px 12px;
        margin-left: 0;
    }

    /* Navigation - more compact */
    /* Hide navbar on mobile, show via hamburger menu */
    .navbar {
        width: 90px;
        padding: 12px 8px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
    }

    .navbar.mobile-nav-open {
        transform: translateX(0);
    }

    .nav-links {
        gap: 10px;
        margin-top: 50px;
    }

    .nav-links a,
    .nav-links button {
        padding: 8px;
        justify-content: center;
    }

    .nav-links svg {
        width: 22px !important;
        height: 22px !important;
    }

    .logo {
        display: none; /* Hide logo in navbar on mobile */
    }

    /* Mobile header with centered logo */
    .mobile-header {
        display: flex;
        height: 55px;
    }

    .mobile-header .logo {
        display: block;
        font-size: 18px;
        margin: 0;
    }

    .beta {
        font-size: 9px;
        padding: 2px 4px;
    }

    /* Mobile hamburger button */
    .mobile-nav-toggle {
        display: block;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1002;
        background: transparent;
        border: none;
        padding: 8px;
        cursor: pointer;
        color: var(--text-primary);
    }

    .mobile-nav-toggle svg {
        display: block;
        width: 24px;
        height: 24px;
    }

    /* Mobile nav overlay */
    .mobile-nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    .mobile-nav-overlay.active {
        display: block;
    }

    /* Posts - very compact */
    .post {
        padding: 12px;
        margin-bottom: 10px;
        border-radius: 12px;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .post-header {
        gap: 8px;
    }

    .avatar {
        width: 36px;
        height: 36px;
    }

    .username {
        font-size: 14px;
    }

    .post-time {
        font-size: 12px;
    }

    .post-content {
        font-size: 14px;
        line-height: 1.4;
    }

    .post-actions {
        gap: 10px;
        margin-top: 10px;
    }

    .action-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .action-btn svg {
        width: 16px;
        height: 16px;
    }

    /* Post compose - mobile optimized */
    .post-compose {
        padding: 12px;
    }

    .post-compose textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px;
        min-height: 30px;
    }

    .compose-footer {
        gap: 8px;
    }

    .char-count {
        font-size: 11px;
    }

    /* Comments - very compact */
    .comment,
    .reply {
        gap: 6px;
        margin-bottom: 10px;
    }

    .comment-avatar-wrapper,
    .reply-avatar-wrapper {
        width: 24px;
        height: 24px;
    }

    .comment-author,
    .reply-author {
        font-size: 13px;
    }

    .comment-text,
    .reply-text {
        font-size: 14px;
    }

    .comment-input,
    .reply-input {
        font-size: 18px; /* Prevents zoom on iOS */
        padding: 8px 10px;
        min-height: 60px;
        min-width: 0; /* Allow textarea to shrink */
    }

    .comment-form,
    .reply-form {
        gap: 6px;
        margin-bottom: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .submit-comment,
    .submit-reply {
        padding: 6px 8px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .comment-replies {
        margin-left: 0;
    }

    .comment-action-btn {
        padding: 4px 8px;
        font-size: 12px;
    }

    /* Buttons */
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 13px;
    }

    /* Profile - mobile layout */
    .profile-header {
        padding: 15px;
    }

    .profile-avatar-container {
        width: 80px;
        height: 80px;
    }

    .profile-info h1 {
        font-size: 20px;
    }

    .profile-stats {
        gap: 15px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 12px;
    }

    /* Tabs */
    .tabs {
        gap: 15px;
        padding: 0 12px;
    }

    .tab {
        padding: 10px 0;
        font-size: 14px;
    }

    /* Modals - full screen on mobile */
    .modal-content {
        width: 100%;
        height: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .modal-close {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 24px;
    }

    /* Context menu - better touch targets */
    .context-menu {
        min-width: 200px;
    }

    .menu-item {
        padding: 14px 18px;
        font-size: 15px;
    }

    /* Three-dot menu button - larger touch target */
    .context-menu-btn {
        padding: 8px;
        min-width: 40px;
        min-height: 40px;
    }

    /* Image upload */
    #addPhotosBtn {
        width: 28px;
        height: 28px;
    }

    .image-previews {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    /* News box */
    .news-box {
        padding: 15px;
        margin-bottom: 15px;
    }

    /* Settings page */
    .form-group {
        margin-bottom: 20px;
    }

    input[type="text"],
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Notifications */
    .notification-item {
        padding: 12px;
    }

    .notification-avatar {
        width: 35px;
        height: 35px;
    }
}


/* Delete button styles */
.delete-post-btn,
.delete-comment-btn {
    color: var(--text-tertiary);
    transition: color 0.2s, transform 0.2s;
}

.delete-post-btn:hover,
.delete-comment-btn:hover {
    color: #ef4444;
}

/* Delete animations */
.post {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.comment {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

