/* 全局样式 */
body {
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    font-family: Arial, sans-serif;
}
.container {
    width: 43%;
    background-color: white;
    box-shadow: 3px 4px 8px rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    padding: 20px;
    transition: transform 0.3s ease;
    font-family: "经典隶变简", sans-serif;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 管理按钮 */
.admin-controls {
    margin-left: 92%;
    top: 20px;
    right: 20px;
    background-color: #007BFF;
    color: white;
    padding: 10px 15px;
    border: none;
    cursor: pointer;
    border-radius: 5px;
    z-index: 1001;
}

.admin-controls:hover {
    background-color: #0056b3;
}

/* 灰色遮罩 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* 管理面板 */
.admin-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1002;
    width: 40%;
    /*max-width: 600px;*/
    border-radius: 10px;
    max-height: 90%;  /* 限制面板最大高度 */
    overflow: hidden; /* 防止溢出 */
}

/* 可滚动的数据部分 */
.scrollable-table {
    max-height: 60vh;  /* 限制表格区域的最大高度 */
    overflow-y: auto;  /* 使表格部分可垂直滚动 */
    margin-bottom: 10px; /* 给按钮部分留出间隔 */
}

.admin-panel h2 {
    margin-top: 0;
}

/* 新增书籍表单 */
.add-book-form {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    z-index: 1003;
    width: 80%;
    max-width: 600px;
    border-radius: 10px;
}

.add-book-form form {
    display: flex;
    flex-direction: column;
}

.add-book-form input, .add-book-form select {
    margin-bottom: 10px;
    padding: 10px;
}

/* 书籍展示部分 */

/* 正在读书籍 */
.currently-reading {
    width: 90%;
    text-align: center;
    margin-bottom: 40px;
    box-shadow: 2px 3px 2px rgba(0, 0, 0, 0.3);
}

.book-item-currently {
    display: inline-block;
    text-align: center;
}

.book-image-currently {
    height: 240px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.book-image-currently:hover {
    transform: scale(1.03);
}

/* 已读书籍 */
.bookshelf {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.book-item {
    width: 25%;
    margin-bottom: 10px;
    text-align: center;
}

.book-image {
    height: 220px;
    object-fit: cover;
    transition: transform 0.3s ease;
    padding: 5px;
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.2);
}

.book-image:hover {
    transform: scale(1.03);
}

.book-title {
    margin-top: 10px;
    font-weight: bold;
    font-size: 16px;
}

/* 管理面板的确定和关闭按钮 */
.admin-panel .panel-buttons {
    display: flex;
    justify-content: space-between;
    position: sticky;
    bottom: 0;
    background-color: white;
    padding-top: 10px;
    padding-bottom: 10px;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1); /* 为按钮部分添加阴影 */
}
.closeAdminPanelBtn {
    opacity: 0; /* 把关闭按钮透明 */
}

.admin-panel .panel-buttons button {
    background-color: #007BFF;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    margin-left: 10px;
}

.admin-panel .panel-buttons button:hover {
    background-color: #0056b3;
}

/* 新增书籍表单的关闭按钮 */
.add-book-form .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.add-book-form .close-btn:hover {
    background-color: #c82333;
}

/* 新增书籍表单的灰色遮罩 */
.add-book-form-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
}

/* Flash信息提醒 */
/* 增加淡出效果 */
.flashes {
    position: fixed;
    top: 20px;
    left: 45%;
    margin: 0 auto;
    z-index: 1000;
}

.flashes li {
    list-style: none;
    padding: 10px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    margin-bottom: 5px;
    border-radius: 5px;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

/* 响应式样式 */
@media (max-width: 768px) {
    .container {
        width: 90%;
        padding: 10px;
    }

    .admin-controls {
        margin-left: auto;
        margin-right: auto;
        top: 10px;
        right: 10px;
        position: relative;
        display: block;
    }

    .admin-panel {
        width: 90%;
        max-width: none;
        padding: 10px;
        height: auto;
    }

    .add-book-form {
        width: 90%;
        max-width: none;
        padding: 10px;
    }

    .scrollable-table {
        max-height: 50vh;
    }

    .currently-reading, .bookshelf {
        width: 100%;
    }

    .book-item {
        width: 30%;
        margin-bottom: 10px;
    }

    .book-image {
        height: auto;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .admin-controls {
        font-size: 14px;
        padding: 8px 12px;
    }

    .add-book-form .close-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
}
