/* ========================================
   Modern Forum Design System
   ======================================== */

:root, [data-theme="light"] {
    /* Colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f4;
    --text-primary: #1a1a1a;
    --text-secondary: #5f6368;
    --text-muted: #9aa0a6;
    --accent: #1a73e8;
    --accent-hover: #1557b0;
    --accent-light: rgba(26, 115, 232, 0.1);
    --border: #e8eaed;
    --border-light: #f1f3f4;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --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-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Layout */
    --navbar-height: 64px;
    --sidebar-width: 280px;
    --container-max: 1200px;
    --content-max: 800px;
}

[data-theme="dark"] {
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #252525;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --text-muted: #5f6368;
    --accent: #8ab4f8;
    --accent-hover: #aecbfa;
    --accent-light: rgba(138, 180, 248, 0.1);
    --border: #3c4043;
    --border-light: #303134;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* ========================================
   Base Styles
   ======================================== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition), color var(--transition);
}

/* ========================================
   Typography
   ======================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========================================
   Layout
   ======================================== */

.main-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.content-container {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

/* ========================================
   Navigation
   ======================================== */

.navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: var(--navbar-height);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.navbar-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-container-full {
    width: 100%;
    padding: 0 2rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.navbar-brand:hover {
    color: var(--accent);
}

.navbar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-nav li {
    display: inline-flex;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-light);
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

[data-theme="light"] .theme-icon-dark { display: none; }
[data-theme="light"] .theme-icon-light { display: block; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.card-hoverable:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.card-header h3,
.card-header h4,
.card-header h5 {
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover:not(:disabled) {
    background: var(--accent-light);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #d33426;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #2d9249;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
}

.btn-icon.btn-sm {
    width: 28px;
    height: 28px;
}

/* ========================================
   Forms
   ======================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.375rem;
}

.form-error {
    font-size: 0.8125rem;
    color: var(--danger);
    margin-top: 0.375rem;
}

/* File Upload */
.file-upload {
    position: relative;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-tertiary);
}

.file-upload:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.file-upload input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.file-upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.file-upload-text {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.file-upload-text strong {
    color: var(--accent);
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    margin-top: 1rem;
    display: none;
}

.image-preview.show {
    display: block;
}

/* ========================================
   Forum Posts List
   ======================================== */

.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.post-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.post-thumbnail {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.post-content { flex: 1; }

.post-meta { margin-top: 0.6rem; color: var(--text-muted); font-size: 0.9rem; display:flex; gap:1rem; align-items:center; }

.badge { padding: 0.15rem 0.5rem; border-radius: 8px; font-weight:700; }
.badge-owner { background: rgba(255,200,0,0.12); color: #ffd966; }
.badge-mod { background: rgba(170,170,170,0.08); color: #e0e0e0; }

/* ========================================
   Post Detail
   ======================================== */

/* Post detail card: unified box with header and body */
.post-detail {
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.post-detail-header {
    background: var(--bg-tertiary);
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.post-detail-title {
    font-size: 1.4rem;
    margin: 0 0 0.25rem 0;
}

.post-detail-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.post-detail-body {
    padding: 1rem 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.post-detail-content {
    flex: 1;
    white-space: pre-wrap;
}

.post-detail-image {
    width: 160px;
    height: 110px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

/* Replies should also be inside the same card look: create separate reply-card area */
.replies-section { padding: 0 1.25rem 1rem 1.25rem; }
.replies-list { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.5rem; }

.reply-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.reply-image {
    width: 96px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.reply-content { flex: 1; }
.reply-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 0.5rem; }
.reply-meta { color: var(--text-muted); font-size: 0.9rem; }

/* Ensure post listing items keep card look */
.post-item {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
}

.post-item:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.post-thumbnail {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.post-excerpt { color: var(--text-secondary); margin-top: 0.35rem; }

/* Links in meta keep accent but no underline */
.post-detail-meta a, .reply-meta a, .post-meta a { text-decoration: none; color: var(--accent); }

/* Make post items align nicely when they wrap an image */
.post-item { display: flex; gap: 1rem; align-items: center; }

/* Improve spacing on post excerpt */
.post-excerpt { color: var(--text-secondary); margin-top: 0.35rem; }

/* ========================================
   Replies
   ======================================== */

/* Replies section styles */
.replies-section {
    margin-top: 2rem;
}

.replies-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.replies-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.reply-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border-radius: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
}

.reply-content {
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
    line-height: 1.6;
}

.reply-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}

.reply-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.reply-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.reply-meta strong {
    color: var(--text-secondary);
}

/* ========================================
   Badges
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-primary {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-success {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(251, 188, 4, 0.1);
    color: #b36b00;
}

.badge-danger {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
}

.badge-owner {
    background: linear-gradient(135deg, #ff9500, #ff5e3a);
    color: white;
}

.badge-mod {
    background: linear-gradient(135deg, #34c759, #30d158);
    color: white;
}

/* ========================================
   Alerts
   ======================================== */

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.alert-info {
    background: var(--accent-light);
    color: var(--accent);
    border: 1px solid rgba(26, 115, 232, 0.2);
}

.alert-success {
    background: rgba(52, 168, 83, 0.1);
    color: var(--success);
    border: 1px solid rgba(52, 168, 83, 0.2);
}

.alert-warning {
    background: rgba(251, 188, 4, 0.1);
    color: #b36b00;
    border: 1px solid rgba(251, 188, 4, 0.2);
}

.alert-danger {
    background: rgba(234, 67, 53, 0.1);
    color: var(--danger);
    border: 1px solid rgba(234, 67, 53, 0.2);
}

/* ========================================
   User Dropdown
   ======================================== */

.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.user-menu-btn:hover {
    background: var(--border);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
    padding: 0.5rem 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
    color: var(--text-primary);
    text-decoration: none;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* ========================================
   Admin Panel Layout
   ======================================== */

.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--navbar-height));
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 1.5rem 0;
    position: sticky;
    top: var(--navbar-height);
    height: calc(100vh - var(--navbar-height));
    overflow-y: auto;
    flex-shrink: 0;
}

.admin-sidebar-header {
    padding: 0 1.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.admin-sidebar-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.admin-sidebar-subtitle {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.admin-nav {
    list-style: none;
    padding: 0 0.75rem;
}

.admin-nav-section {
    margin-bottom: 1.5rem;
}

.admin-nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.admin-nav-item {
    margin-bottom: 0.25rem;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.admin-nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.admin-nav-link.active {
    background: var(--accent-light);
    color: var(--accent);
}

.admin-nav-icon {
    font-size: 1.125rem;
    width: 1.5rem;
    text-align: center;
}

.admin-content {
    flex: 1;
    padding: 2rem;
    min-width: 0;
}

/* ========================================
   Stats Cards
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon-blue {
    background: rgba(26, 115, 232, 0.1);
    color: #1a73e8;
}

.stat-icon-green {
    background: rgba(52, 168, 83, 0.1);
    color: #34a853;
}

.stat-icon-purple {
    background: rgba(156, 39, 176, 0.1);
    color: #9c27b0;
}

.stat-icon-red {
    background: rgba(234, 67, 53, 0.1);
    color: #ea4335;
}

.stat-icon-orange {
    background: rgba(251, 140, 0, 0.1);
    color: #fb8c00;
}

[data-theme="dark"] .stat-icon-blue {
    background: rgba(138, 180, 248, 0.15);
    color: #8ab4f8;
}

[data-theme="dark"] .stat-icon-green {
    background: rgba(129, 201, 149, 0.15);
    color: #81c995;
}

[data-theme="dark"] .stat-icon-purple {
    background: rgba(206, 147, 216, 0.15);
    color: #ce93d8;
}

[data-theme="dark"] .stat-icon-red {
    background: rgba(242, 139, 130, 0.15);
    color: #f28b82;
}

/* ========================================
   Data Tables
   ======================================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-tertiary);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.data-table td {
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    margin-top: auto;
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer-text a {
    color: var(--accent);
    text-decoration: none;
}

.footer-text a:hover {
    text-decoration: underline;
}

/* ========================================
   Image Modal
   ======================================== */

.image-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    padding: 2rem;
}

.image-modal.show {
    display: flex;
}

.image-modal img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
}

/* ========================================
   Utilities
   ======================================== */

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }

.bg-primary { background: var(--bg-primary) !important; }
.bg-secondary { background: var(--bg-secondary) !important; }
.bg-tertiary { background: var(--bg-tertiary) !important; }

.rounded { border-radius: var(--radius) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }

.shadow { box-shadow: var(--shadow) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }
.p-4 { padding: 2rem !important; }

.w-full { width: 100% !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 1024px) {
    .admin-sidebar {
        width: 240px;
    }
    
    .admin-content {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    :root {
        --navbar-height: 56px;
    }
    
    .main-container,
    .content-container {
        padding: 1.5rem 1rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .admin-layout {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem 0;
    }
    
    .admin-nav {
        display: flex;
        overflow-x: auto;
        gap: 0.5rem;
        padding: 0 1rem;
    }
    
    .admin-nav-section {
        display: flex;
        gap: 0.5rem;
        margin-bottom: 0;
    }
    
    .admin-nav-section-title {
        display: none;
    }
    
    .admin-nav-link {
        white-space: nowrap;
        padding: 0.5rem 1rem;
    }
    
    .admin-nav-icon {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .navbar-nav {
        display: none;
    }
    
    .post-item {
        flex-direction: column;
    }
    
    .post-thumbnail {
        width: 100%;
        height: 160px;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Forum sidebar and index specific styles */

.forum-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .forum-grid {
        grid-template-columns: 1fr;
    }
}

.sidebar {
    position: relative;
}

.sidebar .section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.btn-new-topic {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    border-radius: 28px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    border: none;
    cursor: pointer;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
    transition: transform 180ms ease, box-shadow 180ms.ease;
}

.btn-new-topic:hover {
    transform: translateY(-2px);
}

.sidebar .card {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
}

.category-card .category-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.4rem;
    border-radius: 8px;
    transition: background 160ms ease;
}

.category-item:hover {
    background: var(--bg-tertiary);
}

.category-item .cat-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: rgba(255,255,255,0.02);
    color: var(--accent);
    font-size: 0.95rem;
}

.category-item .cat-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.category-meta {
    margin-top: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-card {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
}

.stat-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    color: var(--text-secondary);
}

.stat-pill {
    background: var(--border);
    color: var(--text-primary);
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}

.stat-card .muted-link {
    display: inline-block;
    margin-top: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

/* Global link reset: remove default blue color and underlines across the site */
/* Ensures links inherit text color and no text-decoration by default */

a, a:link, a:visited {
    color: inherit;
    text-decoration: none;
}

/* Keep a clear hover/ focus state but no underline */
a:hover, a:focus, a:active {
    color: var(--accent);
    text-decoration: none;
    outline: none;
}

/* For small muted links where a color is desired, keep existing classes */
.muted-link, .nav-link, .cat-link {
    text-decoration: none;
}

/* Reply button and inline reply form */
.btn-reply {
    border-radius: 8px;
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

.reply-form-active {
    padding: 1rem;
    margin: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
}

/* small icon button style */
.btn-icon {
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
}

.btn-sm { font-size: 0.85rem; padding: 0.4rem 0.6rem; }

/* fix badges spacing */
.badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 8px; font-weight:700; }

/* ensure reply-item inner buttons align right */
.reply-item { position: relative; }
.reply-item .btn-reply { margin-left: auto; }