:root {
    --primary: #5C6BC0;
    --primary-dark: #3949AB;
    --primary-light: #E8EAF6;
    --secondary: #26C6DA;
    --accent: #FF7043;
    --bg: #F5F7FA;
    --card-bg: #FFFFFF;
    --text: #2D3748;
    --text-muted: #718096;
    --border: #E2E8F0;
    --success: #48BB78;
    --warning: #ECC94B;
    --danger: #FC8181;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1; }

/* Navbar */
#main-navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 2px 20px rgba(57,73,171,0.25);
    padding: 0.6rem 0;
}

#main-navbar .navbar-brand {
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

#main-navbar .nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    transition: background 0.2s;
}

#main-navbar .nav-link:hover,
#main-navbar .nav-link.active {
    background: rgba(255,255,255,0.15);
}

/* Flash messages */
.flash-container .alert {
    border-left: 4px solid;
    font-size: 0.92rem;
}

.alert-success { border-left-color: var(--success); }
.alert-danger  { border-left-color: var(--danger); }
.alert-warning { border-left-color: var(--warning); }
.alert-info    { border-left-color: var(--secondary); }

/* Cards */
.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

.card-img-top {
    height: 180px;
    object-fit: cover;
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
    color: white;
    padding: 5rem 0 4rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    top: -200px;
    right: -100px;
}

.hero-section::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: -150px;
    left: -50px;
}

/* Section titles */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    border-left: 4px solid var(--primary);
    padding-left: 0.75rem;
    margin-bottom: 1.5rem;
}

/* Activity card */
.activity-card .card-img-top {
    height: 160px;
}

.activity-card .badge-status {
    position: absolute;
    top: 10px;
    right: 10px;
}

.activity-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Community card */
.community-card .community-avatar {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid var(--primary-light);
}

.community-card .member-count {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Post list */
.post-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.post-item:last-child { border-bottom: none; }

.post-item:hover {
    background: var(--primary-light);
    border-radius: 8px;
    padding-left: 0.5rem;
}

.post-item .post-title a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.post-item .post-title a:hover { color: var(--primary); }

.post-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Auth pages */
.auth-card {
    max-width: 440px;
    margin: 4rem auto;
    border-radius: 16px;
    border: none;
    box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}

.auth-card .card-body { padding: 2.5rem; }

.auth-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

/* Form controls */
.form-control, .form-select {
    border-radius: 8px;
    border: 1.5px solid var(--border);
    padding: 0.6rem 0.9rem;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(92,107,192,0.15);
}

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1.4rem;
    font-weight: 500;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
    border-radius: 8px;
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Page header */
.page-header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 2.5rem 0 2rem;
    margin-bottom: 2rem;
}

/* Admin sidebar */
.admin-sidebar {
    background: white;
    border-radius: 12px;
    padding: 0.5rem 0;
    border: 1px solid var(--border);
    position: sticky;
    top: 80px;
}

.admin-sidebar .nav-link {
    color: var(--text);
    padding: 0.6rem 1.2rem;
    border-radius: 0;
    font-size: 0.93rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 500;
}

.admin-sidebar .nav-link i { width: 20px; }

/* Stats cards */
.stat-card {
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
    border: none;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-number { font-size: 2rem; font-weight: 700; }

/* Footer */
.footer {
    background: white;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Avatar */
.avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-user     { background: #E2E8F0; color: #4A5568; }
.role-internal { background: #BEE3F8; color: #2B6CB0; }
.role-admin    { background: #FED7E2; color: #C53030; }
.role-root     { background: #FAF089; color: #744210; }

/* Responsive */
@media (max-width: 768px) {
    .hero-section { padding: 3rem 0 2.5rem; }
    .auth-card { margin: 2rem 1rem; }
}

/* Pagination */
.pagination .page-link {
    border-radius: 8px;
    margin: 0 2px;
    color: var(--primary);
    border-color: var(--border);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Detail page */
.content-body {
    line-height: 1.85;
    font-size: 1rem;
    color: var(--text);
}

.content-body p { margin-bottom: 1rem; }

/* Tag chips */
.tag-chip {
    display: inline-block;
    padding: 3px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}
