:root {
    --primary: #8b5cf6;
    --primary-hover: #a78bfa;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --card-dark: #0b1120;
    --text-main: #f8fafc;
    --text-light-bg: #ffffff;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --header-bg: rgba(15, 23, 42, 0.75);
    --header-text: #f8fafc;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 10px 40px rgba(0, 0, 0, 0.5);
    --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: "Inter", system-ui, -apple-system, sans-serif; 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    line-height: 1.6; 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4, .logo {
    font-weight: 700;
    letter-spacing: -0.02em;
}

a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
a:hover { color: var(--primary-hover); }
ul { list-style: none; }

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

/* Header - Glassmorphism */
.site-header { 
    background: var(--header-bg); 
    color: var(--header-text); 
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}
.header-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.logo { font-size: 1.8rem; color: var(--header-text); display: flex; align-items: center; gap: 10px; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Big Header Text */
.hero-title-area {
    max-width: 1200px; margin: 80px auto 40px auto; padding: 0 20px;
}
.hero-title-area h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    max-width: 800px;
    line-height: 1.2;
    background: linear-gradient(to right, #ffffff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 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: 12px 40px 12px 20px; border-radius: 30px; border: 1px solid var(--border-color); background: rgba(255, 255, 255, 0.05); outline: none; font-size: 0.95rem; color: var(--text-main); transition: all 0.3s; }
.search-input:focus { background: rgba(255, 255, 255, 0.1); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2); }
.search-btn { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; transition: color 0.3s; }
.search-btn:hover { color: var(--primary); }
.search-results { position: absolute; top: calc(100% + 10px); left: 0; right: 0; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-hover); max-height: 350px; overflow-y: auto; display: none; z-index: 100; backdrop-filter: blur(10px); }
.search-results.active { display: block; }
.search-item { display: block; padding: 15px 20px; border-bottom: 1px solid var(--border-color); transition: background 0.2s; }
.search-item:hover { background: rgba(255, 255, 255, 0.03); }
.search-item-title { font-weight: 600; font-size: 1rem; margin-bottom: 4px; color: var(--text-main); }
.search-item-desc { font-size: 0.85rem; color: var(--text-muted); }

/* Nav Buttons */
.header-nav { display: flex; align-items: center; gap: 20px; }
.nav-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-weight: 500; display: flex; align-items: center; gap: 8px; font-size: 1rem; transition: color 0.2s; }
.nav-btn:hover { color: var(--text-main); }
.btn-primary { background: var(--accent-gradient); color: #fff; padding: 10px 24px; border-radius: 30px; font-weight: 600; border: none; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.3s; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5); color: #fff; }

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

/* Sidebar Cards */
.card, .card-dark { background-color: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 30px; margin-bottom: 20px; box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease; }
.card:hover, .card-dark:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.card-dark { background-color: var(--card-dark); position: relative; overflow: hidden; }
.card-dark::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--accent-gradient); }
.card-dark .widget-title { color: #fff; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.card-dark .stat-list li span:first-child { color: var(--text-muted); }
.card-dark .stat-list li span:last-child { color: var(--primary-hover); font-size: 1.5rem; font-weight: 700; }

.widget-title { font-size: 1.2rem; font-weight: 600; color: var(--text-main); border-bottom: 1px solid var(--border-color); padding-bottom: 15px; margin-bottom: 20px; }
.stat-list li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; font-weight: 500; border-bottom: 1px solid rgba(255, 255, 255, 0.05); font-size: 0.95rem; }
.stat-list li:last-child { border-bottom: none; }
.random-links li { margin-bottom: 12px; font-weight: 500; line-height: 1.5; border-bottom: 1px solid rgba(255, 255, 255, 0.05); padding-bottom: 12px; font-size: 0.95rem;}
.random-links li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* Index Post List */
.page-title { font-size: 2rem; margin-bottom: 30px; font-weight: 700; color: #fff; }
.post-list { display: grid; grid-template-columns: 1fr; gap: 20px; }

.post-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 25px; transition: all 0.3s; position: relative; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.post-item:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: rgba(139, 92, 246, 0.3); background: rgba(30, 41, 59, 0.8); }

.post-item-top { display: flex; gap: 20px; margin-bottom: 15px; align-items: flex-start; }
.post-avatar { width: 50px; height: 50px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px rgba(139, 92, 246, 0.3); }
.post-title { font-size: 1.4rem; margin-bottom: 8px; line-height: 1.3; font-weight: 600; color: var(--text-main); }
.post-desc { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 400; }
.post-divider { height: 1px; background-color: var(--border-color); width: 100%; margin: auto 0 20px 0; border: none; }

.tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.tag { background-color: rgba(139, 92, 246, 0.1); color: var(--primary-hover); font-size: 0.75rem; font-weight: 600; padding: 6px 14px; border-radius: 20px; transition: all 0.2s; }
.tag:hover { background-color: rgba(139, 92, 246, 0.2); }

.post-meta { display: flex; flex-wrap: wrap; gap: 20px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; align-items: center; }
.meta-item { display: flex; align-items: center; gap: 6px; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 60px; }
.page-link { padding: 10px 16px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-muted); border-radius: 8px; font-weight: 500; transition: all 0.2s; }
.page-link:hover { background: rgba(255,255,255,0.05); color: var(--text-main); transform: translateY(-2px); }
.page-link.active { background: var(--accent-gradient); color: #fff; border-color: transparent; box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3); }

/* Single Post View */
.breadcrumb { font-weight: 500; font-size: 0.9rem; margin-bottom: 25px; color: var(--text-muted); display: flex; gap: 8px; align-items: center; }
.post-main-title { font-size: 2.5rem; margin-bottom: 30px; word-break: break-word; color: #fff; line-height: 1.2; }

/* Post Message Block */
.message-block { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 25px; display: flex; flex-direction: column; box-shadow: var(--shadow); overflow: hidden; }
@media(min-width: 640px) { .message-block { flex-direction: row; } }

.user-panel { background: rgba(0, 0, 0, 0.15); padding: 25px 20px; display: flex; flex-direction: row; align-items: center; gap: 20px; }
@media(min-width: 640px) { .user-panel { width: 220px; flex-direction: column; text-align: center; flex-shrink: 0; border-right: 1px solid var(--border-color); } }
.user-panel img { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 15px rgba(0,0,0,0.5); border: 3px solid rgba(255,255,255,0.05); }
.user-stats { font-size: 0.8rem; color: var(--text-muted); line-height: 1.8; font-weight: 500; margin-top: 10px; }

.message-content { padding: 30px; flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; }
.message-header { display: flex; justify-content: space-between; margin-bottom: 20px; align-items: flex-start; flex-wrap: wrap; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 15px; }
.user-name { font-weight: 600; font-size: 1.15rem; color: var(--primary-hover); display: flex; align-items: center; }
.badge { background: rgba(59, 130, 246, 0.15); color: #60a5fa; font-size: 0.7rem; padding: 4px 10px; border: 1px solid rgba(59, 130, 246, 0.3); border-radius: 20px; margin-left: 12px; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }
.message-date { font-size: 0.85rem; font-weight: 400; color: var(--text-muted); }
.message-text { font-size: 1rem; font-weight: 400; line-height: 1.8; color: #cbd5e1; }

/* OP gets a special glowing border */
.message-block.op-post { position: relative; border-color: rgba(139, 92, 246, 0.4); box-shadow: 0 0 20px rgba(139, 92, 246, 0.1); background: linear-gradient(180deg, var(--card-bg) 0%, rgba(30, 41, 59, 0.95) 100%); }
.message-block.op-post::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--accent-gradient); }

/* Comments */
.comments-header { font-size: 1.5rem; margin: 60px 0 30px 0; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; font-weight: 600; color: #fff; }
.comment { margin-bottom: 20px; scroll-margin-top: 100px; }
.comment.is-reply { margin-left: 20px; position: relative; }
.comment.is-reply::before { content: ''; position: absolute; left: -20px; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.05); }
@media(min-width: 640px) { 
    .comment.is-reply { margin-left: 60px; } 
    .comment.is-reply::before { left: -30px; }
}
.reply-badge { font-size: 0.75rem; background: rgba(255,255,255,0.1); color: var(--text-main); padding: 4px 10px; border-radius: 20px; margin-left: 10px; font-weight: 500; }

/* Call to action */
.cta-box { background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.05) 100%); border: 1px solid rgba(139, 92, 246, 0.2); border-radius: var(--radius); padding: 50px 30px; text-align: center; margin-top: 60px; box-shadow: inset 0 0 40px rgba(0,0,0,0.2); }
.cta-title { font-size: 1.6rem; margin-bottom: 15px; font-weight: 700; color: #fff; }
.cta-text { font-size: 1.05rem; font-weight: 400; color: var(--text-muted); margin-bottom: 30px; max-width: 600px; margin-left: auto; margin-right: auto; }

/* Footer */
.site-footer { background: var(--card-dark); color: var(--text-muted); padding: 80px 20px 40px 20px; margin-top: auto; border-top: 1px solid var(--border-color); }
.footer-container { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 50px; }
@media(min-width: 768px) { .footer-container { grid-template-columns: repeat(3, 1fr); } }
.footer-title { color: #f8fafc; font-size: 1.2rem; margin-bottom: 25px; display: flex; align-items: center; gap: 12px; font-weight: 600; }
.footer-text { line-height: 1.8; font-weight: 400; font-size: 0.95rem; }
.footer-text a { color: var(--primary-hover); text-decoration: none; }
.footer-text a:hover { text-decoration: underline; color: #fff; }