/* Mobile-First Modern Design for BookVault */

/* Reset and Base Styles */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --surface-color: #ffffff;
    --background-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Hover colors */
    --secondary-hover: #475569;
    --success-hover: #047857;
    --warning-hover: #b45309;
    --danger-hover: #b91c1c;
    --background-hover: #e2e8f0;
    --border-radius-sm: 4px;
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; 
    background: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
    padding: var(--spacing-sm);
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden;
    height: 100vh;
}

main {
    max-width: 1200px;
    margin: 0 auto;
}

/* Modern Navigation - Mobile First */
.nav { 
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.nav-primary {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: var(--spacing-sm);
    flex: 1;
}

.nav a { 
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    min-height: 40px;
    justify-content: center;
}

.nav a:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.nav a.secondary {
    background: var(--secondary-color);
}

.nav a.secondary:hover {
    background: #475569;
}

/* Search and Filter Bar */
.search-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.search-form { 
    display: flex;
    gap: var(--spacing-sm);
    align-items: stretch;
}

.search-input-group {
    flex: 1;
    min-width: 0;
}

.search-form input[type="text"] { 
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px; /* Prevent zoom on iOS */
    background: var(--surface-color);
    transition: all 0.2s ease;
    min-height: 44px; /* Touch target */
}

.search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.sort-controls {
    display: flex;
    gap: var(--spacing-sm);
    align-items: stretch;
}

.search-form select {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--surface-color);
    font-size: 14px;
    min-height: 44px;
    min-width: 100px;
    cursor: pointer;
}

.search-form button {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.search-form button:hover {
    background: var(--primary-hover);
}

.search-form button.toggle-sort {
    background: var(--secondary-color);
    min-width: 44px;
    padding: var(--spacing-sm);
}

.search-form button.toggle-sort:hover {
    background: #475569;
}

/* Header */
.header { 
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.header h1 { 
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.book-count { 
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Bulk Actions */
.bulk-actions {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    align-items: stretch;
}

.bulk-select-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
}

.bulk-select-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

.bulk-select-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.bulk-buttons {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* Book Grid */
.book-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.book-card { 
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid var(--border-color);
}

.book-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.book-card .select-box {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--border-radius);
    padding: var(--spacing-xs);
    backdrop-filter: blur(4px);
}

.book-card .select-box input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.book-card img { 
    width: 100%; 
    height: 200px;
    object-fit: cover;
    background: var(--background-color);
}

.book-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
    line-height: 1.4;
}

.book-card p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 0 var(--spacing-md);
    margin: 0;
}

.book-card a { 
    text-decoration: none; 
    color: inherit; 
    display: block; 
}

.book-card .year { 
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white; 
    padding: var(--spacing-xs) var(--spacing-sm);
    margin: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

/* Book Detail Views */
.book-images { 
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    justify-content: center;
}

.book-images img { 
    width: 100%;
    max-width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.book-info { 
    background: var(--surface-color);
    padding: var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-lg);
}

.book-info h1 { 
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 700;
}

.book-info p { 
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    line-height: 1.6;
}

.book-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.notes { 
    margin-top: var(--spacing-lg);
    padding: var(--spacing-lg);
    background: var(--background-color);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

/* Forms */
.book-form { 
    background: var(--surface-color);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
}

.book-form h1 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    text-align: center;
}

.book-form h1:after {
    content: '';
    display: block;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
    margin: var(--spacing-md) auto var(--spacing-lg);
    border-radius: 2px;
}

.form-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
}

.book-form input, 
.book-form textarea, 
.book-form select { 
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 16px; /* Prevent zoom on iOS */
    transition: all 0.2s ease;
    background: var(--surface-color);
    min-height: 44px;
}

.book-form input:focus, 
.book-form textarea:focus, 
.book-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.book-form textarea { 
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

.price-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-helper {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
    font-style: italic;
}

/* File Upload */
.file-input { 
    margin: var(--spacing-lg) 0;
    position: relative;
}

.file-input label { 
    display: block;
    padding: var(--spacing-xl);
    background: linear-gradient(135deg, var(--background-color) 0%, #e2e8f0 100%);
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--text-secondary);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-input label:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: var(--primary-color);
}

.file-input input[type="file"] { 
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Buttons */
.btn { 
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    min-height: 44px;
    gap: var(--spacing-sm);
}

.btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    margin-top: var(--spacing-md);
    padding: var(--spacing-lg);
    font-size: 1rem;
}

.btn-secondary {
    background: var(--secondary-color);
}

.btn-secondary:hover {
    background: #475569;
}

.btn-success {
    background: var(--success-color);
}

.btn-success:hover {
    background: #047857;
}

.btn-warning {
    background: var(--warning-color);
}

.btn-warning:hover {
    background: #b45309;
}

/* QR Code Section */
.qr-section {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    margin: var(--spacing-lg) 0;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.qr-section:hover {
    border-color: var(--primary-color);
}

.qr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    cursor: pointer;
    background: var(--background-color);
    transition: all 0.2s ease;
    user-select: none;
}

.qr-header:hover {
    background: #e2e8f0;
}

.qr-header-content {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.qr-icon {
    width: 32px;
    height: 32px;
    background: var(--primary-color);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.qr-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.qr-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    display: block;
    margin-top: 2px;
}

.qr-chevron {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.qr-section.expanded .qr-chevron {
    transform: rotate(180deg);
}

.qr-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.qr-section.expanded .qr-content {
    max-height: 400px;
    padding: var(--spacing-lg);
}

.qr-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    text-align: center;
}

.qr-image {
    width: 120px;
    height: 120px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-sm);
    background: white;
    box-shadow: var(--shadow-sm);
}

.qr-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: var(--spacing-md);
}

.qr-link {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: var(--spacing-md);
    width: 100%;
}

.qr-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    width: 100%;
}

.btn-qr {
    padding: var(--spacing-md);
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    min-height: 44px;
}

.btn-qr:hover {
    background: var(--primary-hover);
}

.btn-qr.secondary {
    background: var(--secondary-color);
}

.btn-qr.secondary:hover {
    background: #475569;
}

/* Image Grids */
.image-grid { 
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.image-grid img { 
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

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

.existing-images {
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.existing-images h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

/* Image Management */
.image-management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.image-item {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.image-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.image-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.image-item:hover img {
    opacity: 0.8;
}

.image-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 4px;
}

.delete-image-form {
    margin: 0;
}

.btn-small {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
    min-height: 28px;
    border-radius: var(--border-radius-sm);
}

.btn-danger {
    background: #dc2626;
    color: white;
    border: none;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

/* Image Preview Modal */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
}

.image-preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    cursor: default;
}

.image-preview-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--border-radius);
}

.close-preview {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-preview:hover {
    background: rgba(0, 0, 0, 0.9);
}

/* Enhanced Mobile Gallery */
.gallery-modal {
    -webkit-user-select: none;
    user-select: none;
}

.gallery-content {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
}

.gallery-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
}

/* Large tap zones for mobile navigation */
.gallery-tap-zone {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    z-index: 10;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s ease;
}

.gallery-tap-prev {
    left: 0;
    justify-content: flex-start;
    padding-left: 20px;
}

.gallery-tap-next {
    right: 0;
    justify-content: flex-end;
    padding-right: 20px;
}

/* Visual indicators that appear on hover/touch */
.gallery-tap-indicator {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.2s ease;
    transform: scale(0.8);
}

.gallery-tap-zone:hover .gallery-tap-indicator,
.gallery-tap-zone:active .gallery-tap-indicator {
    opacity: 1;
    transform: scale(1);
}

/* Show indicators briefly on touch */
.gallery-tap-zone:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Enhanced counter with progress bar */
.gallery-counter {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    min-width: 120px;
}

.gallery-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin-bottom: 8px;
    overflow: hidden;
}

.gallery-progress-bar {
    height: 100%;
    background: #2563eb;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.gallery-counter-text {
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.gallery-close {
    top: -50px;
    right: -10px;
    width: 44px;
    height: 44px;
    font-size: 1.3rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 20;
}

.gallery-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .gallery-tap-zone {
        width: 45%;
    }
    
    .gallery-tap-indicator {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .gallery-counter {
        bottom: -80px;
    }
    
    .gallery-close {
        top: -60px;
        right: 0;
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    /* Always show a subtle hint on mobile */
    .gallery-tap-indicator {
        opacity: 0.15;
    }
    
    .gallery-tap-zone:active .gallery-tap-indicator {
        opacity: 1;
        background: rgba(0, 0, 0, 0.8);
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    .gallery-modal {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }
    
    .gallery-tap-zone {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Legacy viewer navigation (fallback) */
.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.viewer-prev { left: -56px; }
.viewer-next { right: -56px; }
.viewer-nav:disabled { opacity: 0.4; cursor: default; }

/* Book Details Layout */
.book-details-container {
    max-width: 800px;
    margin: 0 auto;
}

.book-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.book-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin: 0;
}

.title-author {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 1.2rem;
    display: block;
    margin-top: var(--spacing-sm);
}

.book-sections {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.detail-section {
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    border-left: 4px solid var(--primary-color);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-md) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

/* Collapsible Section Styles */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    justify-content: space-between;
    transition: color 0.2s ease;
}

.collapsible-header:hover {
    color: var(--primary-color);
}

.collapse-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.collapsible-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.detail-grid {
    display: grid;
    gap: var(--spacing-md);
    grid-template-columns: 1fr;
}

.detail-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--spacing-md);
    align-items: start;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.detail-value.price {
    font-weight: 600;
    color: var(--success-color);
}

.price-date {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.8rem;
}


/* Shelf Location Section */
.shelf-section {
    border-left-color: var(--warning-color);
    text-align: center;
}

.shelf-display {
    margin-top: var(--spacing-md);
}

.shelf-number {
    display: inline-block;
    background: linear-gradient(135deg, var(--warning-color), #f59e0b);
    color: white;
    font-size: 2rem;
    font-weight: 800;
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    min-width: 120px;
    letter-spacing: 0.5px;
}

/* Notes text styling within uniform grid */
.notes-text {
    line-height: 1.6;
    color: var(--text-primary);
}

/* QR Code Section */
.qr-section-new {
    border-left-color: var(--secondary-color);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-md);
}

.qr-image-wrapper {
    text-align: center;
}

.qr-code-image {
    width: 160px;
    height: 160px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background: white;
    padding: var(--spacing-sm);
}

.qr-code-label {
    margin-top: var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.qr-actions-wrapper {
    text-align: center;
    width: 100%;
}

.qr-description {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    font-size: 0.9rem;
}

.qr-link-display {
    background: var(--background-color);
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
    word-break: break-all;
}

.qr-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .book-header h1 {
        font-size: 1.5rem;
    }
    
    .title-author {
        font-size: 1.1rem;
    }
    
    .detail-item {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }
    
    .detail-label {
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .shelf-number {
        font-size: 1.5rem;
        padding: var(--spacing-md) var(--spacing-lg);
    }
    
    .qr-container {
        gap: var(--spacing-md);
    }
    
    .qr-code-image {
        width: 140px;
        height: 140px;
    }
    
    .qr-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .qr-buttons .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .book-details-container {
        margin: 0 -var(--spacing-sm);
    }
    
    .book-header,
    .detail-section {
        margin: 0 var(--spacing-sm);
        padding: var(--spacing-md);
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    .shelf-number {
        font-size: 1.3rem;
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

/* Utility Classes */
.no-books { 
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Success and Error Messages */
.success-message {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    border-left: 4px solid #059669;
    margin-bottom: var(--spacing-lg);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideInDown 0.4s ease-out;
}

.success-message::before {
    content: '';
    flex-shrink: 0;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message {
    color: var(--error-color);
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--border-radius-lg);
    border-left: 4px solid var(--error-color);
    margin-bottom: var(--spacing-lg);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Tablet and Small Desktop Styles */
@media (min-width: 640px) {
    body {
        padding: var(--spacing-lg);
    }
    
    .nav {
        flex-direction: row;
        align-items: center;
    }
    
    .nav-primary {
        flex-direction: row;
    }
    
    .search-controls {
        flex-direction: row;
        align-items: center;
        gap: var(--spacing-md);
    }
    
    .search-form {
        flex-direction: row;
    }
    
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
    
    .book-card img {
        height: 240px;
    }
    
    .bulk-actions {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .bulk-buttons {
        flex-direction: row;
    }
    
    .form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }
    
    .form-group.full-width {
        grid-column: 1 / -1;
    }
    
    .price-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-md);
    }
    
    .qr-inner {
        flex-direction: row;
        text-align: left;
    }
    
    .qr-buttons {
        flex-direction: row;
        max-width: 300px;
    }
}

/* Large Desktop Styles */
@media (min-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .book-card img {
        height: 280px;
    }
    
    .header h1 {
        font-size: 2.5rem;
    }
}