/* Book Management Styles - Updated with Hamburger Nav for 5+ Features and Storage Integration */

:root {
    --book-primary: #2C5282;
    --book-secondary: #FFAB02;
    --book-success: #48BB78;
    --book-warning: #ED8936;
    --book-error: #E53E3E;
    --book-bg: #F7FAFC;
    --book-card: #FFFFFF;
    --book-border: #E2E8F0;
    --book-text: #2D3748;
    --book-text-light: #718096;
    --book-shadow: rgba(0, 0, 0, 0.1);
    --book-shadow-hover: rgba(0, 0, 0, 0.15);
    
    /* Storage colors (matching gallery) */
    --book-accent: #805AD5;
}

/* Base Styles */
body {
    background: var(--book-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

/* Navigation - Inherited from dashboard */
.nav {
    background: var(--book-card);
    border-bottom: 1px solid var(--book-border);
    box-shadow: 0 2px 10px var(--book-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.nav-title {
    color: var(--book-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--book-text);
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: var(--book-border);
    color: var(--book-primary);
}

.nav-link.active {
    background: var(--book-primary);
    color: white;
}

.back-to-site {
    background: var(--book-secondary);
    color: white !important;
    font-weight: 600;
}

.back-to-site:hover {
    background: #E69500;
}

.auth-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--book-error);
    text-decoration: none;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.auth-nav-link:hover {
    background: rgba(229, 62, 62, 0.1);
}

/* Mobile Toggle - Hidden by default, shown on mobile or with 5+ features */
.mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

/* Show hamburger when customer has 5+ features (even on desktop) */
.nav-container.has-many-features .mobile-toggle {
    display: flex;
}

/* Show hamburger when customer has 5+ features, hide some nav links on desktop */
.nav-container.has-many-features .nav-links {
    display: flex;
}

@media (min-width: 769px) {
    .nav-container.has-many-features .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--book-card);
        border-top: 1px solid var(--book-border);
        box-shadow: 0 2px 10px var(--book-shadow);
        flex-direction: column;
        padding: 1rem 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }
    
    .nav-container.has-many-features .nav-links.active {
        transform: translateX(0);
    }
    
    .nav-container.has-many-features .nav-link {
        width: 100%;
        text-align: center;
        padding: 1rem;
        border-radius: 0;
    }
}

.mobile-toggle span {
    width: 100%;
    height: 3px;
    background: var(--book-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.mobile-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--book-border);
    border-top: 4px solid var(--book-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Not Authenticated State */
.not-auth-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.auth-prompt {
    text-align: center;
    background: var(--book-card);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--book-shadow);
    max-width: 400px;
}

.auth-prompt h2 {
    color: var(--book-primary);
    margin-bottom: 1rem;
}

.auth-btn {
    background: var(--book-primary);
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-btn:hover {
    background: #1A365D;
    transform: translateY(-2px);
}

/* Main Book Panel */
.book-main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.book-panel {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Book Header */
.book-header {
    background: var(--book-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--book-shadow);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-content h1 {
    color: var(--book-primary);
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.header-content p {
    color: var(--book-text-light);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.add-book-btn {
    background: var(--book-success);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-book-btn:hover {
    background: #38A169;
    transform: translateY(-2px);
}

/* Stats Bar - Added for storage tracking */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-item {
    background: var(--book-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--book-shadow);
    text-align: center;
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--book-shadow-hover);
}

.stat-item.storage-stat {
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    border-left: 4px solid var(--book-accent);
}

.stat-item.storage-stat:hover {
    background: rgba(128, 90, 213, 0.05);
    border-left-color: var(--book-accent);
}

.stat-item.storage-stat.storage-warning {
    background: rgba(237, 137, 54, 0.1);
    border-left-color: var(--book-warning);
}

.stat-item.storage-stat.storage-warning:hover {
    background: rgba(237, 137, 54, 0.15);
}

.stat-item.storage-stat.storage-critical {
    background: rgba(229, 62, 62, 0.1);
    border-left-color: var(--book-error);
    animation: pulseRed 2s infinite;
}

.stat-item.storage-stat.storage-critical:hover {
    background: rgba(229, 62, 62, 0.15);
}

@keyframes pulseRed {
    0% { box-shadow: 0 4px 20px var(--book-shadow); }
    50% { box-shadow: 0 4px 20px rgba(229, 62, 62, 0.4); }
    100% { box-shadow: 0 4px 20px var(--book-shadow); }
}

.storage-clickable {
    color: var(--book-accent);
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: block;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--book-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--book-text-light);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

/* Book Controls */
.book-controls {
    background: var(--book-card);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--book-shadow);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-controls {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 2px solid var(--book-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.search-input:focus {
    outline: none;
    border-color: var(--book-primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.clear-search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--book-text-light);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.clear-search-btn:hover {
    background: var(--book-border);
    color: var(--book-text);
}

.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-controls select {
    padding: 0.75rem;
    border: 2px solid var(--book-border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--book-card);
    color: var(--book-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--book-primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* No Books Message */
.no-books-message {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    background: var(--book-card);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--book-shadow);
}

.no-books-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.no-books-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.no-books-content h3 {
    color: var(--book-primary);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.no-books-content p {
    color: var(--book-text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.add-first-book-btn {
    background: var(--book-success);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-first-book-btn:hover {
    background: #38A169;
    transform: translateY(-2px);
}

/* Book Card */
.book-card {
    background: var(--book-card);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--book-shadow);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px var(--book-shadow-hover);
}

.book-cover-container {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
}

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

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

.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card:hover .book-overlay {
    opacity: 1;
}

.overlay-btn {
    background: var(--book-card);
    color: var(--book-text);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 140px;
}

.overlay-btn:hover {
    transform: translateY(-1px);
}

.edit-btn:hover {
    background: var(--book-primary);
    color: white;
}

.retail-btn:hover {
    background: var(--book-secondary);
    color: white;
}

.duplicate-btn:hover {
    background: var(--book-warning);
    color: white;
}

.delete-btn:hover {
    background: var(--book-error);
    color: white;
}

/* Status Badge */
.status-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-draft {
    background: var(--book-text-light);
    color: white;
}

.status-coming-soon {
    background: var(--book-warning);
    color: white;
}

.status-published {
    background: var(--book-success);
    color: white;
}

.status-out-of-print {
    background: var(--book-error);
    color: white;
}

/* Book Info */
.book-info {
    padding: 1.5rem;
}

.book-title {
    margin: 0 0 0.5rem 0;
    color: var(--book-primary);
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Fallback for browsers that don't support line-clamp */
    max-height: 2.6em; /* approximately 2 lines */
}

.book-author {
    margin: 0 0 1rem 0;
    color: var(--book-text-light);
    font-size: 0.9rem;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--book-text-light);
}

.book-genre {
    background: var(--book-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.book-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--book-text-light);
}

.retail-count {
    background: var(--book-secondary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
}

.series-info {
    background: var(--book-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 500;
}

.format-count {
    background: var(--book-secondary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
}

/* Book Modal */
.book-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.modal-content {
    background: var(--book-card);
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    border: 1px solid var(--book-border);
}

@keyframes modalSlideIn {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 2rem 2rem 1.5rem 2rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(44, 82, 130, 0.02) 0%, rgba(255, 171, 2, 0.02) 100%);
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--book-primary);
    font-size: 1.6rem;
    font-weight: 700;
}

.close-modal {
    background: rgba(226, 232, 240, 0.2);
    border: none;
    font-size: 1.4rem;
    color: var(--book-text-light);
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    background: var(--book-error);
    color: white;
    transform: scale(1.1);
}

.modal-body {
    padding: 2rem;
}

/* Form Sections */
.form-section {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section h4 {
    color: var(--book-primary);
    margin: 0 0 1.5rem 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--book-text);
    font-weight: 600;
}

.form-group input,
.form-group textarea,
.form-group select,
.format-isbn,
.format-price,
.format-publisher,
.format-publish-date,
.retailer-select-small,
.retailer-url-small {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--book-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
    background: #FFFFFF !important;
    color: var(--book-text) !important;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.format-isbn:focus,
.format-price:focus,
.format-publisher:focus,
.format-publish-date:focus,
.retailer-select-small:focus,
.retailer-url-small:focus {
    outline: none;
    border-color: var(--book-primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
    background: #FFFFFF !important;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--book-text-light);
    font-size: 0.85rem;
}

/* Cover Upload */
.cover-upload-container {
    width: 100%;
}

.cover-dropzone {
    position: relative;
    width: 100%;
    min-height: 300px;
    border: 2px dashed var(--book-border);
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.cover-dropzone:hover {
    border-color: var(--book-primary);
    background: rgba(44, 82, 130, 0.02);
}

.cover-dropzone.dragover {
    border-color: var(--book-success);
    background: rgba(72, 187, 120, 0.1);
    transform: scale(1.02);
}

.dropzone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    height: 300px;
}

.dropzone-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.dropzone-text p {
    margin: 0.25rem 0;
    color: var(--book-text);
    font-weight: 500;
}

.dropzone-subtext {
    color: var(--book-text-light) !important;
    font-size: 0.9rem !important;
}

.browse-link {
    color: var(--book-primary);
    text-decoration: underline;
    cursor: pointer;
}

.browse-link:hover {
    color: #1A365D;
}

.cover-preview {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    border-radius: 10px;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cover-preview:hover .cover-overlay {
    opacity: 1;
}

.cover-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.change-btn {
    background: var(--book-primary);
    color: white;
}

.change-btn:hover {
    background: #1A365D;
    transform: translateY(-2px);
}

.remove-btn {
    background: var(--book-error);
    color: white;
}

.remove-btn:hover {
    background: #C53030;
    transform: translateY(-2px);
}

.upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.progress-bar {
    width: 80%;
    height: 8px;
    background: var(--book-border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--book-success);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: var(--book-text);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Book Formats */
.section-description {
    color: var(--book-text-light);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    background: rgba(72, 187, 120, 0.03);
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--book-success);
}

.formats-container {
    margin-bottom: 1.5rem;
}

.format-item {
    background: var(--book-card);
    border: 2px solid var(--book-border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.format-item:hover {
    border-color: var(--book-primary);
    box-shadow: 0 2px 8px var(--book-shadow);
}

.format-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--book-border);
}

.format-title {
    flex: 1;
}

.format-type {
    width: 200px;
    padding: 0.5rem;
    border: 2px solid var(--book-border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    background: var(--book-card);
    color: var(--book-text);
}

.format-type:focus {
    outline: none;
    border-color: var(--book-primary);
    box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.1);
}

.remove-format-btn {
    background: var(--book-error);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-format-btn:hover {
    background: #C53030;
    transform: scale(1.1);
}

.format-details {
    display: block;
}

.format-retail-links {
    border: 1px solid var(--book-border);
    border-radius: 8px;
    padding: 1rem;
    background: rgba(247, 250, 252, 0.5);
    margin-bottom: 0.5rem;
}

.retail-link-item-small {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--book-card);
    border-radius: 6px;
    border: 1px solid rgba(226, 232, 240, 0.3);
}

.retail-link-item-small:last-child {
    margin-bottom: 0;
}

.retail-link-row {
    display: grid;
    grid-template-columns: 200px 1fr auto;
    gap: 0.5rem;
    align-items: center;
}

.retailer-select-small,
.retailer-url-small {
    padding: 0.5rem !important;
    border: 2px solid var(--book-border) !important;
    border-radius: 4px !important;
    font-size: 0.85rem !important;
    background: #FFFFFF !important;
    color: var(--book-text) !important;
}

.retailer-select-small:focus,
.retailer-url-small:focus {
    outline: none !important;
    border-color: var(--book-primary) !important;
    box-shadow: 0 0 0 2px rgba(44, 82, 130, 0.1) !important;
    background: #FFFFFF !important;
}

.remove-retail-link-small {
    background: var(--book-error);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.remove-retail-link-small:hover {
    background: #C53030;
    transform: scale(1.1);
}

.add-retail-link-btn-small {
    background: var(--book-secondary);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-retail-link-btn-small:hover {
    background: #E69500;
}

.add-format-btn {
    background: var(--book-success);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-format-btn:hover {
    background: #38A169;
    transform: translateY(-2px);
}

/* Form Actions */
.form-actions-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--book-border);
}

.cancel-btn {
    background: white;
    color: var(--book-text);
    border: 1px solid var(--book-border);
    padding: 0.75rem 2rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.cancel-btn:hover {
    background: var(--book-bg);
    transform: translateY(-1px);
}

.save-btn {
    background: var(--book-success);
    color: white;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.save-btn:hover {
    background: #38A169;
    transform: translateY(-2px);
}

.save-btn:disabled {
    background: var(--book-border);
    cursor: not-allowed;
    transform: none;
}

.btn-spinner {
    animation: spin 1s linear infinite;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-toggle {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: var(--book-card);
        border-top: 1px solid var(--book-border);
        box-shadow: 0 2px 10px var(--book-shadow);
        flex-direction: column;
        padding: 1rem 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .nav-links.active {
        transform: translateX(0);
    }
    
    .nav-link {
        width: 100%;
        text-align: center;
        padding: 1rem;
        border-radius: 0;
    }
    
    .book-main {
        padding: 1rem;
    }
    
    .book-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .header-content h1 {
        font-size: 1.75rem;
    }
    
    .header-actions {
        justify-content: center;
    }
    
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .book-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-controls {
        min-width: auto;
    }
    
    .filter-controls {
        justify-content: stretch;
    }
    
    .filter-controls select {
        flex: 1;
    }
    
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-actions-bottom {
        flex-direction: column;
        align-items: stretch;
    }
    
    .modal-content {
        margin: 0.5rem;
        width: calc(100% - 1rem);
        max-height: calc(100vh - 1rem);
    }
    
    .format-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .format-type {
        width: 100%;
    }
    
    .retail-link-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .retailer-select-small,
    .retailer-url-small {
        width: 100%;
    }
    
    .remove-retail-link-small {
        justify-self: end;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    .book-main {
        padding: 0.5rem;
    }
    
    .book-header {
        padding: 1.5rem;
    }
    
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .book-controls {
        padding: 1rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .cover-dropzone {
        min-height: 200px;
    }
    
    .dropzone-content,
    .cover-preview {
        height: 200px;
    }
    
    .dropzone-icon {
        font-size: 3rem;
    }
}

/* Image Source Tabs (copied from Sales page) */
.image-source-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--admin-border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--admin-text-light);
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--admin-primary);
    background: rgba(44, 82, 130, 0.05);
}

.tab-btn.active {
    color: var(--admin-primary);
    border-bottom-color: var(--admin-primary);
}

.image-tab {
    min-height: 250px;
}

/* Existing Images Grid */
.existing-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--admin-bg);
    border-radius: 8px;
}

.existing-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    background: white;
}

.existing-image-item:hover {
    border-color: var(--admin-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--admin-shadow-hover);
}

.existing-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 0.5rem;
    color: white;
}

.image-title {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-type {
    font-size: 0.65rem;
    opacity: 0.8;
}

.loading-images, .error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--admin-text-light);
}

.existing-images-grid .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
}

.existing-images-grid .empty-state p {
    margin: 0.5rem 0;
    color: var(--admin-text-light);
}