/* Astroism — Clean Modern Dark */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:        #0d1117;
    --bg2:       #161b22;
    --bg3:       #21262d;
    --border:    #30363d;
    --text:      #e6edf3;
    --text2:     #c9d1d9;
    --muted:     #8b949e;
    --faint:     #6e7681;
    --accent:    #6e40c9;
    --accent2:   #8957e5;
    --blue:      #58a6ff;
    --green:     #3fb950;
    --red:       #f85149;
    --gold:      #e3b341;
    --radius:    10px;
    --radius-sm: 6px;
    --nav-h:     56px;
    --sidebar-w: 240px;
    --feed-w:    600px;
}

html { font-size: 15px; }
body {
    background: var(--bg);
    color: var(--text2);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }

/* ── Layout ── */
.layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--nav-h);
}

.sidebar {
    width: var(--sidebar-w);
    position: fixed;
    top: var(--nav-h);
    left: 0;
    bottom: 0;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
}

.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    max-width: calc(var(--sidebar-w) + var(--feed-w) + 280px);
}

.feed-col {
    max-width: var(--feed-w);
    min-height: calc(100vh - var(--nav-h));
    border-right: 1px solid var(--border);
}

/* ── Navbar ── */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.navbar-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.navbar-logo:hover { text-decoration: none; }
.navbar-logo .logo-icon { color: var(--accent2); }

.navbar-spacer { flex: 1; }

.navbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Sidebar Nav ── */
.sidebar-nav { padding: 0 8px; flex: 1; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.nav-item:hover { background: var(--bg3); color: var(--text); text-decoration: none; }
.nav-item.active { color: var(--text); background: var(--bg3); }
.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 99px;
    min-width: 18px;
    text-align: center;
}

.sidebar-bottom {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text2);
}
.sidebar-user:hover { background: var(--bg3); text-decoration: none; color: var(--text); }
.sidebar-username { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.sidebar-handle { font-size: 0.78rem; color: var(--muted); }

/* ── Avatars ── */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg3);
}
.avatar-xs  { width: 28px; height: 28px; }
.avatar-sm  { width: 36px; height: 36px; }
.avatar-md  { width: 44px; height: 44px; }
.avatar-lg  { width: 64px; height: 64px; }
.avatar-xl  { width: 88px; height: 88px; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s, background 0.15s;
    text-decoration: none;
}
.btn:hover { opacity: 0.88; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-outline   { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg3); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm        { padding: 5px 12px; font-size: 0.82rem; }
.btn-full      { width: 100%; justify-content: center; }

.btn-follow {
    background: var(--text);
    color: var(--bg);
    padding: 6px 16px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 0.88rem;
}
.btn-follow.following {
    background: transparent;
    color: var(--text2);
    border: 1px solid var(--border);
}
.btn-follow.following:hover { background: rgba(248,81,73,0.1); border-color: var(--red); color: var(--red); }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-size: 0.875rem; color: var(--text2); font-weight: 500; }
.form-hint  { font-size: 0.78rem; color: var(--muted); margin-top: 4px; }

.form-input {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    color: var(--text);
    font-size: 0.95rem;
    transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--accent2); }
.form-input::placeholder { color: var(--faint); }

textarea.form-input { resize: vertical; min-height: 80px; }

.form-error {
    background: rgba(248,81,73,0.1);
    border: 1px solid var(--red);
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    color: var(--red);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* ── Cards / Panels ── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card-pad { padding: 20px; }

/* ── Auth Pages ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-box {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 24px;
}
.auth-logo-text {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
}
.auth-logo-sub { color: var(--accent2); }

.auth-title { font-size: 1.2rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.auth-sub   { font-size: 0.875rem; color: var(--muted); margin-bottom: 24px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 0.875rem; color: var(--muted); }

/* ── Post Composer ── */
.composer {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
}

.composer-body { flex: 1; }

.composer-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    resize: none;
    outline: none;
    min-height: 52px;
    padding: 6px 0;
}
.composer-textarea::placeholder { color: var(--faint); }

.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.composer-tools { display: flex; gap: 4px; }
.composer-tool-btn {
    background: none;
    border: none;
    color: var(--accent2);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    font-size: 1rem;
}
.composer-tool-btn:hover { background: var(--bg3); }

.char-count { font-size: 0.78rem; color: var(--muted); }
.char-count.warning { color: var(--gold); }
.char-count.over    { color: var(--red); }

/* ── Posts ── */
.post {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    transition: background 0.1s;
}
.post:hover { background: rgba(255,255,255,0.02); cursor: pointer; }

.post-body { flex: 1; min-width: 0; }
.post-header { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.post-display-name { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.post-username { color: var(--muted); font-size: 0.875rem; }
.post-time { color: var(--faint); font-size: 0.78rem; margin-left: auto; white-space: nowrap; }

.post-content {
    color: var(--text2);
    font-size: 0.95rem;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}
.post-content .hashtag { color: var(--accent2); }
.post-content .mention { color: var(--blue); }

.post-media {
    margin-top: 12px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 400px;
}
.post-media img { width: 100%; object-fit: cover; max-height: 400px; }

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

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.post-action-btn:hover { background: var(--bg3); }
.post-action-btn.liked  { color: var(--red); }
.post-action-btn.liked:hover { background: rgba(248,81,73,0.1); }
.post-action-btn.reposted { color: var(--green); }
.post-action-btn.reposted:hover { background: rgba(63,185,80,0.1); }

/* Reply indicator */
.post-reply-to {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 4px;
}

/* Repost header */
.post-repost-header {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Profile ── */
.profile-header-img {
    height: 160px;
    background: linear-gradient(135deg, var(--accent) 0%, #1a0a3e 100%);
}

.profile-header-body {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
}

.profile-avatar-wrap {
    margin-top: -44px;
    margin-bottom: 12px;
}
.profile-avatar-wrap .avatar {
    border: 3px solid var(--bg);
}

.profile-top-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.profile-display-name { font-size: 1.2rem; font-weight: 800; color: var(--text); }
.profile-username { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.profile-bio { color: var(--text2); font-size: 0.9rem; margin-bottom: 12px; line-height: 1.5; }

.profile-stats {
    display: flex;
    gap: 20px;
    font-size: 0.875rem;
}
.profile-stat a { color: var(--text2); }
.profile-stat a:hover { text-decoration: underline; }
.profile-stat strong { color: var(--text); }

/* ── Notifications ── */
.notif-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
    text-decoration: none;
    color: var(--text2);
}
.notif-item:hover { background: var(--bg3); text-decoration: none; }
.notif-item.unread { background: rgba(110,64,201,0.06); }

.notif-icon { font-size: 1rem; margin-top: 2px; }
.notif-text { font-size: 0.9rem; line-height: 1.5; }
.notif-text strong { color: var(--text); }
.notif-time { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* ── Page Headers ── */
.page-header {
    position: sticky;
    top: var(--nav-h);
    background: rgba(13,17,23,0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 16px;
}
.page-header h1 { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.page-header-sub { font-size: 0.78rem; color: var(--muted); }

/* ── Tabs ── */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active { color: var(--text); border-bottom-color: var(--accent2); }
.tab-btn:hover { color: var(--text2); background: var(--bg3); }

/* ── Empty States ── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state h3 { color: var(--text2); margin-bottom: 8px; font-size: 1rem; }
.empty-state p { font-size: 0.875rem; }

/* ── Chart Badge on Post ── */
.post-chart-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(110,64,201,0.15);
    border: 1px solid rgba(110,64,201,0.3);
    border-radius: var(--radius-sm);
    padding: 5px 10px;
    font-size: 0.8rem;
    color: var(--accent2);
    margin-top: 8px;
    text-decoration: none;
}
.post-chart-badge:hover { background: rgba(110,64,201,0.25); text-decoration: none; }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 0; }
.text-muted { color: var(--muted); }
.text-small { font-size: 0.82rem; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* ── Spinner ── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent2);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
    display: flex;
    justify-content: center;
    padding: 40px;
}

/* ── Mobile ── */
@media (max-width: 900px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .feed-col { border-right: none; max-width: 100%; }
}

@media (max-width: 600px) {
    .auth-box { padding: 24px 16px; }
    .post { padding: 12px; gap: 10px; }
    .composer { padding: 12px; }
}

/* ── Bottom Mobile Nav ── */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 52px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    z-index: 100;
    align-items: stretch;
}

@media (max-width: 900px) {
    .mobile-nav { display: flex; }
    body { padding-bottom: 52px; }
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 1.2rem;
    text-decoration: none;
    gap: 2px;
    position: relative;
}
.mobile-nav-item.active { color: var(--accent2); }
.mobile-nav-item:hover { text-decoration: none; }
.mobile-nav-label { font-size: 0.62rem; }
.mobile-nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    background: var(--accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 99px;
    min-width: 14px;
    text-align: center;
}
