/* ========================================
   HSK Zone Forum - Flarum Style CSS
   Modern, clean, responsive design
   Optimized for East & Southeast Asia
   ======================================== */

/* CSS Variables */
:root {
    /* Colors - Flarum inspired */
    --primary: #4d698e;
    --primary-dark: #3d5572;
    --primary-light: #e8ecf1;
    --secondary: #de1515;
    --success: #7baaf7;
    --warning: #f0a030;
    --danger: #d66;
    --info: #5bc0de;
    
    /* Legal/Disclaimer colors */
    --legal-bg: #fff8e1;
    --legal-border: #ffc107;
    --legal-text: #5d4037;
    
    /* Text colors */
    --text-primary: #111;
    --text-secondary: #667c99;
    --text-muted: #aaa;
    --text-light: #fff;
    
    /* Background colors */
    --bg-primary: #fff;
    --bg-secondary: #f2f5f8;
    --bg-tertiary: #e8ecf1;
    --bg-dark: #4d698e;
    
    /* Border colors */
    --border-color: #e0e5ec;
    --border-light: #f0f2f5;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-xxl: 48px;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.15);
    
    /* Typography */
    --font-family: 'Open Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-base: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-xxl: 24px;
    --font-size-xxxl: 32px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    
    /* Container */
    --container-max-width: 1100px;
    --header-height: 60px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--font-size-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* Focus styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--space-md);
}

/* ========================================
   Legal Banner & Disclaimer
   ======================================== */
.legal-banner {
    background: var(--legal-bg);
    border-bottom: 2px solid var(--legal-border);
    padding: var(--space-sm) 0;
    position: relative;
}

.legal-banner .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.legal-text {
    font-size: var(--font-size-sm);
    color: var(--legal-text);
    margin: 0;
    padding-right: var(--space-xl);
    line-height: 1.5;
}

.legal-text strong {
    color: var(--danger);
}

.legal-close {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: var(--font-size-xl);
    color: var(--legal-text);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.legal-close:hover {
    background: rgba(0,0,0,0.1);
}

/* Legal Section in Footer */
.legal-section {
    background: var(--legal-bg);
    border: 1px solid var(--legal-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.legal-section h3 {
    color: var(--legal-text);
    font-size: var(--font-size-md);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.legal-section h3::before {
    content: '⚖️';
}

.legal-content {
    font-size: var(--font-size-sm);
    color: var(--legal-text);
    line-height: 1.7;
}

.legal-content p {
    margin-bottom: var(--space-sm);
}

.legal-content strong {
    color: var(--danger);
}

.legal-zh {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px dashed var(--legal-border);
    font-family: 'Noto Sans SC', sans-serif;
}

/* ========================================
   Header
   ======================================== */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
    color: var(--primary);
}

.logo-icon {
    font-size: var(--font-size-xxl);
}

.main-nav {
    display: flex;
    gap: var(--space-lg);
}

.nav-link {
    color: var(--text-secondary);
    font-weight: 500;
    padding: var(--space-sm) 0;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 200px;
    padding: var(--space-sm) var(--space-lg) var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    width: 250px;
}

.search-btn {
    position: absolute;
    right: var(--space-sm);
    background: none;
    border: none;
    cursor: pointer;
    opacity: 0.6;
}

.language-switcher {
    display: flex;
    gap: var(--space-xs);
}

.lang-btn {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: all var(--transition-fast);
}

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

.lang-btn.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--text-light);
}

.btn-primary:hover {
    background: var(--primary-dark);
    text-decoration: none;
    color: var(--text-light);
}

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

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    text-decoration: none;
}

.btn-danger {
    background: var(--danger);
    color: var(--text-light);
}

.btn-danger:hover {
    background: #c44;
    color: var(--text-light);
    text-decoration: none;
}

.btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--font-size-md);
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.user-menu-btn:hover {
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-arrow {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: var(--space-xs);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    display: none;
    z-index: 1001;
}

.user-menu:hover .dropdown-menu,
.user-menu:focus-within .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: var(--font-size-base);
}

.dropdown-menu a:hover {
    background: var(--bg-secondary);
    text-decoration: none;
}

.dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: var(--space-xs) 0;
}

/* Mobile Menu */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: var(--space-sm);
    background: none;
    border: none;
}

.mobile-menu-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    transition: all var(--transition-fast);
}

.mobile-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-md);
    z-index: 999;
}

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

.mobile-nav a {
    display: block;
    padding: var(--space-md);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.mobile-nav a:last-child {
    border-bottom: none;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    padding: var(--space-xl) 0;
    min-height: calc(100vh - var(--header-height) - 200px);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-xl);
    padding: var(--space-xxl);
    margin-bottom: var(--space-xl);
    color: var(--text-light);
    text-align: center;
}

.hero-content h1 {
    font-size: var(--font-size-xxxl);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    opacity: 0.9;
    margin-bottom: var(--space-sm);
}

.hero-description {
    font-size: var(--font-size-base);
    opacity: 0.8;
    margin-bottom: var(--space-xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-xxl);
    margin-bottom: var(--space-xl);
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: var(--font-size-xxl);
    font-weight: 700;
}

.stat-label {
    font-size: var(--font-size-sm);
    opacity: 0.8;
}

.hero-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

.hero-actions .btn-ghost {
    color: var(--text-light);
    border-color: rgba(255,255,255,0.3);
}

.hero-actions .btn-ghost:hover {
    background: rgba(255,255,255,0.1);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.section-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 600;
}

.view-all {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.view-all:hover {
    color: var(--primary);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: var(--space-xs);
    background: var(--bg-tertiary);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
}

.tab-btn {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: none;
    border: none;
}

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

.tab-btn.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Categories
   ======================================== */
.categories-section {
    margin-bottom: var(--space-xl);
}

/* ===== Categories - Flarum-style list layout ===== */
.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.cat-row {
    border-bottom: 1px solid var(--border-color);
}
.cat-row:last-child {
    border-bottom: none;
}

.cat-row-main {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.cat-row-main:hover {
    background: var(--bg-secondary);
    text-decoration: none;
    color: inherit;
}

.cat-row-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.cat-row-info {
    flex: 1;
    min-width: 0;
}

.cat-row-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
    color: var(--text-primary);
}

.cat-row-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 2px 0 0;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-row-arrow {
    font-size: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.15s;
}
.cat-row-main:hover .cat-row-arrow {
    transform: translateX(3px);
    color: var(--primary);
}

/* Subcategory tags row */
.cat-row-subs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 14px 76px;
}

.cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.cat-tag:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
    text-decoration: none;
}

.cat-tag-icon {
    font-size: 14px;
    line-height: 1;
}

.cat-tag-text {
    font-weight: 500;
}

/* Legacy row */
.cat-row-legacy {
    opacity: 0.7;
}
.cat-row-legacy:hover {
    opacity: 1;
}
.cat-tag-legacy {
    opacity: 0.6;
    font-size: 12px;
    padding: 4px 10px;
}
.cat-tag-legacy:hover {
    opacity: 1;
}

/* Section subtitle */
.section-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 400;
}

.category-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.category-icon.blue { background: var(--primary-light); }
.category-icon.green { background: #e8f5e9; }
.category-icon.orange { background: #fff3e0; }
.category-icon.purple { background: #f3e5f5; }
.category-icon.red { background: #ffebee; }
.category-icon.teal { background: #e0f2f1; }
.category-icon.indigo { background: #e8eaf6; }

.category-info h3 {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.category-info p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.category-stats {
    display: flex;
    gap: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.category-stats span {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* ========================================
   Discussions List
   ======================================== */
.discussions-section {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.discussions-list {
    padding: var(--space-md);
}

.discussion-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.discussion-item:last-child {
    border-bottom: none;
}

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

.discussion-avatar {
    flex-shrink: 0;
}

.discussion-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.discussion-content {
    flex: 1;
    min-width: 0;
}

.discussion-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.discussion-title a {
    color: var(--text-primary);
}

.discussion-title a:hover {
    color: var(--primary);
}

.discussion-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.discussion-meta a {
    color: var(--primary);
    font-weight: 500;
}

.discussion-tags {
    display: flex;
    gap: var(--space-xs);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-sm);
    background: var(--primary-light);
    color: var(--primary);
    font-size: var(--font-size-xs);
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.discussion-stats {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    min-width: 60px;
}

.stat-item.replies {
    justify-content: center;
}

.stat-item.views {
    justify-content: flex-end;
}

.load-more {
    padding: var(--space-md);
    text-align: center;
    border-top: 1px solid var(--border-light);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-xxl) 0 var(--space-lg);
    margin-top: var(--space-xxl);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-xxl);
    margin-bottom: var(--space-xl);
}

.footer-brand .logo {
    margin-bottom: var(--space-sm);
}

.footer-brand p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

.footer-region {
    margin-top: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--primary);
    font-weight: 500;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.footer-column h4 {
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.footer-column a {
    display: block;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    padding: var(--space-xs) 0;
}

.footer-column a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.footer-disclaimer {
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.form-label .required {
    color: var(--danger);
    margin-left: var(--space-xs);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    transition: border-color var(--transition-fast);
    font-size: var(--font-size-base);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

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

.form-hint {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: var(--font-size-sm);
    color: var(--danger);
    margin-top: var(--space-xs);
}

/* ========================================
   Auth Pages
   ======================================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height) - 200px);
    padding: var(--space-xl) 0;
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.auth-header h1 {
    font-size: var(--font-size-xxl);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.auth-header p {
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* Legal notice on auth pages */
.auth-legal {
    background: var(--legal-bg);
    border: 1px solid var(--legal-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-xs);
    color: var(--legal-text);
    line-height: 1.6;
}

.auth-legal strong {
    color: var(--danger);
}

/* ========================================
   Discussion Detail
   ======================================== */
.discussion-detail {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.discussion-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.discussion-header h1 {
    font-size: var(--font-size-xxl);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.discussion-actions {
    display: flex;
    gap: var(--space-sm);
}

.post-list {
    padding: var(--space-md);
}

.post-item {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.post-item:last-child {
    border-bottom: none;
}

.post-sidebar {
    width: 80px;
    flex-shrink: 0;
    text-align: center;
}

.post-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: var(--space-sm);
}

.post-author {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.post-role {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.post-content-wrapper {
    flex: 1;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.post-time {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.post-body {
    font-size: var(--font-size-base);
    line-height: 1.8;
    color: var(--text-primary);
}

.post-body p {
    margin-bottom: var(--space-md);
}

.post-body img {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
}

.post-footer {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

.post-action {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    transition: color var(--transition-fast);
    background: none;
    border: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.post-action:hover {
    color: var(--primary);
    background: var(--bg-secondary);
    text-decoration: none;
}

.post-action.active {
    color: var(--primary);
}

/* Nested replies */
.nested-replies {
    margin-left: var(--space-xl);
    margin-top: var(--space-lg);
    padding-left: var(--space-lg);
    border-left: 2px solid var(--border-color);
}

.nested-reply {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

/* Reply Form */
.reply-section {
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}

.reply-form {
    display: flex;
    gap: var(--space-md);
}

.reply-avatar {
    flex-shrink: 0;
}

.reply-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.reply-input-wrapper {
    flex: 1;
}

.reply-toolbar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    flex-wrap: wrap;
}

.toolbar-btn {
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

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

/* Posting guidelines reminder */
.posting-guidelines {
    background: var(--legal-bg);
    border: 1px solid var(--legal-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--legal-text);
}

.posting-guidelines h4 {
    margin-bottom: var(--space-xs);
    color: var(--danger);
}

.posting-guidelines ul {
    margin-left: var(--space-lg);
    margin-bottom: 0;
}

.posting-guidelines li {
    margin-bottom: var(--space-xs);
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-md));
    right: var(--space-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-primary);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast-message {
    flex: 1;
    font-size: var(--font-size-sm);
}

.toast-close {
    color: var(--text-muted);
    font-size: var(--font-size-lg);
    line-height: 1;
    background: none;
    border: none;
    cursor: pointer;
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.hiding {
    animation: slideOut 0.3s ease forwards;
}

/* ========================================
   Responsive Design - Mobile First
   ======================================== */
@media (max-width: 992px) {
    .main-nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .hero-stats {
        gap: var(--space-lg);
    }
    
    .footer-inner {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    
    .footer-links {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .legal-text {
        padding-right: var(--space-xl);
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 768px) {
    .search-box {
        display: none;
    }
    
    .language-switcher {
        display: none;
    }
    
    .hero {
        padding: var(--space-xl);
    }
    
    .hero-content h1 {
        font-size: var(--font-size-xxl);
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--space-md);
    }
    
    .hero-actions {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .filter-tabs {
        width: 100%;
        overflow-x: auto;
    }
    
    .discussion-item {
        flex-wrap: wrap;
    }
    
    .discussion-stats {
        width: 100%;
        justify-content: flex-start;
        margin-top: var(--space-sm);
    }
    
    .footer-links {
        grid-template-columns: 1fr;
    }
    
    .post-item {
        flex-direction: column;
    }
    
    .post-sidebar {
        width: 100%;
        display: flex;
        align-items: center;
        gap: var(--space-md);
        text-align: left;
    }
    
    .post-avatar {
        margin-bottom: 0;
    }
    
    .reply-form {
        flex-direction: column;
    }
    
    .nested-replies {
        margin-left: var(--space-md);
        padding-left: var(--space-md);
    }
    
    .legal-section {
        padding: var(--space-md);
    }
    
    .legal-content {
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-sm);
    }
    
    .categories-grid {
        grid-template-columns: 1fr;
    }
    
    .auth-box {
        padding: var(--space-lg);
    }
    
    .legal-banner {
        padding: var(--space-xs) 0;
    }
    
    .legal-text {
        font-size: var(--font-size-xs);
        line-height: 1.4;
    }
}

/* ========================================
   Loading States
   ======================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-sm);
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--space-md);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ========================================
   Utilities
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-xs); }
.mt-2 { margin-top: var(--space-sm); }
.mt-3 { margin-top: var(--space-md); }
.mt-4 { margin-top: var(--space-lg); }
.mt-5 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-xs); }
.mb-2 { margin-bottom: var(--space-sm); }
.mb-3 { margin-bottom: var(--space-md); }
.mb-4 { margin-bottom: var(--space-lg); }
.mb-5 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-xs); }
.p-2 { padding: var(--space-sm); }
.p-3 { padding: var(--space-md); }
.p-4 { padding: var(--space-lg); }
.p-5 { padding: var(--space-xl); }

/* Print styles */
@media print {
    .header,
    .footer,
    .legal-banner,
    .hero-actions,
    .reply-section {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
}
