:root {
    color-scheme: light;
    --bg-body: #ffffff;
    --bg-section: #f2f4f8;
    --bg-card: #ffffff;
    --bg-header: #2f4f7f;
    --bg-placeholder: #cccccc;
    --text: #1a1a1a;
    --text-header: #ffffff;
    --accent: #2f4f7f;
    --accent-text: #ffffff;
    --shadow: rgba(0, 0, 0, 0.15);
}

body {
    display: flex;
    flex-direction: column;
    margin: 0;
    height: 100vh;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 30px;
    padding-bottom: 0;
    background-color: var(--bg-header);
    color: var(--text-header);
}

/* khối bên phải, rộng bằng logo để tiêu đề nằm giữa */
.header-actions {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    align-self: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}

.login-link {
    padding: 8px 16px;
    border: 2px solid var(--text-header);
    border-radius: 20px;
    color: var(--text-header);
    font-weight: bold;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.2;
    transition: background-color 0.15s, color 0.15s;
}

.login-link[hidden] {
    display: none;
}

.login-link:hover {
    background-color: var(--text-header);
    color: var(--accent);
}

/* nút Đăng sách: nổi bật hơn các nút còn lại */
.upload-link {
    background-color: var(--text-header);
    color: var(--accent);
}

.upload-link:hover {
    background-color: rgba(255, 255, 255, 0.85);
}

/* thẻ tên người dùng */
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 220px;
    padding: 4px 14px 4px 4px;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.15);
    font-size: 0.95rem;
    font-weight: 600;
}

.user-avatar {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--text-header);
    color: var(--accent);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logo {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    font-weight: bold;
}

.desc {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.desc .name {
    font-size: 3rem;
    margin-bottom: 0;
}

.desc .short-description {
    font-size: 1.5rem;
    margin-bottom: 60px;
}

.logo .image .logo1 {
    max-width: 100%;
    height: auto;
    width: 90px;
}

.logo .image {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-content {
    flex: 1;
}

.featured {
    padding: 20px 30px;
    background-color: var(--bg-section);
}

.featured h2 {
    margin: 0 0 15px 0;
}

.featured-list {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.featured-card {
    flex: 0 0 180px;
    background-color: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow);
    padding: 10px;
    text-align: center;
}

.cover-placeholder {
    width: 100%;
    height: 220px;
    background-color: var(--bg-placeholder);
    border-radius: 6px;
    margin-bottom: 8px;
}

.search {
    padding: 20px 30px;
    background-color: var(--bg-section);
}

.search-results h2 {
    margin: 0 0 15px 0;
}

.search-result {
    flex: 0 0 180px;
    background-color: var(--bg-card);
    border-radius: 10px;
    box-shadow: 0 2px 8px var(--shadow);
    padding: 10px;
    text-align: center;
    color: var(--text);
    text-decoration: none;
}

.search-result .title {
    margin: 0;
    font-weight: bold;
    word-break: break-word;
}

/* ảnh bìa trong thẻ sách */
.search-result img,
.featured-card img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

/* nút "Xem sách" */
.view-button {
    display: inline-block;
    margin-top: 5px;
    padding: 8px 16px;
    border-radius: 20px;
    background-color: var(--accent);
    color: var(--accent-text);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.view-button:hover {
    opacity: 0.85;
}

.search-layout {
    display: flex;
    gap: 20px;
}

.category-tree {
    flex: 0 0 220px;
    background-color: var(--bg-card);
    border-radius: 10px;
    padding: 10px;
    align-self: flex-start;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow);
}

.category-tree-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 480px;
    padding: 10px;
}

.search-results {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.results-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-bar {
    align-self: flex-start;
    padding: 8px 12px;
    border: none;
    border-radius: 20px;
    width: 300px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px var(--shadow);
    background-color: var(--bg-card);
    color: var(--text);
}

.category-tree li,
.category-tree ul {
    list-style: none;
    margin-top: 15px;
}

summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

summary::-webkit-details-marker {
    display: none;
}

.category-button {
    background-color: rgba(0, 0, 0, 0);
    color: var(--text);
    border: none;
    white-space: nowrap;
}

.category-button.selected {
    background-color: var(--accent);
    color: var(--accent-text);
}

summary::before {
    content: "📁 ";
}

details[open] > summary::before {
    content: "📂 ";
}

.leaf::before {
    content: "📄 ";
}

.leaf {
    display: flex;
    align-items: center;
}

.request-badge {
    display: inline-block;
    min-width: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background-color: #d64545;
    color: #ffffff;
    font-size: 0.8rem;
    line-height: 20px;
    text-align: center;
}
.search {
    padding-top: 30px;
}