/* ============================================
   My Digital Bookshelf - Styles
   Matching parent Book Library color scheme
   ============================================ */

:root {
    --primary: #8b5a2b;
    --primary-hover: #6d4620;
    --bg: #f5f0e6;
    --card: #fffbf5;
    --text: #3d3229;
    --text-muted: #8b7355;
    --border: #e8e0d0;
    --success: #6b8e4e;
    --warning: #c9a227;
    --error: #b85450;
    --shadow: 0 1px 3px rgba(61,50,41,0.1);
    --input-bg: #fffbf5;
    --modal-overlay: rgba(0,0,0,0.5);
}

/* Dark Mode */
body.dark-mode {
    --primary: #c9a86c;
    --primary-hover: #d4b87d;
    --bg: #1a1814;
    --card: #2d2924;
    --text: #e8e0d0;
    --text-muted: #a09075;
    --border: #3d3829;
    --success: #7fb069;
    --warning: #e0c060;
    --error: #d6736f;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --input-bg: #3d3829;
    --modal-overlay: rgba(0,0,0,0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    min-height: 100vh;
    padding: 20px;
    color: var(--text);
    line-height: 1.6;
    position: relative;
}

/* Theme Toggle
   ============================================ */
.theme-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--border);
    transform: scale(1.05);
}

/* Library Link Button */
.library-link {
    position: absolute;
    top: 10px;
    right: 64px;
    height: 44px;
    padding: 0 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
    z-index: 100;
}

.library-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .theme-toggle {
        top: 5px;
        right: 5px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .library-link {
        top: 5px;
        right: 48px;
        height: 36px;
        padding: 0 10px;
        font-size: 12px;
    }
}

/* Header
   ============================================ */
.header {
    text-align: center;
    color: var(--text);
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* View Toggle
   ============================================ */
.view-toggle {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.view-btn {
    background: var(--card);
    border: 2px solid var(--border);
    color: var(--text-muted);
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.view-btn:hover {
    background: var(--border);
    transform: translateY(-2px);
}

.view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Bookshelf Container
   ============================================ */
.bookshelf-container {
    max-width: 900px;
    margin: 0 auto;
    background: var(--card);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

/* Search Box
   ============================================ */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 30px;
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--input-bg);
    color: var(--text);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.1);
}

body.dark-mode .search-box input:focus {
    box-shadow: 0 0 0 3px rgba(201, 168, 108, 0.2);
}

/* Shelf Grid & Cubes
   ============================================ */
.shelf-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.cube {
    background: linear-gradient(145deg, var(--primary), var(--primary-hover));
    border-radius: 10px;
    padding: 15px;
    min-height: 140px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 2px 10px rgba(255,255,255,0.1),
        0 4px 12px rgba(61,50,41,0.2);
    border: 2px solid var(--primary-hover);
}

.cube:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 
        inset 0 2px 10px rgba(255,255,255,0.2),
        0 12px 24px rgba(61,50,41,0.3);
}

body.dark-mode .cube {
    box-shadow: 
        inset 0 2px 10px rgba(255,255,255,0.05),
        0 4px 12px rgba(0,0,0,0.4);
}

body.dark-mode .cube:hover {
    box-shadow: 
        inset 0 2px 10px rgba(255,255,255,0.1),
        0 12px 24px rgba(0,0,0,0.5);
}

.cube.active {
    background: linear-gradient(145deg, var(--primary-hover), var(--primary));
    border-color: var(--warning);
}

.cube-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.5);
    color: var(--warning);
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 1px;
}

.cube-genre {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    color: rgba(255,255,255,0.9);
    font-size: 0.8rem;
    text-align: center;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Book Preview Mini Spines
   ============================================ */
.books-preview {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 80px;
    gap: 2px;
    margin-top: 15px;
    perspective: 500px;
}

.mini-spine {
    width: 12px;
    height: 60px;
    background: linear-gradient(90deg, #2c3e50, #34495e);
    border-radius: 2px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
}

.mini-spine:nth-child(2) { height: 65px; background: linear-gradient(90deg, #8e44ad, #9b59b6); }
.mini-spine:nth-child(3) { height: 55px; background: linear-gradient(90deg, #c0392b, #e74c3c); }
.mini-spine:nth-child(4) { height: 70px; background: linear-gradient(90deg, #27ae60, #2ecc71); }
.mini-spine:nth-child(5) { height: 58px; background: linear-gradient(90deg, #f39c12, #f1c40f); }

.cube:hover .mini-spine {
    transform: rotateY(-15deg) translateX(-2px);
}

/* Modal
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-overlay);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    backdrop-filter: blur(5px);
}

/* Hide back row section for shelf view */
.modal.shelf-view .back-row-section,
.modal.shelf-view #backList,
.modal.shelf-view .section-title:nth-of-type(2) {
    display: none !important;
}

/* Hide the back row count stat box in shelf view */
.modal.shelf-view .stats .stat-box:nth-child(2) {
    display: none;
}

/* Make total books stat box full width in shelf view */
.modal.shelf-view .stats .stat-box:first-child {
    flex: 1;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--card);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border: 1px solid var(--border);
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 25px;
    border-radius: 20px 20px 0 0;
    position: relative;
}

.modal-header h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.modal-header .genre-tag {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    margin-top: 10px;
    cursor: default;
    transition: all 0.2s ease;
    color: white;
}

.modal-header .genre-tag.editable {
    cursor: text;
    border: 1px solid transparent;
}

.modal-header .genre-tag.editable:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.modal-header .genre-tag.editable:focus {
    outline: none;
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.8);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
}

/* Stats Section
   ============================================ */
.stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-box {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 12px;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Section Titles
   ============================================ */
.section-title {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: var(--primary);
    border-radius: 2px;
}

/* Book Lists
   ============================================ */
.book-list {
    list-style: none;
    min-height: 60px;
    padding: 5px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.book-list.drag-over {
    background-color: rgba(139, 90, 43, 0.1);
    outline: 2px dashed var(--primary);
}

body.dark-mode .book-list.drag-over {
    background-color: rgba(201, 168, 108, 0.1);
}

.book-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    border-left: 4px solid var(--primary);
    cursor: grab;
}

.book-item:hover {
    background: var(--border);
    transform: translateX(5px);
}

.book-item:active {
    cursor: grabbing;
}

.book-item.dragging {
    opacity: 0.4;
    transform: scale(0.98);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.book-item[data-draggable="false"] {
    cursor: default;
    opacity: 0.6;
    font-style: italic;
}

.book-item[data-draggable="false"]:hover {
    transform: none;
}

/* Reading Status Indicator */
.reading-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-toread {
    background: var(--border);
    color: var(--text-muted);
}

.status-reading {
    background: rgba(201, 167, 44, 0.2);
    color: #c9a72c;
}

.status-read {
    background: rgba(107, 142, 78, 0.2);
    color: var(--success);
}

body.dark-mode .status-toread {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
}

body.dark-mode .status-reading {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
}

body.dark-mode .status-read {
    background: rgba(127, 176, 105, 0.2);
    color: var(--success);
}

/* Book Spine Reading Status Dot */
.book-spine-status {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}

.book-spine-status.status-toread {
    background: var(--text-muted);
}

.book-spine-status.status-reading {
    background: #ffc107;
}

.book-spine-status.status-read {
    background: var(--success);
}

/* Mini Spine Status Dot */
.mini-spine {
    position: relative;
}

.spine-status-dot {
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}

.spine-status-dot.status-toread {
    background: rgba(255,255,255,0.5);
}

.spine-status-dot.status-reading {
    background: #ffc107;
}

.spine-status-dot.status-read {
    background: #4caf50;
}

/* Series Badge */
.series-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    margin-top: 4px;
}

.drag-handle {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: grab;
    padding: 5px;
    user-select: none;
}

.drag-handle:hover {
    color: var(--primary);
}

.book-spine {
    width: 30px;
    height: 80px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
    position: relative;
}

.book-spine::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 60px;
    background: rgba(255,255,255,0.3);
}

.book-spine::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 60px;
    background: rgba(255,255,255,0.3);
}

.book-info h4 {
    color: var(--text);
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.book-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Bookshelf View (List Style)
   ============================================ */
.bookshelf-view {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.shelf-section {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: 12px;
    padding: 20px 20px 30px 20px;
    box-shadow: 
        inset 0 3px 15px rgba(255,255,255,0.1),
        0 8px 20px rgba(61,50,41,0.2);
    position: relative;
}

body.dark-mode .shelf-section {
    box-shadow: 
        inset 0 3px 15px rgba(255,255,255,0.05),
        0 8px 20px rgba(0,0,0,0.4);
}

.shelf-section::after {
    content: '';
    position: absolute;
    bottom: 15px;
    left: 20px;
    right: 20px;
    height: 8px;
    background: linear-gradient(180deg, var(--primary-hover) 0%, #2d1f12 100%);
    border-radius: 0 0 4px 4px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}

.shelf-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.shelf-title {
    color: #f5f0e6;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

body.dark-mode .shelf-title {
    color: #fffbf5;
    text-shadow: 
        0 1px 3px rgba(0,0,0,0.8),
        0 0 2px rgba(0,0,0,0.6);
}

.shelf-count {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.shelf-books {
    display: flex;
    gap: 8px;
    padding: 10px 0;
    min-height: 140px;
    align-items: flex-end;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.3) transparent;
}

.shelf-books::-webkit-scrollbar {
    height: 6px;
}

.shelf-books::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.shelf-books::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.shelf-book {
    flex-shrink: 0;
    width: 40px;
    border-radius: 3px 3px 0 0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 
        2px 0 5px rgba(0,0,0,0.3),
        inset 2px 0 3px rgba(255,255,255,0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 8px;
}

.shelf-book:hover {
    transform: translateY(-15px) scale(1.05);
    z-index: 10;
    box-shadow: 
        5px 5px 15px rgba(0,0,0,0.4),
        inset 2px 0 3px rgba(255,255,255,0.2);
}

.shelf-book-spine-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 0.65rem;
    color: rgba(255,255,255,0.95);
    max-height: 80%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 
        0 1px 2px rgba(0,0,0,0.8),
        0 0 3px rgba(0,0,0,0.6);
    font-weight: 600;
}

body.dark-mode .shelf-book-spine-text {
    color: #f5f0e6;
    text-shadow: 
        0 1px 2px rgba(0,0,0,0.9),
        0 0 4px rgba(0,0,0,0.8),
        0 0 1px rgba(0,0,0,1);
}

.shelf-book::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: rgba(255,255,255,0.3);
    border-radius: 1px;
}

/* Shelf book reading status indicator */
.shelf-book.status-reading {
    box-shadow: 
        2px 0 5px rgba(0,0,0,0.3),
        inset 2px 0 3px rgba(255,255,255,0.2),
        inset 0 -4px 0 rgba(255,193,7,0.6);
}

.shelf-book.status-read {
    box-shadow: 
        2px 0 5px rgba(0,0,0,0.3),
        inset 2px 0 3px rgba(255,255,255,0.2),
        inset 0 -4px 0 rgba(76,175,80,0.6);
}

.shelf-series-indicator {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Series View Styles */
.series-section {
    border-left: 4px solid var(--warning);
}

.series-section.ungrouped {
    border-left-color: var(--text-muted);
    opacity: 0.9;
}

.series-progress {
    padding: 10px 20px;
    background: rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
    white-space: nowrap;
}

.shelf-location-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: 0.6rem;
    opacity: 0.8;
}

/* Loading & Error States
   ============================================ */
.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 1.2rem;
}

.error-message {
    background: rgba(184, 84, 80, 0.9);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin: 20px;
    text-align: center;
}

/* Sample Notice */
.sample-notice {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.5;
}

.sample-notice code {
    background: rgba(0,0,0,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

body.dark-mode .sample-notice code {
    background: rgba(255,255,255,0.1);
}

.sample-notice a {
    color: var(--primary);
    text-decoration: underline;
}

/* Search Results View
   ============================================ */
.search-results-view {
    display: block;
}

.search-results-container {
    max-width: 800px;
    margin: 0 auto;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.search-results-header h3 {
    color: var(--text);
    font-size: 1.2rem;
    margin: 0;
}

.clear-search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.clear-search-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.search-no-results {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.search-result-group {
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.search-result-group-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.search-result-group-header:hover {
    filter: brightness(1.1);
}

.search-result-icon {
    font-size: 1.5rem;
}

.search-result-container {
    font-size: 1.1rem;
    font-weight: 600;
    flex: 1;
}

.search-result-count {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.search-result-books {
    padding: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.search-result-book {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid var(--primary);
}

.search-result-book:hover {
    background: var(--border);
    transform: translateX(5px);
}

.search-book-spine {
    width: 24px;
    height: 60px;
    border-radius: 3px;
    flex-shrink: 0;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.search-book-info {
    flex: 1;
    min-width: 0;
}

.search-book-info h4 {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-book-info p {
    color: var(--text-muted);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-book-row {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-top: 4px;
}

/* Book Details Modal (Read-only)
   ============================================ */
.book-details-content {
    max-width: 450px;
}

.book-details-content .modal-body {
    padding: 25px;
}

.book-detail-spine {
    width: 60px;
    height: 90px;
    border-radius: 4px;
    margin: 0 auto 20px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
}

.detail-section {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.detail-section:last-of-type {
    border-bottom: none;
}

.detail-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 1rem;
    color: var(--text);
}

.detail-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.detail-status.status-toread {
    background: var(--border);
    color: var(--text-muted);
}

.detail-status.status-reading {
    background: rgba(201, 167, 44, 0.2);
    color: #c9a72c;
}

.detail-status.status-read {
    background: rgba(107, 142, 78, 0.2);
    color: var(--success);
}

.detail-progress {
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.detail-progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: 4px;
    transition: width 0.3s;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-tag {
    background: var(--primary);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.detail-notes {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
}

.detail-hint {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

body.dark-mode .detail-notes {
    background: rgba(255,255,255,0.05);
}

/* Responsive
   ============================================ */
@media (max-width: 600px) {
    .shelf-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .search-result-books {
        grid-template-columns: 1fr;
    }
    
    .search-results-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 2rem;
    padding: 1rem;
}
