:root {
    --bg-outside: #0a0a0a; /* Màu ngoài tương phản */
    --bg-body: #141414;    /* Màu body chính */
    --border-main: 1px solid #222;
    --accent: #ff4757;
    --text-main: #efefef;
}

body {
    background-color: var(--bg-outside);
    color: var(--text-main);
    margin: 0;
    font-family: 'Inter', sans-serif;
}

.container {
    max-width: 950px;
    margin: 0 auto;
    background-color: var(--bg-body);
    border: var(--border-main);
    min-height: 100vh;
}

/* Header & Search */
header { padding: 15px; border-bottom: var(--border-main); }
.search-bar input {
    width: 100%; padding: 12px; border-radius: 20px; 
    border: none; background: #222; color: #fff;
}

/* Post Grid */
.post-grid {
    display: grid;
    padding: 15px;
    gap: 15px;
    grid-template-columns: repeat(2, 1fr); /* Mobile: 2 cột */
}

@media (min-width: 768px) {
    .post-grid { grid-template-columns: repeat(4, 1fr); /* PC: 4 cột */ }
}

/* Thumbnail & Quality Badge */
.post-card { position: relative; border-radius: 8px; overflow: hidden; background: #1a1a1a; }
.thumb-wrap { position: relative; aspect-ratio: 3/4; }
.quality {
    position: absolute; top: 5px; left: 5px;
    background: var(--accent); font-size: 10px;
    padding: 2px 5px; border-radius: 2px; font-weight: bold;
}

/* Menu Mobile ... */
.mobile-nav { display: none; font-size: 24px; cursor: pointer; }
@media (max-width: 600px) { .mobile-nav { display: block; } }
/* Mobile Menu Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 999;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.mobile-overlay.active { display: flex; }
.mobile-overlay a {
    color: white; font-size: 24px; margin: 15px; text-decoration: none;
}
#search-results {
    position: absolute;
    width: 100%;
    max-width: 950px;
    background: #1a1a1a;
    border: 1px solid #333;
    z-index: 1000;
    display: none;
}
.search-item {
    display: flex;
    padding: 10px;
    border-bottom: 1px solid #222;
    align-items: center;
    color: #eee;
    text-decoration: none;
}
.search-item:hover { background: #222; }
.search-item img { width: 50px; height: 35px; object-fit: cover; margin-right: 10px; }
/* Sidebar Menu Mobile */
.side-menu {
    height: 100%; width: 0; position: fixed; z-index: 2000;
    top: 0; right: 0; background-color: #111; overflow-x: hidden;
    transition: 0.4s; padding-top: 60px; border-left: 1px solid #333;
}
.side-menu.active { width: 280px; }
.side-menu a {
    padding: 15px 30px; text-decoration: none; font-size: 18px;
    color: #bbb; display: block; border-bottom: 1px solid #222;
}
.side-menu .close-btn { position: absolute; top: 10px; right: 20px; font-size: 30px; cursor: pointer; }

/* AJAX Search Results */
#search-results-box {
    position: absolute; width: 100%; background: #1a1a1a; 
    border: 1px solid #333; z-index: 1500; display: none; margin-top: 5px;
}
.search-result-item { display: flex; padding: 10px; color: #fff; text-decoration: none; border-bottom: 1px solid #222; }
.search-result-item:hover { background: #333; }
.search-result-item img { width: 50px; height: 70px; object-fit: cover; border-radius: 3px; margin-right: 12px; }
.search-result-item .t { display: block; font-weight: bold; font-size: 14px; }
.search-result-item .q { font-size: 11px; background: #00adb5; padding: 1px 4px; border-radius: 2px; }

/* Phân trang đẹp */
.pagination { display: flex; justify-content: center; padding: 30px 10px; gap: 8px; }
.pagination a, .pagination span { 
    background: #1e1e1e; color: #fff; padding: 10px 16px; 
    text-decoration: none; border: 1px solid #333; border-radius: 4px;
}
.pagination a.active { background: #00adb5; border-color: #00adb5; }
/* Sub-menu logic */
.nav-list { list-style: none; display: flex; gap: 20px; }
.nav-list li { position: relative; }
.nav-list a { color: #fff; text-decoration: none; font-weight: bold; font-size: 14px; }
.nav-list a:hover { color: var(--accent); }

.sub-menu {
    position: absolute; top: 100%; left: 0; background: #111;
    min-width: 180px; display: none; padding: 10px 0;
    border: 1px solid #333; z-index: 100;
}
.sub-menu li { width: 100%; }
.sub-menu a { padding: 10px 20px; display: block; font-weight: normal; }
.sub-menu a:hover { background: #222; }

.has-children:hover .sub-menu { display: block; }

/* Responsive Grid Mobile */
@media (max-width: 600px) {
    .main-menu { display: none; } /* Ẩn menu chính trên mobile, dùng nút ba chấm */
    .post-grid { grid-template-columns: repeat(2, 1fr) !important; }
}