/* ============================================
   Moja Elektrana Forum — Design System
   ============================================ */

:root {
    --primary: #16a34a;
    --primary-light: #22c55e;
    --primary-dark: #15803d;
    --primary-50: #f0fdf4;
    --primary-100: #dcfce7;
    --primary-200: #bbf7d0;
    --primary-900: #14532d;
    --accent: #eab308;
    --danger: #ef4444;
    --info: #3b82f6;

    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;
    --bg-input: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: 0.2s ease;
    --max-w: 1200px;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --bg-input: #1e293b;
    --border: #334155;
    --border-light: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.5);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; }

/* ============================================
   Header
   ============================================ */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 64px;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    color: var(--text);
}
.logo:hover { color: var(--text); }
.logo-icon { width: 36px; height: 36px; }
.logo-text { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.logo-forum { color: var(--primary); }

.header-search {
    flex: 1;
    max-width: 480px;
    position: relative;
}
.header-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    transition: all var(--transition);
}
.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
}
.search-icon {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text); }
.theme-toggle svg { width: 20px; height: 20px; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* Notifications */
.notif-wrapper { position: relative; }
.notif-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    position: relative;
    transition: all var(--transition);
}
.notif-btn:hover { background: var(--bg-hover); color: var(--text); }
.notif-btn svg { width: 20px; height: 20px; }
.notif-badge {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}
.notif-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--primary-50); }
[data-theme="dark"] .notif-item.unread { background: rgba(22,163,74,0.1); }
.notif-item .notif-text { font-size: 0.85rem; line-height: 1.4; }
.notif-item .notif-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.notif-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notif-header a { font-size: 0.8rem; font-weight: 400; }
.notif-empty { padding: 2rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* Auth buttons */
.auth-btns { display: flex; gap: 0.5rem; align-items: center; }
.user-menu-wrapper { position: relative; }
.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
}
.user-menu-btn:hover { background: var(--bg-hover); }
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}
.user-menu-dropdown a, .user-menu-dropdown button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    color: var(--text);
    background: none;
    border: none;
    text-align: left;
    transition: background var(--transition);
}
.user-menu-dropdown a:hover, .user-menu-dropdown button:hover { background: var(--bg-hover); }
.user-menu-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
}
.hamburger span {
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}
.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    animation: slideDown 0.2s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.mobile-menu-inner { display: flex; flex-direction: column; gap: 0.5rem; }
.mobile-menu-inner a, .mobile-menu-inner button {
    display: block;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-xs);
    color: var(--text);
    font-size: 0.9rem;
    background: none;
    border: none;
    text-align: left;
    width: 100%;
    transition: background var(--transition);
}
.mobile-menu-inner a:hover, .mobile-menu-inner button:hover { background: var(--bg-hover); }
.mobile-menu-inner .btn { text-align: center; margin-top: 0.5rem; }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); box-shadow: none; transform: none; }
.btn-sm { padding: 0.35rem 0.85rem; font-size: 0.8rem; }
.btn-lg { padding: 0.7rem 1.75rem; font-size: 1rem; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}
.card-hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ============================================
   Avatar
   ============================================ */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
    position: relative;
}
.avatar-xs { width: 24px; height: 24px; font-size: 0.65rem; }
.avatar-sm { width: 32px; height: 32px; font-size: 0.8rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 2rem; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.online-dot {
    position: absolute;
    bottom: 1px; right: 1px;
    width: 10px; height: 10px;
    background: var(--primary-light);
    border: 2px solid var(--bg-card);
    border-radius: 50%;
}

/* ============================================
   Badges & Tags
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 999px;
    background: var(--primary-100);
    color: var(--primary-dark);
    white-space: nowrap;
}
[data-theme="dark"] .badge { background: rgba(22,163,74,0.2); color: var(--primary-light); }
.badge-gold { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .badge-gold { background: rgba(234,179,8,0.2); color: #fbbf24; }
.badge-blue { background: #dbeafe; color: #1e40af; }
[data-theme="dark"] .badge-blue { background: rgba(59,130,246,0.2); color: #60a5fa; }
.badge-red { background: #fee2e2; color: #991b1b; }
[data-theme="dark"] .badge-red { background: rgba(239,68,68,0.2); color: #f87171; }
.badge-gray { background: var(--bg-hover); color: var(--text-secondary); }

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: var(--radius-xs);
    background: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.tag:hover { background: var(--primary-100); color: var(--primary-dark); }
[data-theme="dark"] .tag:hover { background: rgba(22,163,74,0.2); color: var(--primary-light); }

/* ============================================
   Main Content
   ============================================ */
.main {
    flex: 1;
    padding: 1.5rem 0;
}

/* Hero / Welcome */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.hero h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 0.5rem; position: relative; z-index: 1; }
.hero p { font-size: 1rem; opacity: 0.9; max-width: 600px; position: relative; z-index: 1; }
.hero-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    position: relative;
    z-index: 1;
}
.hero-stat { text-align: center; }
.hero-stat .num { font-size: 1.5rem; font-weight: 800; }
.hero-stat .label { font-size: 0.75rem; opacity: 0.8; text-transform: uppercase; letter-spacing: 0.5px; }

/* Online users bar */
.online-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.online-bar .pulse {
    width: 8px; height: 8px;
    background: var(--primary-light);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.online-avatars { display: flex; margin-left: 0.5rem; }
.online-avatars .avatar { margin-left: -8px; border: 2px solid var(--bg-card); }

/* Categories grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.category-card {
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    cursor: pointer;
}
.category-card:hover { border-color: var(--primary); }
.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.category-info { flex: 1; min-width: 0; }
.category-info h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; color: var(--text); }
.category-info p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.category-meta { display: flex; gap: 1rem; font-size: 0.75rem; color: var(--text-muted); }

/* Thread list */
.thread-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.thread-controls .left { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.sort-tabs { display: flex; gap: 0.25rem; background: var(--bg-hover); border-radius: var(--radius-sm); padding: 3px; }
.sort-tab {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}
.sort-tab.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-sm); }
.sort-tab:hover:not(.active) { color: var(--text); }

.thread-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.thread-item {
    padding: 1rem 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    cursor: pointer;
    transition: all var(--transition);
}
.thread-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.thread-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    min-width: 44px;
    flex-shrink: 0;
}
.vote-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 2px;
    cursor: pointer;
    transition: color var(--transition);
    line-height: 1;
}
.vote-btn:hover { color: var(--primary); }
.vote-btn.active { color: var(--primary); }
.vote-btn svg { width: 20px; height: 20px; }
.vote-count { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.thread-content { flex: 1; min-width: 0; }
.thread-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.thread-title:hover { color: var(--primary); }
.thread-excerpt {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.thread-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}
.thread-meta-item { display: flex; align-items: center; gap: 0.25rem; }
.thread-meta-item svg { width: 14px; height: 14px; }
.thread-tags { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.4rem; }
.thread-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    flex-shrink: 0;
    min-width: 80px;
}
.thread-stat-num { font-size: 0.8rem; color: var(--text-secondary); display: flex; align-items: center; gap: 0.25rem; }
.thread-stat-num svg { width: 14px; height: 14px; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 0.35rem; margin: 1.5rem 0; }
.page-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: default; }

/* ============================================
   Thread Detail
   ============================================ */
.thread-detail { max-width: 800px; margin: 0 auto; }
.thread-detail-header { margin-bottom: 1.5rem; }
.thread-detail-header h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.75rem; line-height: 1.3; }
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb svg { width: 12px; height: 12px; }

.post { margin-bottom: 1rem; }
.post-inner { padding: 1.25rem; }
.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.post-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.post-author-info h4 { font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.post-author-info .post-date { font-size: 0.75rem; color: var(--text-muted); }
.post-actions { display: flex; gap: 0.25rem; }
.post-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.35rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}
.post-action-btn:hover { background: var(--bg-hover); color: var(--text); }
.post-action-btn svg { width: 16px; height: 16px; }
.post-body {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
}
.post-body p { margin-bottom: 0.75rem; }
.post-body blockquote {
    border-left: 3px solid var(--primary);
    padding: 0.5rem 1rem;
    margin: 0.75rem 0;
    background: var(--bg-hover);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.post-body code {
    background: var(--bg-hover);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
}
.post-body pre {
    background: var(--bg-hover);
    padding: 1rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 0.75rem 0;
}
.post-body ul, .post-body ol { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.post-body li { list-style: disc; margin-bottom: 0.25rem; }
.post-body ol li { list-style: decimal; }
.post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
}
.post-footer-actions { display: flex; gap: 0.5rem; }
.post-footer-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: none;
    border: none;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}
.post-footer-btn:hover { background: var(--bg-hover); color: var(--text); }
.post-footer-btn.active { color: var(--primary); }
.post-footer-btn svg { width: 16px; height: 16px; }

/* Reply editor */
.reply-editor { margin-top: 1.5rem; }
.reply-editor h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.75rem; }
.editor-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    flex-wrap: wrap;
}
.editor-btn {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    transition: all var(--transition);
}
.editor-btn:hover { background: var(--bg-hover); color: var(--text); }
.editor-textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
}
.editor-textarea:focus { outline: none; border-color: var(--primary); }

/* ============================================
   Forms & Modals
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xs);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}
.form-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.9rem;
    transition: all var(--transition);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
textarea.form-input { min-height: 100px; resize: vertical; }
select.form-input { cursor: pointer; }
.form-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
.form-error { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }

/* ============================================
   Profile Page
   ============================================ */
.profile-header {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.profile-info h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 0.25rem; }
.profile-info .bio { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.profile-stats { display: flex; gap: 1.5rem; }
.profile-stat { text-align: center; }
.profile-stat .num { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.profile-stat .label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }

/* ============================================
   Legal pages
   ============================================ */
.legal-page { max-width: 800px; margin: 0 auto; }
.legal-page h1 { font-size: 1.75rem; font-weight: 800; margin-bottom: 1rem; }
.legal-page h2 { font-size: 1.2rem; font-weight: 700; margin: 1.5rem 0 0.5rem; color: var(--primary-dark); }
[data-theme="dark"] .legal-page h2 { color: var(--primary-light); }
.legal-page p { margin-bottom: 0.75rem; font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; }
.legal-page ul { padding-left: 1.5rem; margin-bottom: 0.75rem; }
.legal-page li { list-style: disc; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.35rem; }

/* ============================================
   Cookie Banner
   ============================================ */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 9999;
    padding: 1rem;
    animation: slideUp 0.4s ease;
}
.cookie-content {
    max-width: var(--max-w);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.cookie-content p { font-size: 0.85rem; color: var(--text-secondary); flex: 1; }
.cookie-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* ============================================
   Search results
   ============================================ */
.search-results-header { margin-bottom: 1rem; }
.search-results-header h2 { font-size: 1.2rem; font-weight: 700; }
.search-results-header p { font-size: 0.85rem; color: var(--text-muted); }
.search-highlight { background: rgba(22,163,74,0.2); padding: 0.1rem 0.2rem; border-radius: 2px; }

/* ============================================
   New Thread Page
   ============================================ */
.new-thread-page { max-width: 700px; margin: 0 auto; }
.new-thread-page h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 1.5rem; }
.tags-input { display: flex; flex-wrap: wrap; gap: 0.35rem; padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-input); min-height: 42px; align-items: center; }
.tags-input input { border: none; outline: none; background: none; font-size: 0.85rem; color: var(--text); flex: 1; min-width: 100px; padding: 0.15rem; }
.tag-chip {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.5rem;
    background: var(--primary-100);
    color: var(--primary-dark);
    border-radius: var(--radius-xs);
    font-size: 0.75rem;
    font-weight: 500;
}
[data-theme="dark"] .tag-chip { background: rgba(22,163,74,0.2); color: var(--primary-light); }
.tag-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 0.9rem; padding: 0; line-height: 1; }

/* ============================================
   Bookmarks
   ============================================ */
.bookmarks-page h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 1rem; }
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state svg { width: 64px; height: 64px; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p { font-size: 0.9rem; }

/* ============================================
   Toast / Notifications
   ============================================ */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 10000; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    animation: slideInRight 0.3s ease;
    min-width: 280px;
}
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast-success { border-left: 3px solid var(--primary); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info { border-left: 3px solid var(--info); }

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .hamburger { display: flex; }
    .header-search { display: none; }
    .header-nav { display: none; }
    .hero { padding: 1.5rem 1.25rem; }
    .hero h1 { font-size: 1.3rem; }
    .hero-stats { gap: 1rem; }
    .categories-grid { grid-template-columns: 1fr; }
    .thread-item { flex-direction: column; gap: 0.75rem; }
    .thread-vote { flex-direction: row; }
    .thread-stats { flex-direction: row; align-items: center; }
    .profile-header { flex-direction: column; text-align: center; }
    .modal { max-width: 100%; margin: 0.5rem; }
    .notif-dropdown { width: calc(100vw - 2rem); right: -4rem; }
    .cookie-content { flex-direction: column; text-align: center; }
    .post-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .footer-grid { grid-template-columns: 1fr; }
}
@media (min-width: 769px) {
    .mobile-menu { display: none !important; }
}

/* ============================================
   Footer
   ============================================ */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0 1.5rem;
    margin-top: 2rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { font-size: 0.9rem; font-weight: 700; margin-bottom: 0.75rem; }
.footer-col p { font-size: 0.8rem; color: var(--text-secondary); }
.footer-col ul li { margin-bottom: 0.35rem; }
.footer-col ul a { font-size: 0.8rem; color: var(--text-secondary); }
.footer-col ul a:hover { color: var(--primary); }
.footer-bottom {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Utility */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.85rem; }
.text-muted { color: var(--text-muted); }
.fw-600 { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Additional styles for v2 ---- */
.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  border: 2px solid var(--bg);
  transition: transform 0.2s;
}
.avatar-upload-btn:hover { transform: scale(1.1); }
img.avatar {
  object-fit: cover;
  border-radius: 50%;
}
.admin-table table { font-size: 0.875rem; }
.admin-table td, .admin-table th { white-space: nowrap; }
@media (max-width: 768px) {
  .admin-table { font-size: 0.75rem; }
  .admin-table td, .admin-table th { padding: 0.5rem 0.25rem !important; }
}
