
:root {
    --primary: #0056b3; /* Professional Deep Blue */
    --primary-hover: #004494;
    --bg-gradient: #f4f7f6; /* Clean light gray background */
    --card-bg: #ffffff;
    --card-dark: #f8f9fa;
    --text-main: #333333;
    --text-muted: #666666;
    --border-color: #e0e0e0;
    --header-bg: #ffffff;
    --header-text: #222222;
    --radius: 8px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.08);
    --accent-green: #28a745;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: var(--bg-gradient);
    color: var(--text-main); 
    line-height: 1.6; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; color: var(--header-text); }
a { text-decoration: none; color: var(--primary); transition: color 0.2s; }
a:hover { color: var(--primary-hover); }
ul { list-style: none; }

.icon { width: 1.25em; height: 1.25em; display: inline-block; vertical-align: -0.125em; fill: currentColor; }

/* Header */
.site-header { 
    background: var(--header-bg); 
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-container { 
    max-width: 1200px; margin: 0 auto; padding: 12px 20px; 
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 15px; 
}
.logo { font-size: 1.4rem; font-weight: 700; color: var(--header-text); display: flex; align-items: center; gap: 8px; }
.logo:hover { color: var(--primary); }

/* Search */
.search-wrapper { flex-grow: 1; max-width: 450px; position: relative; display: none; }
@media(min-width: 768px) { .search-wrapper { display: block; } }
.search-input { 
    width: 100%; padding: 10px 40px 10px 16px; 
    border-radius: 6px; border: 1px solid #ced4da; 
    background: #f1f3f5; outline: none; font-size: 0.95rem; color: #333; transition: all 0.2s;
}
.search-input:focus { border-color: var(--primary); background: #ffffff; box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1); }
.search-btn { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; }
.search-results { 
    position: absolute; top: 100%; left: 0; right: 0; background: #ffffff; 
    border: 1px solid var(--border-color); border-radius: 6px; margin-top: 8px; 
    box-shadow: var(--shadow-md); max-height: 350px; overflow-y: auto; display: none; 
}
.search-results.active { display: block; }
.search-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border-color); color: var(--text-main); }
.search-item:hover { background-color: #f8f9fa; }
.search-item-title { font-weight: 600; font-size: 0.95rem; margin-bottom: 4px; color: var(--primary); }
.search-item-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Nav Buttons */
.header-nav { display: flex; align-items: center; gap: 15px; }
.nav-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 6px; font-size: 0.95rem; transition: color 0.2s;}
.nav-btn:hover { color: var(--primary); }
.btn-primary { 
    background-color: var(--primary); color: #fff; padding: 8px 16px; 
    border-radius: 6px; font-weight: 500; border: none; cursor: pointer; 
    display: flex; align-items: center; gap: 6px; transition: background 0.2s; 
}
.btn-primary:hover { background-color: var(--primary-hover); color: #fff; }

/* Layout */
.layout-container { max-width: 1200px; margin: 30px auto 40px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 30px; flex-grow: 1; width: 100%; }
@media(min-width: 860px) { .layout-container { flex-direction: row; } }
.main-content { flex-grow: 1; width: 100%; }
@media(min-width: 860px) { .main-content { width: 72%; } }
.sidebar { width: 100%; display: flex; flex-direction: column; gap: 20px; }
@media(min-width: 860px) { .sidebar { width: 28%; } }

/* Sidebar Cards */
.card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.card-dark { background: var(--card-dark); }
.widget-title { font-size: 1.1rem; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 16px; color: var(--header-text); }
.stat-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-weight: 500; border-bottom: 1px solid var(--border-color); font-size: 0.95rem;}
.stat-list li:last-child { border-bottom: none; }
.stat-list li span:first-child { color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.stat-list li span:first-child::before { content: "✓"; color: var(--accent-green); font-weight: bold; }
.stat-list li span:last-child { color: var(--header-text); font-weight: 600; }
.random-links li { margin-bottom: 12px; font-weight: 500; font-size: 0.95rem; line-height: 1.4; }

/* Index Post List */
.page-title { font-size: 1.8rem; margin-bottom: 20px; color: var(--header-text); font-weight: 600; }
.post-list { display: grid; grid-template-columns: 1fr; gap: 16px; }

.post-item { 
    background: var(--card-bg); border: 1px solid #eaeaea; 
    border-radius: var(--radius); padding: 20px; 
    display: flex; flex-direction: column; transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.02);
}
.post-item:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.post-item-top { display: flex; gap: 16px; margin-bottom: 12px; }
.post-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; background: #f1f3f5; flex-shrink: 0; border: 1px solid #dee2e6; }
.post-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 6px; line-height: 1.3; }
.post-title a { color: var(--header-text); }
.post-title a:hover { color: var(--primary); }
.post-desc { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { background-color: #e6f0fa; color: #0056b3; font-size: 0.75rem; font-weight: 500; padding: 4px 10px; border-radius: 12px; border: none; }

.post-meta { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; align-items: center; border-top: 1px solid var(--border-color); padding-top: 12px; }
.meta-item { display: flex; align-items: center; gap: 5px; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 40px; }
.page-link { padding: 8px 14px; border: 1px solid var(--border-color); background: #ffffff; color: var(--text-main); border-radius: 6px; font-weight: 500; transition: all 0.2s; }
.page-link:hover { border-color: var(--primary); background: #f8f9fa; color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Single Post View */
.breadcrumb { font-size: 0.9rem; margin-bottom: 20px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.post-main-title { font-size: 2rem; margin-bottom: 16px; word-break: break-word; color: var(--header-text); }

/* Message Blocks */
.message-block { 
    background: var(--card-bg); border: 1px solid var(--border-color); 
    border-radius: var(--radius); margin-bottom: 16px; display: flex; flex-direction: column; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
@media(min-width: 640px) { .message-block { flex-direction: row; } }

.user-panel { 
    background: #fafbfc; padding: 20px 16px; border-bottom: 1px solid var(--border-color); 
    display: flex; flex-direction: row; align-items: center; gap: 15px; 
}
@media(min-width: 640px) { 
    .user-panel { 
        width: 160px; border-bottom: none; border-right: 1px solid var(--border-color); 
        flex-direction: column; text-align: center; flex-shrink: 0; 
    } 
}
.user-panel img { width: 70px; height: 70px; border-radius: 50%; object-fit: cover; margin-bottom: 8px; border: 2px solid #e0e0e0; }
.user-name-side { font-weight: 600; font-size: 1rem; color: var(--header-text); margin-bottom: 4px; word-wrap: break-word;}
.user-stats { font-size: 0.75rem; color: var(--text-muted); line-height: 1.5; }

.message-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; justify-content: flex-start; }
.message-header { display: flex; justify-content: space-between; margin-bottom: 16px; align-items: center; flex-wrap: wrap; gap: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;}
.message-date { font-size: 0.85rem; color: var(--text-muted); display:flex; align-items:center; gap: 6px;}
.message-header a { color: var(--text-muted); }
.message-header a:hover { color: var(--primary); }
.message-text { font-size: 1rem; line-height: 1.6; color: var(--text-main); word-wrap: break-word; }

.badge { background: var(--primary); color: #fff; font-size: 0.7rem; padding: 3px 8px; border-radius: 6px; font-weight: 600; margin-top: 4px; display: inline-block;}
.reply-badge { font-size: 0.75rem; background: #fff3cd; border: 1px solid #ffeeba; color: #856404; padding: 4px 10px; border-radius: 12px; margin-bottom: 12px; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }

.message-block.op-post { border-top: 4px solid var(--primary); }

.comments-header { font-size: 1.25rem; font-weight: 600; margin: 40px 0 20px 0; color: var(--header-text); border-bottom: 2px solid var(--border-color); padding-bottom: 10px; }
.comment { margin-bottom: 16px; scroll-margin-top: 80px; }

.cta-box { background: #f8f9fa; border: 1px dashed var(--primary); border-radius: var(--radius); padding: 30px 20px; text-align: center; margin-top: 40px; }
.cta-title { font-size: 1.25rem; margin-bottom: 10px; color: var(--header-text); }
.cta-text { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 20px; }

/* Footer */
.site-footer { background: #ffffff; border-top: 1px solid var(--border-color); color: var(--text-muted); padding: 40px 20px; margin-top: auto; font-size: 0.9rem;}
.footer-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 30px; }
@media(min-width: 768px) { .footer-container { grid-template-columns: repeat(3, 1fr); } }
.footer-title { color: var(--header-text); font-size: 1.1rem; margin-bottom: 16px; font-weight: 600; }
.footer-text { line-height: 1.6; }
