/* ===================================
   CSS Variables & Root Styles
   =================================== */
:root {
    /* Colors - Light Theme */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #f1f5f9;

    /* Text Colors */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Borders */
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 200ms ease;
    --transition-slow: 300ms ease;

    /* Layout */
    --header-height: 70px;
    --sidebar-width: 260px;
    --container-max: 1400px;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    --border-color: #334155;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

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

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

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

/* ===================================
   Utility Classes
   =================================== */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ===================================
   Header
   =================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="dark"] .header {
    background: rgba(15, 23, 42, 0.95);
}

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

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

.logo i {
    color: var(--primary);
    font-size: var(--font-size-2xl);
}

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

/* Search */
.search-container {
    flex: 1;
    max-width: 500px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--space-sm) var(--space-lg);
    padding-left: 2.75rem;
    padding-right: 3rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius-full);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    transition: all var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-icon {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-kbd {
    position: absolute;
    right: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    padding: 2px 6px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

/* Nav Actions */
.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* ===================================
   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-sm);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

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

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

.btn-ghost {
    color: var(--text-secondary);
    padding: var(--space-sm);
}

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

.btn-github {
    background: #24292e;
    color: white;
}

.btn-github:hover {
    background: #1a1e22;
}

.btn-full {
    width: 100%;
}

/* ===================================
   Main Layout
   =================================== */
.main {
    padding-top: calc(var(--header-height) + var(--space-xl));
    padding-bottom: var(--space-2xl);
    min-height: calc(100vh - 200px);
}

.main-grid {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr 300px;
    gap: var(--space-xl);
}

/* ===================================
   Sidebar
   =================================== */
.sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
    height: fit-content;
}

.sidebar-left {
    padding-right: var(--space-md);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sidebar-link,
.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
    cursor: pointer;
}

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

.sidebar-link.active,
.nav-link.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 500;
}

.sidebar-link i,
.nav-link i {
    width: 20px;
    text-align: center;
}

.sidebar-section {
    margin-top: var(--space-xl);
}

.sidebar-title {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
    padding: 0 var(--space-md);
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
}

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

.category-item .count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ===================================
   Stats Banner
   =================================== */
.stats-banner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--border-radius-sm);
    color: white;
    font-size: var(--font-size-lg);
}

.stat-icon-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

/* ===================================
   Filter Tabs
   =================================== */
.filter-tabs {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
}

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

.tab-btn.active {
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.39);
}

/* ===================================
   Questions List
   =================================== */
.questions-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.question-card {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all var(--transition);
}

.question-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary-light);
}

/* Question Stats */
.question-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    min-width: 70px;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--border-radius-sm);
    min-width: 60px;
}

.stat-box.votes {
    background: rgba(99, 102, 241, 0.1);
}

.stat-box.answers {
    background: rgba(16, 185, 129, 0.1);
}

.stat-box.answers.has-accepted {
    background: var(--success);
    color: white;
}

.stat-box.views {
    background: var(--bg-tertiary);
}

.stat-box .number {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.stat-box .label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.stat-box.has-accepted .label {
    color: rgba(255, 255, 255, 0.9);
}

/* Question Content */
.question-content {
    flex: 1;
    min-width: 0;
}

.question-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

.question-excerpt {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.question-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.tag {
    padding: 4px 10px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-full);
    transition: all var(--transition);
}

.tag:hover {
    background: rgba(99, 102, 241, 0.2);
}

.question-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.question-author {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.author-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--border-radius-full);
    object-fit: cover;
}

.author-name {
    color: var(--primary);
    font-weight: 500;
}

.author-reputation {
    color: var(--text-muted);
}

/* ===================================
   Sidebar Right
   =================================== */
.sidebar-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.sidebar-card-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-card-title i {
    color: var(--primary);
}

/* Top Users */
.top-users {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.top-user {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
}

.top-user:hover {
    background: var(--bg-hover);
}

.top-user-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    border-radius: var(--border-radius-full);
}

.top-user-rank.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: white;
}

.top-user-rank.silver {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
}

.top-user-rank.bronze {
    background: linear-gradient(135deg, #d97706 0%, #92400e 100%);
    color: white;
}

.top-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius-full);
}

.top-user-info {
    flex: 1;
    min-width: 0;
}

.top-user-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-user-rep {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.tag-cloud-item {
    padding: 6px 12px;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-full);
    transition: all var(--transition);
}

.tag-cloud-item:hover {
    background: var(--primary);
    color: white;
}

.tag-count {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-left: var(--space-xs);
}

.tag-cloud-item:hover .tag-count {
    color: rgba(255, 255, 255, 0.8);
}

/* Mini Questions */
.mini-questions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.mini-question {
    padding: var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
}

.mini-question:hover {
    background: var(--bg-hover);
}

.mini-question-title {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}

.mini-question-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* ===================================
   Badges
   =================================== */
.badge {
    padding: 2px 8px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    background: var(--primary);
    color: white;
    border-radius: var(--border-radius-full);
    margin-left: auto;
}

.badge-warning {
    background: var(--warning);
}

/* ===================================
   Modal
   =================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: var(--space-lg);
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s ease;
}

.modal-small {
    max-width: 400px;
}

@keyframes modalSlide {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-header i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xl);
    color: var(--text-muted);
    border-radius: var(--border-radius-full);
    transition: all var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-form {
    padding: var(--space-lg);
}

.form-group {
    margin-bottom: var(--space-md);
}

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    transition: all var(--transition);
}

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

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

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

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.forgot-password {
    font-size: var(--font-size-sm);
    color: var(--primary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.modal-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

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

.modal-footer-text {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-top: var(--space-lg);
}

/* ===================================
   Toast
   =================================== */
.toast-container {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    z-index: 3000;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-full);
}

.toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.toast-error .toast-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

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

.footer-content {
    display: grid;
    grid-template-columns: 2fr 3fr 1fr;
    gap: var(--space-xl);
    padding: var(--space-2xl) 0;
}

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

.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;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

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

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

.footer-social {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.social-link {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border-radius: var(--border-radius-full);
    transition: all var(--transition);
}

.social-link:hover {
    background: var(--primary);
    color: white;
}

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

/* ===================================
   Loading Spinner
   =================================== */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    gap: var(--space-md);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary);
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 1200px) {
    .main-grid {
        grid-template-columns: var(--sidebar-width) 1fr;
    }

    .sidebar-right {
        display: none;
    }
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-left {
        display: none;
    }

    .stats-banner {
        grid-template-columns: repeat(2, 1fr);
    }

    .search-container {
        display: none;
    }

    .nav-actions span {
        display: none;
    }
}

@media (max-width: 600px) {
    .stats-banner {
        grid-template-columns: 1fr;
    }

    .question-card {
        flex-direction: column;
    }

    .question-stats {
        flex-direction: row;
        min-width: auto;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-links {
        grid-template-columns: 1fr;
    }

    .footer-social {
        justify-content: center;
    }
}

/* ===================================
   Auth Modal Styles
   =================================== */
.modal-auth {
    max-width: 420px;
}

.auth-tabs {
    display: flex;
    gap: var(--space-sm);
}

.auth-tab {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition);
}

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

.auth-tab.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.auth-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-lg);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.auth-info i {
    color: var(--primary);
}

.input-with-icon {
    position: relative;
}

.input-with-icon i {
    position: absolute;
    left: var(--space-md);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: 2.75rem;
}

.auth-methods {
    margin-top: var(--space-lg);
}

.btn-ad {
    background: linear-gradient(135deg, #0078d4 0%, #106ebe 100%);
    color: white;
}

.btn-ad:hover {
    background: linear-gradient(135deg, #106ebe 0%, #005a9e 100%);
}

/* ===================================
   User Dropdown
   =================================== */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    z-index: 1001;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.dropdown-header img {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-full);
}

.dropdown-header strong {
    display: block;
    color: var(--text-primary);
}

.dropdown-header span {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-xs) 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    transition: all var(--transition);
}

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

.dropdown-item i {
    width: 18px;
    text-align: center;
}

.dropdown-item.admin-link {
    color: var(--primary);
}

.dropdown-item.logout {
    color: var(--danger);
}

.dropdown-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Nav actions positioning for dropdown */
.nav-actions {
    position: relative;
}

/* ===================================
   Tags Page
   =================================== */
.page-header {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.page-header h2 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.page-header h2 i {
    color: var(--primary);
}

.page-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-md);
}

.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.tag-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    cursor: pointer;
}

.tag-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.tag-name {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.tag-name i {
    font-size: var(--font-size-sm);
    opacity: 0.7;
}

.tag-stats {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.tag-stats i {
    margin-right: 4px;
}

.tag-description {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===================================
   Users Page
   =================================== */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-lg);
}

.user-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: var(--space-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    cursor: pointer;
    text-align: center;
    position: relative;
}

.user-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.user-rank {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: 4px 12px;
    font-size: var(--font-size-sm);
    font-weight: 700;
    border-radius: var(--border-radius-full);
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.user-rank.gold {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: white;
}

.user-rank.silver {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    color: white;
}

.user-rank.bronze {
    background: linear-gradient(135deg, #d97706 0%, #92400e 100%);
    color: white;
}

.user-card-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--border-radius-full);
    margin-bottom: var(--space-md);
    border: 3px solid var(--border-color);
}

.user-card-info {
    margin-bottom: var(--space-md);
}

.user-card-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.user-card-username {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.user-card-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.user-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-stat .stat-value {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--primary);
}

.user-stat .stat-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}