/* styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: #f0f4f8;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 1rem;
}

.book-app {
    max-width: 1100px;
    width: 100%;
    background: white;
    border-radius: 32px;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* 头部区域 - 仅放LOGO，确保完整显示 */
.app-header {
    background: white;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
}

.logo-area {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* 左对齐 */
    width: 100%;
}

.logo-placeholder {
    flex-shrink: 0;
    width: auto; /* 改为自动宽度，由图片决定 */
    height: auto; /* 改为自动高度 */
    max-width: 180px; /* 设置最大宽度，防止过大 */
    max-height: 80px; /* 设置最大高度 */
    background: transparent; /* 移除背景色，让LOGO自然显示 */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible; /* 确保内容不被裁剪 */
}

.logo-img {
    width: auto; /* 宽度自动 */
    height: auto; /* 高度自动 */
    max-width: 100%; /* 不超过容器宽度 */
    max-height: 80px; /* 限制最大高度 */
    object-fit: contain; /* 保持比例，完整显示 */
    display: block;
}

/* 标题容器 - 居中显示 */
.title-container {
    text-align: center;
    padding: 0.2rem 1.5rem 1rem 1.5rem;
}

.main-title {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: #1e2b3c;
}

.sub-title {
    font-size: 1rem;
    font-weight: 400;
    color: #5f7a99;
    display: block;
    margin-top: 0.15rem;
}

/* 查询区域 */
.search-section {
    padding: 0.5rem 1.5rem 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: white;
}

.search-wrapper {
    display: flex;
    width: 100%;
    gap: 0.75rem;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 1rem 1.2rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 60px;
    font-size: 1rem;
    background: #ffffff;
    transition: 0.2s;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.search-input:focus {
    outline: none;
    border-color: #f39c12;
    box-shadow: 0 4px 14px rgba(243, 156, 18, 0.15);
}

/* 按钮样式 */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 60px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    min-height: 56px;
    touch-action: manipulation;
    border: 1.5px solid transparent;
}

.btn-orange {
    background: #f39c12;
    border-color: #e67e22;
    color: white;
    box-shadow: 0 6px 14px rgba(243, 156, 18, 0.25);
}

.btn-orange:active {
    background: #d35400;
    transform: scale(0.96);
}

/* 分类筛选器 - 移动端友好设计 */
.filter-section {
    background: #f8fafd;
    border-radius: 24px;
    padding: 0.8rem 1rem;
    border: 1px solid #e2e8f0;
    margin-top: 0.5rem;
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    cursor: pointer;
    user-select: none;
}

.filter-title {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.filter-toggle {
    font-size: 1.2rem;
    color: #7a8b9f;
    transition: transform 0.2s;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.filter-toggle.open {
    transform: rotate(180deg);
}

.filter-options {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
    padding: 1rem 0 0.8rem 0;
    max-height: 250px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-options.show {
    display: grid;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem;
    background: white;
    border-radius: 40px;
    border: 1px solid #d9e2ec;
    font-size: 0.9rem;
    color: #1e2b3c;
    cursor: pointer;
    transition: all 0.1s;
    touch-action: manipulation;
    min-height: 44px;
}

.filter-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #f39c12;
    margin-left: 0.3rem;
    pointer-events: none;
}

.filter-checkbox span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-checkbox.selected {
    background: #b0aeaa;
    border-color: #c4bfbb;
    color: rgb(0, 0, 0);
}

.filter-actions {
    display: flex;
    gap: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed #d0ddeb;
}

.filter-btn {
    flex: 1;
    padding: 0.8rem 0;
    border: none;
    border-radius: 40px;
    font-weight: 500;
    font-size: 0.95rem;
    background: white;
    border: 1.5px solid #d0ddeb;
    color: #2c3e50;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 48px;
}

.filter-btn.filter-apply {
    background: #f39c12;
    border-color: #e67e22;
    color: white;
    font-weight: 600;
}

.filter-btn:active {
    transform: scale(0.97);
}

/* 状态栏 */
.status-bar {
    padding: 0.8rem 1.5rem;
    background: #f9fcff;
    border-bottom: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    font-size: 0.95rem;
    color: #4b5e71;
}

.hint-text {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* 书单列表容器 */
.book-list-container {
    padding: 1.5rem 1.5rem 2.5rem 1.5rem;
    background: #ffffff;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.book-list-container::-webkit-scrollbar {
    width: 5px;
}

.book-list-container::-webkit-scrollbar-track {
    background: #eef2f6;
}

.book-list-container::-webkit-scrollbar-thumb {
    background: #b3c2d1;
    border-radius: 20px;
}

/* 书籍条目 */
.book-item {
    display: flex;
    align-items: baseline;
    padding: 0.8rem 0.8rem;
    margin-bottom: 0.6rem;
    background: #fafcff;
    border-radius: 18px;
    border: 1px solid #edf2f7;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.01);
    touch-action: pan-y;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.book-item:active {
    background: #f1f7fd;
    transform: translateX(3px);
}

.book-index {
    font-weight: 700;
    color: #2c3e50;
    min-width: 2.6rem;
    font-size: 1rem;
    flex-shrink: 0;
}

.book-category {
    padding: 0.15rem 0.7rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e2b3c;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    line-height: 1.5;
}

.book-title {
    font-size: 1rem;
    color: #1f2a38;
    font-weight: 450;
    flex: 1 1 200px;
    word-break: break-word;
    line-height: 1.4;
    padding-top: 1px;
}

/* 空状态 */
.empty-message {
    text-align: center;
    padding: 3rem 1rem;
    color: #7a8b9f;
    font-size: 1.1rem;
    background: #fafdff;
    border-radius: 32px;
    border: 2px dashed #d9e2ec;
}

/* 底部 */
.app-footer {
    padding: 1rem 1.5rem 1.5rem 1.5rem;
    border-top: 1px solid #eaeef5;
    font-size: 0.85rem;
    color: #8b9eb0;
    text-align: center;
    background: white;
}

/* 移动端适配 */
@media (max-width: 600px) {
    body {
        padding: 0.5rem;
    }
    .book-app {
        border-radius: 24px;
    }
    .app-header {
        padding: 1.2rem 1rem 0.2rem 1rem;
    }
    .logo-placeholder {
        max-width: 150px; /* 移动端限制最大宽度 */
        max-height: 60px;
    }
    .logo-img {
        max-height: 60px;
    }
    .title-container {
        padding: 0 1rem 0.8rem 1rem;
    }
    .main-title {
        font-size: 1.5rem;
    }
    .sub-title {
        font-size: 0.85rem;
    }
    .search-section {
        padding: 0 1rem 1rem 1rem;
    }
    .search-wrapper {
        flex-direction: row;
    }
    .search-input {
        padding: 0.9rem 1rem;
        min-height: 52px;
    }
    .btn {
        padding: 0.9rem 1.2rem;
        min-height: 52px;
        font-size: 0.95rem;
    }
    .filter-section {
        padding: 0.6rem 0.8rem;
    }
    .filter-options {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }
    .filter-checkbox {
        font-size: 0.8rem;
        padding: 0.4rem 0.3rem;
    }
    .status-bar {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    .book-list-container {
        padding: 1rem 1rem 2rem 1rem;
        max-height: 45vh;
    }
    .book-item {
        padding: 0.7rem 0.8rem;
        gap: 0.4rem;
    }
    .book-index {
        font-size: 0.95rem;
        min-width: 2.3rem;
    }
    .book-category {
        font-size: 0.75rem;
        padding: 0.1rem 0.6rem;
        max-width: 100px;
    }
    .book-title {
        font-size: 0.92rem;
        flex-basis: 140px;
    }
}

@media (max-width: 380px) {
    .logo-placeholder {
        max-width: 120px;
        max-height: 50px;
    }
    .logo-img {
        max-height: 50px;
    }
    .filter-options {
        grid-template-columns: 1fr;
    }
    .book-index {
        min-width: 2.1rem;
        font-size: 0.9rem;
    }
    .book-category {
        max-width: 90px;
        font-size: 0.7rem;
        padding: 0.1rem 0.5rem;
    }
    .book-title {
        font-size: 0.88rem;
        flex-basis: 120px;
    }
}