@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Bebas+Neue&family=JetBrains+Mono:wght@400;500&display=swap');

/* ======== CSS VARIABLES ======== */
:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-card: #161616;
    --bg-hover: #1e1e1e;
    --border: #2a2a2a;
    --border-hover: #3a3a3a;
    --accent: #cc0000;
    --accent-hover: #ff1a1a;
    --accent-muted: rgba(204,0,0,0.15);
    --accent-glow: rgba(204,0,0,0.3);
    --text-primary: #f0f0f0;
    --text-secondary: #888;
    --text-muted: #555;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --shadow: 0 4px 20px rgba(0,0,0,0.6);
    --shadow-accent: 0 4px 20px rgba(204,0,0,0.2);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --nav-height: 64px;
    --bottom-nav: 65px;
    --font-display: 'Bebas Neue', cursive;
    --font-body: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --transition: 0.2s ease;
}

body.light-mode {
    --bg-primary: #f0f4ff;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e8edf8;
    --border: #d0d9f0;
    --border-hover: #b0bcdf;
    --accent: #1a56db;
    --accent-hover: #1343b5;
    --accent-muted: rgba(26,86,219,0.1);
    --accent-glow: rgba(26,86,219,0.25);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow: 0 4px 20px rgba(0,0,50,0.1);
    --shadow-accent: 0 4px 20px rgba(26,86,219,0.2);
}

/* ======== RESET & BASE ======== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); border: none; outline: none; }
input, textarea, select { font-family: var(--font-body); outline: none; }

/* ======== SCROLLBAR ======== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 2px; }

/* ======== TYPOGRAPHY ======== */
.display-font { font-family: var(--font-display); letter-spacing: 1px; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.3; }

/* ======== LAYOUT ======== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 100;
    transition: transform 0.3s;
}

.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    max-width: calc(100vw - 260px);
}

.content-area {
    max-width: 680px;
    margin: 0 auto;
    padding: 24px 16px 100px;
}

/* ======== LOGO ======== */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
    padding: 8px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 20px;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 24px;
    color: var(--text-primary);
    letter-spacing: 1px;
}

.logo-text span { color: var(--accent); }

/* ======== NAV ======== */
.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-muted);
    color: var(--accent);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.nav-icon { font-size: 18px; width: 20px; text-align: center; }

/* ======== THEME TOGGLE ======== */
.theme-toggle-wrap {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.theme-toggle:hover { border-color: var(--accent); color: var(--text-primary); }

.toggle-switch {
    width: 36px; height: 20px;
    background: var(--border);
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

body.light-mode .toggle-switch { background: var(--accent); }
body.light-mode .toggle-switch::after { transform: translateX(16px); }

/* ======== CARDS ======== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.card:hover { border-color: var(--border-hover); }

/* ======== POST CARD ======== */
.post-card {
    padding: 20px;
    margin-bottom: 16px;
    animation: fadeUp 0.3s ease forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
    background: var(--accent-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--accent);
    overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.post-meta { flex: 1; min-width: 0; }
.post-author { font-weight: 600; font-size: 15px; }
.post-author span { color: var(--text-muted); font-weight: 400; font-size: 13px; }
.post-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.startup-badge {
    font-size: 11px;
    background: var(--accent-muted);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
    display: inline-block;
    margin-top: 3px;
}

.post-content {
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-primary);
    margin-bottom: 16px;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-image {
    width: 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

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

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.action-btn.liked { color: var(--accent); }
.action-btn.liked .action-icon { animation: heartbeat 0.3s ease; }

@keyframes heartbeat {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ======== COMMENTS ======== */
.comments-section { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; display: none; }
.comments-section.open { display: block; }

.comment-item {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.comment-avatar { width: 32px; height: 32px; font-size: 13px; }
.comment-body { flex: 1; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-text { font-size: 13px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.comment-time { font-size: 11px; color: var(--text-muted); }

.comment-form {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.comment-input {
    flex: 1;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: var(--text-primary);
    transition: border var(--transition);
}

.comment-input:focus { border-color: var(--accent); }
.comment-input::placeholder { color: var(--text-muted); }

/* ======== FORMS ======== */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 15px;
    color: var(--text-primary);
    transition: all var(--transition);
}

.form-input:focus, .form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-textarea { resize: vertical; min-height: 100px; }

/* ======== BUTTONS ======== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: all var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-accent);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }

/* ======== MODALS ======== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-title { font-size: 20px; font-weight: 700; }

.modal-close {
    width: 32px; height: 32px;
    background: var(--bg-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--accent-muted); color: var(--accent); }

/* ======== BOTTOM NAV (Mobile) ======== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: 0 8px;
    align-items: center;
    justify-content: space-around;
    backdrop-filter: blur(10px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    transition: all var(--transition);
    min-width: 52px;
}

.bottom-nav-item:hover, .bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item .nav-icon { font-size: 20px; }

.bottom-nav-item.add-btn {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 48px; height: 48px;
    padding: 0;
    font-size: 24px;
    margin-bottom: 4px;
}

.bottom-nav-item.add-btn:hover { background: var(--accent-hover); transform: scale(1.08); }

/* ======== PAGE HEADER ======== */
.page-header {
    padding: 20px 0 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
}

/* ======== AUTH PAGES ======== */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .display-font {
    font-size: 36px;
    color: var(--text-primary);
}

.auth-logo .display-font span { color: var(--accent); }
.auth-subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-secondary);
}

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

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ======== NOTES ======== */
.note-card {
    padding: 20px;
    margin-bottom: 12px;
    position: relative;
    cursor: pointer;
}

.note-card:hover { border-color: var(--accent); }

.note-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.note-preview {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-muted);
}

.note-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}

.note-badge.private { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.note-badge.public { background: var(--accent-muted); color: var(--accent); }

/* ======== PROFILE ======== */
.profile-header {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 20px;
    text-align: center;
}

.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    border: 3px solid var(--accent);
    font-size: 30px;
}

.profile-name { font-size: 22px; font-weight: 700; }
.profile-username { color: var(--text-muted); font-size: 14px; margin-top: 2px; }
.profile-bio { color: var(--text-secondary); font-size: 14px; margin: 12px 0; line-height: 1.6; }

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 16px 0;
}

.stat { text-align: center; }
.stat-num { font-size: 20px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); }

.profile-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
}

@media (max-width: 400px) {
    .profile-actions .btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

.tag {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-hover);
}

/* ======== SEARCH ======== */
.search-input-wrap {
    position: relative;
    margin-bottom: 24px;
}

.search-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

.search-input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 12px 16px 12px 44px;
    font-size: 15px;
    color: var(--text-primary);
    transition: all var(--transition);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

/* ======== USER ITEM ======== */
.user-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    margin-bottom: 10px;
    transition: all var(--transition);
}

.user-item:hover { border-color: var(--border-hover); }
.user-info { flex: 1; }
.user-name { font-weight: 600; font-size: 15px; }
.user-startup { font-size: 12px; color: var(--text-muted); }

/* ======== TOAST ======== */
.toast-container {
    position: fixed;
    bottom: 80px; right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    min-width: 200px;
    max-width: 300px;
    box-shadow: var(--shadow);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ======== ADD POST AREA ======== */
.add-post-card {
    padding: 20px;
    margin-bottom: 20px;
}

.add-post-inner {
    display: flex;
    gap: 12px;
}

.post-textarea {
    flex: 1;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 15px;
    color: var(--text-primary);
    resize: none;
    min-height: 80px;
    transition: border var(--transition);
}

.post-textarea:focus { border-color: var(--accent); }
.post-textarea::placeholder { color: var(--text-muted); }

.post-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ======== EMPTY STATE ======== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-desc { font-size: 14px; line-height: 1.6; }

/* ======== LOADING ======== */
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 40px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ======== ALERT ======== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 16px;
    border: 1px solid;
}

.alert-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #22c55e; }

/* ======== RESPONSIVE ======== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; max-width: 100vw; }
    .content-area { padding-bottom: 80px; }
    .bottom-nav { display: flex; }
    .add-post-card { display: none; }
    .page-header { padding: 16px 0 12px; }
}

@media (min-width: 769px) {
    .bottom-nav { display: none; }
}

/* ======== ACCENT LINE ON TOP ======== */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent 60%);
    z-index: 999;
}

/* Note editor */
.note-editor {
    width: 100%;
    min-height: 300px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    resize: vertical;
    font-family: var(--font-body);
    transition: border var(--transition);
}

.note-editor:focus { border-color: var(--accent); }

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.tab {
    flex: 1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: none;
    border: none;
}

.tab.active {
    background: var(--accent);
    color: white;
}
