* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: #f4f7f6;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

main {
    padding: 2rem 0;
    flex: 1;
}

/* Thanh Header */
header {
    background-color: #ffffff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #2c3e50;
    font-size: 1.8rem;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-menu a {
    text-decoration: none;
    color: #555;
    font-weight: 600;
    transition: color 0.3s;
}
.nav-menu a:hover { color: #3498db; }

.btn-primary-sm {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}
.btn-primary-sm:hover { background-color: #2980b9; }

/* Hero section */
.hero {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(135deg, #3498db, #2c3e50);
    color: white;
    border-radius: 8px;
    margin-bottom: 2rem;
}
.hero h2 { font-size: 2.5rem; margin-bottom: 1rem; }

/* Tìm kiếm & Bộ lọc chuyên mục */
.filter-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.search-box input {
    width: 100%; padding: 0.8rem 1rem; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem;
}
.category-tags { display: flex; gap: 10px; flex-wrap: wrap; }
.category-tag {
    background: #f1f2f6; border: none; padding: 6px 16px; border-radius: 20px;
    cursor: pointer; font-weight: 600; color: #57606f; transition: all 0.2s;
}
.category-tag.active, .category-tag:hover { background: #3498db; color: white; }

.cat-badge {
    background-color: #e1f5fe; color: #0288d1; font-size: 0.75rem;
    font-weight: bold; padding: 3px 10px; border-radius: 12px; text-transform: uppercase;
}

/* Biểu mẫu biểu đồ */
.upload-section {
    background: white; padding: 2rem; border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); margin-bottom: 3rem;
}
.upload-section h3 {
    margin-bottom: 1.5rem; color: #2c3e50; border-bottom: 2px solid #3498db;
    display: inline-block; padding-bottom: 0.5rem;
}
.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 600; }
.form-group input, .form-group textarea, .form-group select {
    width: 100%; padding: 0.8rem; border: 1px solid #ddd; border-radius: 4px; font-family: inherit; font-size: 1rem;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #3498db; }

button {
    color: white; border: none; padding: 0.8rem 2rem; font-size: 1rem; font-weight: bold; border-radius: 4px; cursor: pointer; transition: background-color 0.3s;
}
button:disabled { background-color: #95a5a6; cursor: not-allowed; }

/* MODAL OVERLAY POPUP CHUNG */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000; display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-content { background-color: #fff; padding: 2.5rem 2rem; border-radius: 8px; width: 100%; max-width: 450px; position: relative; box-shadow: 0 5px 20px rgba(0,0,0,0.2); }
.modal-close-token { position: absolute; top: 10px; right: 15px; font-size: 1.8rem; font-weight: bold; color: #95a5a6; cursor: pointer; }
.modal-close-token:hover { color: #333; }

/* TỐI ƯU MODAL XEM CHI TIẾT BÀI VIẾT ĐẸP */
.view-detail-content {
    max-width: 800px; width: 90%; max-height: 90vh; overflow-y: auto; padding: 2.5rem; border-radius: 12px;
}

.auth-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 1px solid #ddd; padding-bottom: 10px; }
.tab-btn { background-color: #ecf0f1; color: #34495e; padding: 8px 20px; border: none; cursor: pointer; font-weight: bold; border-radius: 4px; }
.tab-btn.active { background-color: #3498db; color: white; }

/* Lưới hiển thị tin tức ở trang chủ */
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }

/* Cấu trúc thẻ bài viết có thể click xem chi tiết */
.clickable-card { cursor: pointer; display: flex; flex-direction: column; overflow: hidden; background: white; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); transition: transform 0.3s, box-shadow 0.3s; }
.clickable-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }

.post-thumb-wrapper { width: 100%; height: 180px; overflow: hidden; background-color: #eee; }
.post-card-thumb { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.clickable-card:hover .post-card-thumb { transform: scale(1.05); }

.post-title { font-size: 1.25rem; color: #2c3e50; margin-bottom: 0.8rem; }
.post-snippet { color: #666; margin-bottom: 1rem; word-wrap: break-word; font-size: 0.95rem; }
.post-meta { font-size: 0.85rem; color: #999; border-top: 1px solid #eee; padding-top: 0.8rem; }

/* Giao diện dành riêng quản lý admin */
.admin-manage-card { border: 1px solid #ddd; padding: 20px; border-radius: 6px; margin-bottom: 20px; background: #fafafa; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.admin-manage-card .meta { font-size: 0.85rem; color: #7f8c8d; margin-top: 5px; }
.action-sm-btn { padding: 6px 14px; font-size: 0.85rem; border-radius: 4px; font-weight: bold; }
.action-sm-btn:hover { filter: brightness(0.9); }

footer { background-color: #2c3e50; color: white; text-align: center; padding: 1.5rem 0; margin-top: auto; }

@media (max-width: 768px) {
    header .container { flex-direction: column; gap: 1rem; }
    .hero h2 { font-size: 2rem; }
    .view-detail-content { padding: 1.5rem; }
}