:root {
    --primary: #8B4513;
    --primary-dark: #6B3410;
    --primary-light: #A0522D;
    --accent: #D4A574;
    --accent-light: #F5E6D3;
    --bg-warm: #FFF8F0;
    --text-dark: #2C1810;
    --text-muted: #6B5B4F;
    --border-warm: #E8D5C4;
    --success: #2E7D32;
    --danger: #C62828;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-warm);
    color: var(--text-dark);
    font-size: 16px;
    line-height: 1.7;
}

h1, h2, h3, h4, h5 {
    font-family: 'Merriweather', Georgia, serif;
    color: var(--primary-dark);
}

.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
    padding: 0.6rem 0;
}

.navbar-brand {
    font-family: 'Merriweather', serif;
    letter-spacing: 1px;
}

.nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.8rem !important;
    transition: opacity 0.2s;
}

.nav-link:hover {
    opacity: 0.85;
}

.hero-section {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 50%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
}

.hero-section h1 {
    color: white;
    font-size: 1.8rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-section p {
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Cards */
.card {
    border: 1px solid var(--border-warm);
    border-radius: 12px;
    background: white;
    transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.1);
}

.card-header {
    background: var(--accent-light);
    border-bottom: 2px solid var(--accent);
    border-radius: 12px 12px 0 0 !important;
    font-family: 'Merriweather', serif;
    color: var(--primary-dark);
    font-weight: 700;
    padding: 0.8rem 1.2rem;
}

/* Category cards */
.category-card {
    margin-bottom: 1.5rem;
}

.category-card .card-header {
    font-size: 1.15rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.category-card .card-header > i {
    font-size: 1.3rem;
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.15rem;
}

.category-card .card-header > div {
    min-width: 0;
    flex: 1;
}

.category-desc {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 400;
    font-family: 'Open Sans', sans-serif;
}

/* Subcategory items */
.subcategory-item {
    display: flex;
    align-items: center;
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border-warm);
    transition: background 0.15s;
}

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

.subcategory-item:hover {
    background-color: var(--accent-light);
}

.subcategory-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-right: 1rem;
}

.subcategory-info {
    flex-grow: 1;
    min-width: 0;
}

.subcategory-info h6 {
    margin: 0;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary-dark);
}

.subcategory-info h6 a {
    text-decoration: none;
    color: inherit;
}

.subcategory-info h6 a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.subcategory-info p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.subcategory-stats {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
    margin-left: 1rem;
}

.stat-item {
    text-align: center;
    min-width: 55px;
}

.stat-item .stat-number {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.stat-item .stat-label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Post list */
.post-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid var(--border-warm);
    transition: background 0.15s;
    gap: 0.75rem;
}

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

.post-item:hover {
    background-color: var(--accent-light);
}

.post-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--accent-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.post-icon.pinned {
    background: var(--primary);
    color: white;
}

.post-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.post-info h6 {
    margin: 0 0 0.25rem;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-info h6 a {
    text-decoration: none;
    color: var(--text-dark);
}

.post-info h6 a:hover {
    color: var(--primary);
}

.post-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    word-wrap: break-word;
}

.post-meta a {
    color: var(--primary);
    text-decoration: none;
}

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

.post-stats .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Post detail */
.post-content {
    font-size: 1.05rem;
    line-height: 1.8;
    padding: 1.5rem;
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1rem 0;
}

.comment-item {
    border-left: 3px solid var(--accent);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 0 8px 8px 0;
}

.comment-item:hover {
    border-left-color: var(--primary);
}

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.bg-primary {
    background: var(--primary) !important;
}

/* Forms */
.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.2rem rgba(139, 69, 19, 0.15);
}

.form-control, .form-select {
    border: 1px solid var(--border-warm);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-size: 1rem;
}

textarea.form-control {
    min-height: 150px;
}

/* Alert */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.95rem;
}

/* Badge */
.badge {
    font-weight: 600;
    border-radius: 6px;
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* Pagination */
.page-link {
    color: var(--primary);
    border-color: var(--border-warm);
    padding: 0.5rem 0.9rem;
    font-size: 0.95rem;
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

.page-link:hover {
    background: var(--accent-light);
    color: var(--primary-dark);
}

/* Footer */
footer {
    background: var(--text-dark) !important;
}

footer h5, footer h6 {
    color: var(--accent) !important;
    font-family: 'Open Sans', sans-serif;
}

footer a:hover {
    color: var(--accent) !important;
}

/* Admin */
.admin-sidebar .nav-link {
    color: var(--text-dark);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: var(--accent-light);
    color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section h1 { font-size: 1.4rem; }
    .hero-section p { font-size: 0.9rem; }
    .subcategory-stats { display: none; }
    .post-stats { display: none; }
    .subcategory-item { padding: 0.7rem 0.8rem; }
    .post-item { padding: 0.7rem 0.8rem; }
    .post-icon { width: 32px; height: 32px; font-size: 0.9rem; }
    .subcategory-icon { width: 36px; height: 36px; font-size: 1rem; }
    body { font-size: 15px; }
    .navbar-brand span { font-size: 0.9rem; }
    .card-header h4 { font-size: 1.15rem; }
    .d-flex.flex-wrap.gap-2 { gap: 0.35rem !important; }
}

/* Large text for elderly users */
@media (min-width: 769px) {
    .post-content { font-size: 1.1rem; }
}

/* Accessibility */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.visually-hidden-focusable:focus {
    position: static !important;
}
