.cover-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    max-width: 90%;
    padding: 10px;
    margin-bottom: 10px;
}

.cover-author {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    max-width: 90%;
}

.cover-image {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    object-fit: cover;
    opacity: 0.3;
}/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --bookshelf-bg: #b38b65;
    --bookshelf-edge: #9c7854;
    --wall-color: #f5f5f5;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --primary-color: #3a5199;
    --text-color: #333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--wall-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
}

header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

header a {
    text-decoration: none;
    color: var(--primary-color);
}

/* 서재 스타일링 - 정방향 책 진열대 */
.bookshelf {
    position: relative;
    background-color: #ffffff;
    padding: 20px;
    margin-bottom: 40px;
    min-height: 100vh;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    border-radius: 5px;
}

.shelf {
    position: relative;
    height: 280px;
    background-color: var(--bookshelf-bg);
    border-top: 18px solid var(--bookshelf-edge);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 18px 24px;
    border-radius: 0 0 5px 5px;
    box-shadow: 0 2px 5px var(--shadow-color);
    margin-bottom: 36px;
    background-image: 
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.05) 0px,
            rgba(255, 255, 255, 0.05) 2px,
            transparent 2px,
            transparent 20px
        );
}

/* Add subtle top edge highlight */
.shelf::after {
    content: '';
    position: absolute;
    top: -18px;
    left: 0;
    width: 100%;
    height: 18px;
    background-color: var(--bookshelf-edge);
    background-image: 
        linear-gradient(
            to bottom,
            rgba(255, 255, 255, 0.15),
            transparent 50%,
            rgba(0, 0, 0, 0.05)
        ),
        linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.1) 0px,
            transparent 1px,
            rgba(0, 0, 0, 0.05) 2px,
            transparent 3px
        );
    background-size: 100% 100%, 4px 100%;
}

/* Shelf color variants */
.shelf-top {
    background-color: #b89770;
}

.shelf-top::after {
    background-color: #9c7854;
}

.shelf-middle {
    background-color: #b38b65;
}

.shelf-middle::after {
    background-color: #8f6845;
}

.shelf-bottom {
    background-color: #a87f5c;
}

.shelf-bottom::after {
    background-color: #835f3f;
}

/* Media queries for responsive shelves */
@media (max-width: 768px) {
    .shelf {
        padding: 12px 18px;
        height: 240px;
    }
}

@media (max-width: 480px) {
    .shelf {
        padding: 10px 12px;
        height: 216px;
    }
}

/* 책 스타일링 - 가로로 놓여있는 모양 (정방향) */
.book {
    position: relative;
    width: 162px;
    height: 240px;
    margin: 0 20px;
    transform-style: preserve-3d;
    transform: rotateX(0deg) rotateZ(0deg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    perspective: 1000px;
}

.book:hover {
    transform: translateY(-15px);
    box-shadow: 0 15px 15px var(--shadow-color);
}

.book-spine {
    position: absolute;
    width: 30px;
    height: 240px;
    background-color: #5a6f8f;
    transform: rotateY(90deg) translateZ(81px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 2;
    padding: 12px 0;
}

.book:nth-child(3n+1) .book-spine { background-color: #5a6f8f; }
.book:nth-child(3n+2) .book-spine { background-color: #8f5a5a; }
.book:nth-child(3n+3) .book-spine { background-color: #5a8f6f; }

.book-cover {
    position: absolute;
    width: 162px;
    height: 240px;
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateZ(0);
    z-index: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.book-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: white;
    padding: 0 6px;
    writing-mode: vertical-rl;
    transform: rotate(0deg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 180px;
}

.book-author {
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.8);
    writing-mode: vertical-rl;
    transform: rotate(0deg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 6px;
}

/* 모달 스타일링 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    width: 80%;
    max-width: 800px;
    border-radius: 8px;
    max-height: 80vh;
    overflow-y: auto;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close-button:hover {
    color: #333;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #ddd;
    color: #777;
}

/* 반응형 디자인 */
@media (max-width: 1100px) {
    .book {
        width: 144px;
        margin: 0 16px;
    }
    
    .book-spine {
        transform: rotateY(90deg) translateZ(72px);
        display: none;
    }
    
    .book-cover {
        width: 144px;
    }
}

@media (max-width: 992px) {
    .book {
        width: 110px;
        margin: 0 10px;
    }
    
    .book-spine {
        display: none;
    }
}

@media (max-width: 768px) {
    .bookshelf {
        height: auto;
    }
    
    .shelf {
        margin-bottom: 20px;
        height: auto;
        flex-wrap: wrap;
        justify-content: center;
        padding: 20px 10px;
    }
    
    .book {
        width: 142.5px;
        height: 217.5px;
        margin: 15px 8px;
    }
    
    .book-spine {
        width: 30px;
        height: 217.5px;
        transform: rotateY(90deg) translateZ(71.25px);
        display: none;
    }
    
    .book-cover {
        width: 142.5px;
        height: 217.5px;
    }
    
    .book-img-container {
        width: 90%;
        height: 75%;
        top: 5px;
    }
    
    .cover-title {
        bottom: 25px;
        font-size: 0.9rem;
        padding: 3px 0;
    }
    
    .cover-author {
        bottom: 5px;
        font-size: 0.8rem;
    }
    
    /* 모바일에서 책 2권만 표시 */
    .shelf .book:nth-child(n+3) {
        display: none;
    }
    
    /* 선반당 책 2권만 표시할 때 중앙 정렬 */
    .shelf {
        justify-content: space-around;
    }
    
    .shelf .book {
        margin: 15px 20px;
    }
}

@media (max-width: 480px) {
    .book {
        width: 127.5px;
        height: 187.5px;
        margin: 10px 5px;
    }
    
    .book-spine {
        width: 27px;
        height: 187.5px;
        transform: rotateY(90deg) translateZ(63.75px);
        display: none;
    }
    
    .book-cover {
        width: 127.5px;
        height: 187.5px;
    }
    
    .book-img-container {
        width: 90%;
        height: 70%;
    }
    
    .cover-title {
        bottom: 20px;
        font-size: 0.85rem;
    }
    
    .cover-author {
        font-size: 0.7rem;
    }
    
    /* 모바일 소형 디바이스에서 책 간격 조정 */
    .shelf .book {
        margin: 10px 30px;
    }
}

.nav-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: relative;
    padding: 10px 0;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li {
    margin-left: 20px;
}

.nav-menu a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

.nav-menu a i {
    margin-right: 5px;
}

.nav-menu a:hover {
    color: #222;
}

.hamburger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
    position: relative;
}

.hamburger-menu span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: var(--primary-color);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.admin-link {
    background-color: transparent;
    padding: 5px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.admin-link:hover {
    opacity: 0.8;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 250px;
    height: 100vh;
    background-color: #fff;
    z-index: 1000;
    padding: 60px 20px 20px;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li {
    margin-bottom: 15px;
}

.mobile-menu a {
    display: block;
    padding: 10px 0;
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    border-bottom: 1px solid #eee;
    transition: color 0.3s ease;
}

.mobile-menu a:hover {
    color: var(--primary-color);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Media Queries for Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .hamburger-menu {
        display: flex;
    }
    
    .nav-menu {
        justify-content: flex-end;
    }
    
    /* Hamburger Animation */
    .hamburger-menu.active span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }
    
    .hamburger-menu.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger-menu.active span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    /* Book detail modifications */
    .book-detail-modal {
        flex-direction: column;
        align-items: center;
    }
    
    .book-cover-modal {
        margin-right: 0;
        margin-bottom: 20px;
    }
    
    .book-info-modal {
        width: 100%;
    }
    
    /* Additional mobile-specific styles */
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .mobile-menu {
        width: 100%;
        right: -100%;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
}

.book-detail-modal {
    display: flex;
    gap: 30px;
}

.book-cover-modal {
    flex: 0 0 200px;
}

.book-cover-modal img {
    width: 100%;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.book-info-modal {
    flex: 1;
}

.book-info-modal h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.book-info-modal p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 20px;
}

.book-description-modal {
    line-height: 1.6;
    margin-bottom: 30px;
}

.read-more-btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.read-more-btn:hover {
    background-color: #2a3d75;
}

/* 책 표지 이미지 관련 스타일 수정 */
.book-cover img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    position: relative;
    z-index: 2;
}

.book-img-container {
    width: 95%;
    height: 80%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: absolute;
    top: 6px;
    left: 2.5%;
    z-index: 2;
}

.book-img {
    transition: transform 0.3s ease;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.book:hover .book-img {
    transform: scale(1.05);
}

.cover-title {
    position: absolute;
    bottom: 36px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 3;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 6px 0;
    font-size: 1.02rem;
}

.cover-author {
    position: absolute;
    bottom: 6px;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 3;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 4px 0;
}

@media (max-width: 768px) {
    .book-detail-modal {
        flex-direction: column;
    }
    
    .book-cover-modal {
        flex: 0 0 auto;
        margin-bottom: 20px;
    }
}

/* 검색 및 필터링 스타일 */
.search-filter-container {
    margin-bottom: 30px;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.search-input-container {
    display: flex;
    width: 100%;
}

.search-input-container input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.search-input-container input:focus {
    border-color: var(--primary-color);
}

.search-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 20px;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #2a3d75;
}

.category-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.category-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-btn {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 20px;
    background-color: #eee;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.category-btn:hover {
    background-color: #e0e0e0;
}

.category-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* 검색 결과 없음 메시지 */
.no-books-message {
    text-align: center;
    padding: 50px 0;
}

.no-books-message p {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

.return-all-books {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.return-all-books:hover {
    background-color: #2a3d75;
}

/* 책 상세 모달에 카테고리 정보 스타일 */
.book-category {
    margin: 10px 0 20px;
    padding: 8px 12px;
    background-color: #f5f5f5;
    border-radius: 4px;
    display: inline-block;
    font-size: 0.9rem;
}

.book-category span {
    font-weight: bold;
    color: var(--primary-color);
}

/* 반응형 디자인에 대한 추가 스타일 */
@media (max-width: 991px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        padding: 30px 25px;
    }
    
    .grid-book-cover {
        width: 120px;
    }
    
    .grid-cover-image img {
        max-height: 150px;
    }
    
    .grid-cover-title {
        font-size: 1rem;
    }
    
    .grid-cover-author {
        font-size: 0.85rem;
    }
    
    .view-mode-toggle {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 30px 22.5px;
        padding: 25px 20px;
    }
    
    .grid-book {
        height: 300px;
    }
    
    .grid-book-container {
        width: 80px; /* 책 가로 비율 고정 */
        min-width: 80px; /* 최소 너비 설정 */
    }
    
    .grid-book-spine {
        width: 80px; /* 책 등 너비 고정 */
    }
    
    .grid-book-cover {
        width: 150px;
        min-width: 150px; /* 책 커버 너비 고정 */
    }
    
    .spine-content {
        padding: 15px 7.5px;
    }
    
    .spine-title {
        font-size: 1.2rem;
        -webkit-line-clamp: 2;
        letter-spacing: 0.8px;
        max-height: 70%;
    }
    
    .spine-author {
        font-size: 0.7rem;
        padding-top: 6px;
    }
    
    .long-title {
        font-size: 0.95rem;
    }
    
    .grid-cover-image img {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px 10px;
    }
    
    .grid-book {
        height: auto;
        min-height: 180px;
    }
    
    .grid-book-container {
        width: 80px; /* 책 가로 비율 고정 */
        min-width: 80px; /* 최소 너비 설정 */
    }
    
    .grid-book-spine {
        width: 80px; /* 책 등 너비 고정 */
        min-width: 80px;
    }
    
    .grid-book-cover {
        width: 120px; /* 책 커버 너비 고정 */
        min-width: 120px;
        padding: 10px 8px;
    }
    
    .spine-content {
        padding: 10px 5px;
    }
    
    .spine-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        letter-spacing: 0.5px;
        max-height: 65%;
    }
    
    .spine-author {
        font-size: 0.5rem;
        padding-top: 4px;
    }
    
    .long-title {
        font-size: 0.8rem;
    }
    
    .grid-cover-title {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        min-height: 2.6em;
    }
    
    .grid-cover-image {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .grid-cover-image img {
        max-width: 100%;
        height: auto;
        max-height: 120px;
    }
}

@media (max-width: 366px) {
    .shelf {
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 10px;
        gap: 0;
        height: auto;
        min-height: 150px;
    }

    .shelf .book {
        flex: 0 0 auto;
        margin: 0 5px;
        transform: none;
        width: 80px;
        height: 120px;
    }

    .shelf .book-spine {
        display: none;
    }

    .shelf .book-cover {
        width: 100%;
        height: 100%;
    }

    .shelf .book-img-container {
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .shelf .book-img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .shelf .cover-title {
        font-size: 0.7rem;
        padding: 5px;
        margin-bottom: 5px;
    }
    
    .shelf .cover-author {
        font-size: 0.6rem;
    }
    
    /* 그리드 뷰의 책 가로 비율 고정 (366px 이하에서도) */
    .grid-book-container {
        width: 60px; /* 더 작은 화면에서 책 가로 비율 고정 */
        min-width: 60px; 
    }
    
    .grid-book-spine {
        width: 60px;
        min-width: 60px;
    }
    
    .grid-book-cover {
        width: 90px;
        min-width: 90px;
        padding: 8px 6px;
    }
}

/* 책 툴팁 스타일 */
[title] {
    position: relative;
    cursor: help;
}

/* 책 등 높이에 따라 개별 조정 */
.grid-book[data-id] .spine-title,
.grid-book[data-id] .spine-author {
    transition: text-shadow 0.3s ease;
}

.grid-book:hover .spine-title,
.grid-book:hover .spine-author {
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.5);
}

/* 긴 제목 처리를 위한 클래스 */
.long-title {
    font-size: 0.88rem;
    -webkit-line-clamp: 2;
    line-height: 1.2;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .long-title {
        font-size: 0.8rem;
        letter-spacing: 0.4px;
    }
}

@media (max-width: 480px) {
    .long-title {
        font-size: 0.9rem;
        letter-spacing: 0.3px;
    }
}

/* 뷰 모드 토글 버튼 스타일 */
.view-mode-toggle {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
}

.view-mode-btn {
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.view-mode-btn:first-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.view-mode-btn:last-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.view-mode-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.view-mode-btn:hover:not(.active) {
    background-color: #e0e0e0;
}

/* 책꽂이 뷰 관련 스타일 */
.bookshelf.grid-view .shelf {
    display: none;
}

.bookshelf.shelf-view .books-grid {
    display: none;
}

/* 그리드 뷰 (책꽂이) 스타일 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 30px 25px;
    padding: 40px 30px;
    background-color: var(--wall-color);
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.1);
    min-height: 500px;
    position: relative;
}

.books-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 15px;
    background-color: var(--bookshelf-edge);
    border-radius: 8px 8px 0 0;
}

.books-grid::after {
    content: '';
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: -10px;
    height: 10px;
    background-color: rgba(0, 0, 0, 0.1);
    filter: blur(5px);
    border-radius: 50%;
}

.grid-book {
    height: 250px;
    perspective: 1000px;
    cursor: pointer;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.grid-book::before {
    content: '';
    position: absolute;
    bottom: -5px;
    width: 35px;
    height: 5px;
    background-color: rgba(0, 0, 0, 0.2);
    filter: blur(2px);
    border-radius: 50%;
    transform: translateX(2px);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.grid-book-container {
    position: relative;
    width: 80px;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}

.grid-book:hover .grid-book-container {
    transform: rotateY(-75deg);
}

.grid-book:hover::before {
    opacity: 0.3;
    transform: scale(0.8) translateX(5px);
}

.grid-book-spine {
    position: absolute;
    height: 100%;
    width: 80px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    border-radius: 2px 0 0 2px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1));
    transform-origin: left center;
    transform: rotateY(0deg);
    transition: transform 0.5s ease;
    overflow: hidden;
}

.grid-book-cover {
    position: absolute;
    width: 150px;
    height: 100%;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 2px;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    transform-origin: left;
    transform: rotateY(90deg);
    left: 0;
    backface-visibility: hidden;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 15px 10px;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
}

.grid-cover-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
    text-align: center;
    max-width: 100%;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    margin-bottom: 10px;
    word-break: keep-all;
    min-height: 2.6em;
}

.grid-cover-author {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
}

.grid-cover-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 5px;
}

.grid-cover-image img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    border-radius: 2px;
}

.spine-content {
    width: 100%;
    height: 100%;
    padding: 15px 5px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    writing-mode: vertical-lr;
    transform: none;
    text-align: center;
    position: relative;
    z-index: 2;
}

.spine-title {
    font-weight: bold;
    font-size: 1.1rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 75%;
    word-break: keep-all;
    line-height: 1.3;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.7);
    letter-spacing: 1px;
    color: white;
    text-align: center;
    margin: 0 auto;
}

.spine-author {
    display: block;
    font-size: 0.55rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.5px;
    margin-top: auto;
    padding-top: 10px;
}

.spine-category {
    display: none;
}

/* 책 질감 효과 (위치 조정) */
.grid-book-spine::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-image: 
        repeating-linear-gradient(
            to bottom,
            transparent,
            transparent 15px,
            rgba(255, 255, 255, 0.05) 15px,
            rgba(255, 255, 255, 0.05) 16px
        ),
        linear-gradient(
            to right,
            rgba(0, 0, 0, 0.1),
            transparent 30%,
            transparent 70%,
            rgba(0, 0, 0, 0.1)
        );
    pointer-events: none;
    z-index: 1;
}

/* 책 표지 질감 효과 */
.grid-book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(
            to right,
            rgba(255, 255, 255, 0.1),
            rgba(255, 255, 255, 0.05) 50%,
            rgba(255, 255, 255, 0.1)
        );
    pointer-events: none;
    z-index: 1;
}

/* 책 상단과 하단 장식 선 */
.grid-book-spine::after {
    content: '';
    position: absolute;
    top: auto;
    bottom: 15px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    z-index: 2;
}

.grid-book-spine .spine-top-line {
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
    z-index: 2;
}

/* 각 책마다 약간씩 다른 각도와 높이를 줘서 자연스러운 배치 */
.grid-book:nth-child(7n+1) .grid-book-container { transform: rotateY(8deg); }
.grid-book:nth-child(7n+2) .grid-book-container { transform: rotateY(12deg); }
.grid-book:nth-child(7n+3) .grid-book-container { transform: rotateY(6deg); }
.grid-book:nth-child(7n+4) .grid-book-container { transform: rotateY(10deg); }
.grid-book:nth-child(7n+5) .grid-book-container { transform: rotateY(9deg); }
.grid-book:nth-child(7n+6) .grid-book-container { transform: rotateY(7deg); }
.grid-book:nth-child(7n+7) .grid-book-container { transform: rotateY(11deg); }

.grid-book:nth-child(7n+1):hover .grid-book-container { transform: rotateY(-75deg); }
.grid-book:nth-child(7n+2):hover .grid-book-container { transform: rotateY(-75deg); }
.grid-book:nth-child(7n+3):hover .grid-book-container { transform: rotateY(-75deg); }
.grid-book:nth-child(7n+4):hover .grid-book-container { transform: rotateY(-75deg); }
.grid-book:nth-child(7n+5):hover .grid-book-container { transform: rotateY(-75deg); }
.grid-book:nth-child(7n+6):hover .grid-book-container { transform: rotateY(-75deg); }
.grid-book:nth-child(7n+7):hover .grid-book-container { transform: rotateY(-75deg); }

.grid-book:nth-child(7n+1) { transform: translateY(-3px); }
.grid-book:nth-child(7n+2) { transform: translateY(0px); }
.grid-book:nth-child(7n+3) { transform: translateY(-5px); }
.grid-book:nth-child(7n+4) { transform: translateY(-2px); }
.grid-book:nth-child(7n+5) { transform: translateY(-4px); }
.grid-book:nth-child(7n+6) { transform: translateY(-1px); }
.grid-book:nth-child(7n+7) { transform: translateY(-3px); }

/* 반응형 디자인에 대한 추가 스타일 */
@media (max-width: 991px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        padding: 30px 25px;
    }
    
    .grid-book-cover {
        width: 120px;
    }
    
    .grid-cover-image img {
        max-height: 150px;
    }
    
    .grid-cover-title {
        font-size: 1rem;
    }
    
    .grid-cover-author {
        font-size: 0.85rem;
    }
    
    .view-mode-toggle {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 30px 22.5px;
        padding: 25px 20px;
    }
    
    .grid-book {
        height: 300px;
    }
    
    .grid-book-container {
        width: 80px; /* 책 가로 비율 고정 */
        min-width: 80px; /* 최소 너비 설정 */
    }
    
    .grid-book-spine {
        width: 80px; /* 책 등 너비 고정 */
    }
    
    .grid-book-cover {
        width: 150px;
        min-width: 150px; /* 책 커버 너비 고정 */
    }
    
    .spine-content {
        padding: 15px 7.5px;
    }
    
    .spine-title {
        font-size: 1.2rem;
        -webkit-line-clamp: 2;
        letter-spacing: 0.8px;
        max-height: 70%;
    }
    
    .spine-author {
        font-size: 0.7rem;
        padding-top: 6px;
    }
    
    .long-title {
        font-size: 0.95rem;
    }
    
    .grid-cover-image img {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 15px 10px;
    }
    
    .grid-book {
        height: auto;
        min-height: 180px;
    }
    
    .grid-book-container {
        width: 80px; /* 책 가로 비율 고정 */
        min-width: 80px; /* 최소 너비 설정 */
    }
    
    .grid-book-spine {
        width: 80px; /* 책 등 너비 고정 */
        min-width: 80px;
    }
    
    .grid-book-cover {
        width: 120px; /* 책 커버 너비 고정 */
        min-width: 120px;
        padding: 10px 8px;
    }
    
    .spine-content {
        padding: 10px 5px;
    }
    
    .spine-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
        letter-spacing: 0.5px;
        max-height: 65%;
    }
    
    .spine-author {
        font-size: 0.5rem;
        padding-top: 4px;
    }
    
    .long-title {
        font-size: 0.8rem;
    }
    
    .grid-cover-title {
        font-size: 0.8rem;
        -webkit-line-clamp: 2;
        min-height: 2.6em;
    }
    
    .grid-cover-image {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .grid-cover-image img {
        max-width: 100%;
        height: auto;
        max-height: 120px;
    }
}

/* 갤럭시 S25 울트라 최적화된 반응형 레이아웃 */
@media screen and (device-width: 1440px) and (device-height: 3120px), 
       screen and (max-width: 500px) and (-webkit-min-device-pixel-ratio: 2.5) {
  /* 기본 레이아웃 및 텍스트 */
  body {
    font-size: 16px;
    line-height: 1.6;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
  }
  
  .container {
    max-width: 100%;
    padding: 0 16px;
  }
  
  /* 헤더 및 내비게이션 */
  header {
    padding: 16px 0;
  }
  
  header h1 {
    font-size: 22px;
  }
  
  header p {
    font-size: 14px;
  }
  
  .nav-links a {
    font-size: 14px;
    padding: 8px 12px;
    margin-right: 12px;
  }
  
  .hamburger-menu {
    width: 28px;
    height: 20px;
  }
  
  /* 모바일 메뉴 최적화 */
  .mobile-menu {
    width: 80%;
  }
  
  .mobile-menu li {
    margin-bottom: 16px;
  }
  
  .mobile-menu a {
    padding: 12px 0;
    font-size: 16px;
  }
  
  /* 검색 및 필터링 UI */
  .search-filter-container {
    padding: 16px;
    margin-bottom: 24px;
  }
  
  .search-input-container input {
    font-size: 14px;
    height: 44px;
    padding: 0 16px;
  }
  
  .search-button {
    width: 44px;
    height: 44px;
  }
  
  .category-btn {
    font-size: 13px;
    padding: 8px 12px;
    margin: 4px;
    border-radius: 16px;
  }
  
  /* 책 그리드뷰 최적화 */
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    padding: 18px 14px;
  }
  
  .grid-book {
    height: 280px;
  }
  
  .grid-book-container {
    width: 70px;
    min-width: 70px;
  }
  
  .grid-book-spine {
    width: 70px;
    min-width: 70px;
  }
  
  .grid-book-cover {
    width: 140px;
    min-width: 140px;
    padding: 12px 10px;
  }
  
  .spine-title {
    font-size: 0.95rem;
    letter-spacing: 0.6px;
  }
  
  .spine-author {
    font-size: 0.6rem;
  }
  
  .grid-cover-title {
    font-size: 0.85rem;
  }
  
  .grid-cover-author {
    font-size: 0.75rem;
  }
  
  /* 선반뷰 최적화 */
  .shelf {
    height: 250px;
    padding: 16px 20px;
    margin-bottom: 24px;
  }
  
  .shelf .book {
    width: 150px;
    height: 220px;
    margin: 0 12px;
  }
  
  .book-cover {
    width: 150px;
    height: 220px;
  }
  
  .cover-title {
    font-size: 0.9rem;
  }
  
  .cover-author {
    font-size: 0.7rem;
  }
  
  /* 뷰 모드 토글 버튼 */
  .view-mode-toggle {
    margin-top: 12px;
  }
  
  .view-mode-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  /* 모달 최적화 */
  .modal-content {
    width: 90%;
    max-width: 450px;
    padding: 18px;
    border-radius: 12px;
  }
  
  .close-button {
    font-size: 24px;
  }
  
  /* 터치 최적화 */
  .button, 
  .navigation a,
  .form-control,
  .category-btn,
  .view-mode-btn,
  .search-button {
    min-height: 44px;
    min-width: 44px;
  }
}

/* 세로 모드 특화 스타일 (갤럭시 S25 울트라) */
@media screen and (device-width: 1440px) and (device-height: 3120px) and (orientation: portrait), 
       screen and (max-width: 500px) and (orientation: portrait) and (-webkit-min-device-pixel-ratio: 2.5) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
  
  .shelf .book {
    width: 150px;
    height: 220px;
    margin: 0 10px;
  }
  
  .desktop-shelves .shelf .book:nth-child(n+3) {
    display: none;
  }
  
  .mobile-shelves .shelf .book {
    width: 150px;
    height: 190px;
  }
}

/* 가로 모드 특화 스타일 (갤럭시 S25 울트라) */
@media screen and (device-height: 1440px) and (device-width: 3120px) and (orientation: landscape), 
       screen and (max-height: 500px) and (orientation: landscape) and (-webkit-min-device-pixel-ratio: 2.5) {
  .books-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
  
  .shelf .book {
    width: 150px;
    height: 180px;
    margin: 0 8px;
  }
  
  .shelf {
    height: 200px;
  }
  
  .mobile-menu {
    padding-top: 10px;
  }
  
  .mobile-menu li {
    margin-bottom: 8px;
  }
}
