/* Jumbo Collection Manager - New Design CSS */

:root {
    --primary-color: #2196F3;
    --secondary-color: #F57C00;
    --success-color: #4CAF50;
    --danger-color: #F44336;
    --warning-color: #FF9800;
    --info-color: #2196F3;
    
    --bg-dark: #121212;
    --bg-surface: #1E1E1E;
    --bg-elevated: #2C2C2C;
    
    --text-primary: #FFFFFF;
    --text-secondary: #B0B0B0;
    --text-disabled: #808080;
    
    --border-color: #404040;
    --shadow-color: rgba(0, 0, 0, 0.4);
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== HEADER ========== */

header {
    background-color: var(--bg-elevated);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 8px var(--shadow-color);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.header-stats span {
    font-weight: 600;
    color: var(--primary-color);
}

/* ========== NAVIGATION ========== */

.main-nav {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
}

.nav-btn {
    padding: 0.75rem 1.5rem;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-btn:hover {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
}

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

/* ========== MAIN CONTENT ========== */

.view {
    flex: 1;
    display: none;
    overflow-y: auto;
    padding: 2rem;
    animation: fadeIn 0.3s;
}

.view.active {
    display: block;
}

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

/* ========== SEARCH SECTION ========== */

.search-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.search-input {
    flex: 1;
    padding: 0.875rem 1rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* ========== BUTTONS ========== */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background-color: #1976D2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.btn-secondary {
    background-color: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-elevated);
    border-color: var(--primary-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-icon {
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-icon:hover {
    opacity: 1;
}

.editable-title {
    cursor: pointer;
    transition: color 0.2s;
}

.editable-title:hover {
    color: var(--primary-color);
}

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

.btn-danger:hover {
    background-color: #d32f2f;
}

/* ========== SEARCH RESULTS ========== */

.search-results {
    margin-top: 2rem;
}

.no-results,
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background-color: var(--bg-surface);
    border-radius: 0.5rem;
    border: 1px dashed var(--border-color);
}

.hint {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    color: var(--text-disabled);
}

/* ========== BOOK DETAIL ========== */

.book-detail {
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.book-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--primary-color);
}

.book-header h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.book-header .year {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ========== EDITIONS CONTAINER ========== */

.editions-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.edition-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.2s;
}

.edition-card:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-elevated);
}

.edition-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.edition-header h3 {
    font-size: 1.25rem;
}

.copies-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ========== EDITION IMAGE ========== */

.edition-image-container {
    margin: 1rem 0;
    text-align: center;
    max-width: 150px;
}

.edition-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 8px var(--shadow-color);
    transition: transform 0.2s;
}

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

/* ========== IMAGE GALLERY ========== */

.image-gallery {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
}

.gallery-container {
    position: relative;
    text-align: center;
    margin-bottom: 1rem;
}

.gallery-image {
    max-width: 100%;
    max-height: 350px;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-image:hover {
    transform: scale(1.02);
}

.gallery-type {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 0.3rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.gallery-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.gallery-btn {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.gallery-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.gallery-indicator {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.dot.active {
    background-color: var(--primary-color);
    width: 12px;
}

/* ========== EDITION INFO ========== */

.edition-info {
    margin: 1rem 0;
    padding: 1rem;
    background-color: var(--bg-dark);
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.edition-info p {
    margin: 0.5rem 0;
}

.edition-info strong {
    color: var(--primary-color);
}

.image-notice {
    margin: 0 0 0.75rem 0;
    padding: 0.5rem 0.75rem;
    background-color: rgba(255, 152, 0, 0.15);
    border: 1px solid var(--warning-color);
    color: var(--text-primary);
    border-radius: 0.4rem;
    font-size: 0.85rem;
}

.image-fallback-caption {
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    background-color: rgba(255, 152, 0, 0.12);
    border: 1px solid var(--warning-color);
    border-radius: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* ========== COPIES LIST ========== */

.copies-list {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--bg-dark);
    border-radius: 0.5rem;
}

.copies-list h4 {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.no-copies {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.copies-placeholder {
    padding: 1rem;
    background-color: var(--bg-surface);
    border-radius: 0.5rem;
    text-align: center;
    color: var(--text-secondary);
}

.copies-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.copy-item {
    padding: 0.75rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.copy-main {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr 1fr auto auto auto;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    align-items: center;
}

.copy-id {
    color: var(--primary-color);
    font-weight: 600;
}

.copy-notes {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========== EDITION ACTIONS ========== */

.edition-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.add-copy-form {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.add-copy-form.active {
    display: block;
}

.grading-details {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 12px;
}

.grading-details summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}

.grading-content {
    margin-top: 10px;
    max-height: 260px;
    overflow: auto;
    padding-right: 6px;
    color: var(--text-secondary);
    line-height: 1.45;
    font-size: 0.95rem;
}

.grading-content h4 {
    margin: 12px 0 6px;
    color: var(--text-primary);
    font-size: 1rem;
}
.add-copy-form .form-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
}

.add-copy-form label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.add-copy-form input,
.add-copy-form select,
.add-copy-form textarea {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.4rem;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
}

.add-copy-form input:focus,
.add-copy-form select:focus,
.add-copy-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.1);
}

.add-copy-form .form-actions {
    display: flex;
    justify-content: flex-end;
}

/* ========== BOOKS GRID ========== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.section-header h2 {
    white-space: nowrap;
}

.section-header .search-input {
    max-width: 300px;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.book-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}

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

.book-image {
    width: 100%;
    height: 220px;
    background-color: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 3rem;
}

.book-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

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

.book-image.placeholder {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.book-info {
    padding: 1rem;
}

.book-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.book-info .title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-info .meta {
    font-size: 0.8rem;
    color: var(--text-disabled);
}

/* ========== STATISTICS ========== */

.statistics-container {
    max-width: 900px;
}

.statistics-container h2 {
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

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

.conditions-chart {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 2rem;
}

.conditions-chart h3 {
    margin-bottom: 1rem;
}

.conditions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.condition-name {
    width: 80px;
    font-weight: 500;
}

.condition-bar {
    flex: 1;
    height: 24px;
    background-color: var(--bg-dark);
    border-radius: 0.5rem;
    overflow: hidden;
}

.condition-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s;
}

.condition-count {
    width: 80px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ========== SETTINGS ========== */

.settings-container {
    max-width: 600px;
}

.settings-section {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.settings-section p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* ========== MODAL ========== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: var(--bg-surface);
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* ========== NOTIFICATIONS ========== */

.notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px var(--shadow-color);
    z-index: 2000;
    animation: slideUp 0.3s;
}

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

.notification.fade-out {
    animation: slideDown 0.3s;
}

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

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

.notification-error {
    background-color: var(--danger-color);
    color: white;
}

.notification-info {
    background-color: var(--primary-color);
    color: white;
}

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

.notification-action {
    margin-left: 1rem;
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 0.35rem;
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.notification-action:hover {
    background-color: rgba(0, 0, 0, 0.35);
}

/* ========== LOADING STATE ========== */

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .view {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .search-section {
        flex-direction: column;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .edition-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-content {
        width: 95%;
        margin: 20% auto;
    }

    .notification {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1rem;
    }

    .main-nav {
        padding: 0.5rem;
    }

    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }

    .books-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .edition-card {
        padding: 1rem;
    }
}

/* ========== COPY EDIT FORM ========== */

.copy-edit-form {
    margin-top: 1rem;
    padding: 1.5rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
}

.edit-copy-container h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.edit-copy-form-actual {
    margin-bottom: 1.5rem;
}

.image-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 0.25rem;
    font-size: 0.8rem;
    cursor: help;
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

.btn-tiny {
    padding: 0.15rem 0.3rem;
    font-size: 0.75rem;
}

/* ========== COPY IMAGES ========== */

.copy-images-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.image-upload {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.copy-image-input {
    display: none;
}

.upload-btn {
    cursor: pointer;
}

.copy-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.copy-image-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.copy-image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.delete-image-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    background-color: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
}

.delete-image-btn:hover {
    background-color: rgb(239, 68, 68);
}

.no-images,
.loading {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

