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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #f5f5f5;
    min-width: 960px;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-width: 960px;
}

/* 헤더 */
.header {
    background: #2c3e50;
    color: white;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: white;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

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

/* 버튼 */
.btn-primary, .btn-secondary, .btn-help {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-secondary {
    background: #ecf0f1;
    color: #2c3e50;
}

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

.btn-help {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border-radius: 50%;
}

.btn-help:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    transform: scale(1.1);
}

/* 파일 정보 */
.file-info {
    background: white;
    padding: 12px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.info-item {
    display: flex;
    gap: 8px;
}

.info-item .label {
    font-weight: 600;
    color: #7f8c8d;
}

.info-item .value {
    color: #2c3e50;
}

.backup-notice {
    flex: 1 1 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #e3f2fd;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 4px;
    border-left: 4px solid #2196f3;
}

.notice-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.notice-text {
    color: #1565c0;
    font-size: 13px;
    font-weight: 500;
}

/* 메인 컨텐츠 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 탭 */
.tabs {
    background: white;
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    padding: 0 24px;
}

.tab {
    padding: 14px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab:hover {
    color: #3498db;
}

.tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
}

/* 검색 바 */
.search-bar {
    padding: 16px 24px;
    background: white;
    display: flex;
    gap: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.search-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
}

/* 탭 컨텐츠 */
.tab-content {
    display: none;
    flex: 1;
    overflow: auto;
    padding: 24px;
}

.tab-content.active {
    display: block;
}

/* 테이블 */
.data-table {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

thead {
    background: #ecf0f1;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #bdc3c7;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #ecf0f1;
}

th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

th.sortable:hover {
    background: #d5dbdb;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid #ecf0f1;
}

tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

tr:last-child td {
    border-bottom: none;
}

/* 웰컴 스크린 */
.welcome-screen {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.welcome-content {
    text-align: center;
    color: white;
    max-width: 600px;
    padding: 40px;
}

.welcome-content h2 {
    font-size: 32px;
    margin-bottom: 16px;
}

.welcome-content > p {
    font-size: 16px;
    margin-bottom: 32px;
    opacity: 0.9;
}

.web-version-notice {
    background: rgba(255,255,255,0.2);
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px !important;
    backdrop-filter: blur(10px);
}

.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 48px;
}

.feature {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.feature h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.feature p {
    font-size: 13px;
    opacity: 0.8;
}

/* 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    max-height: 80vh;
    overflow: auto;
    padding: 32px;
    position: relative;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 32px;
}

.modal-close:hover {
    color: #2c3e50;
}

#detailContent {
    line-height: 1.8;
}

#detailContent h3 {
    color: #2c3e50;
    margin-top: 20px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ecf0f1;
}

#detailContent p {
    margin-bottom: 8px;
}

#detailContent strong {
    color: #7f8c8d;
    display: inline-block;
    min-width: 150px;
}

/* 유틸리티 */
.hidden {
    display: none !important;
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* 배지 */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* 책 표지 이미지 */
.book-cover-thumb {
    width: 60px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: block;
}

.book-cover-placeholder {
    width: 60px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    font-size: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.book-cover-large {
    width: 200px;
    height: auto;
    max-height: 300px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.book-cover-zoom-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.book-cover-zoom-icon {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
    pointer-events: none;
}

.book-cover-large-placeholder {
    width: 200px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    font-size: 72px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* 이미지 뷰어 모달 */
.image-viewer-modal {
    background: rgba(0, 0, 0, 0.9);
}

.image-viewer-content {
    background: transparent;
    border-radius: 0;
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.image-viewer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: white;
    padding: 8px;
    width: 48px;
    height: 48px;
    line-height: 32px;
    border-radius: 50%;
    z-index: 1001;
    transition: background 0.2s;
}

.image-viewer-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

#imageViewerContainer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px 20px;
}

.image-size-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px;
    border-radius: 8px;
}

.image-size-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.image-size-preview {
    width: 56px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
}

.image-size-option.selected .image-size-preview {
    border-color: white;
}

.image-size-label {
    margin-top: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 999px;
    background: transparent;
    transition: all 0.2s;
}

.image-size-option.selected .image-size-label {
    color: white;
    background: rgba(255, 255, 255, 0.25);
}

.image-viewer-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-height: calc(100vh - 140px);
}

.image-viewer-main img {
    max-width: 90%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.image-viewer-loading {
    color: white;
    font-size: 16px;
}

.image-viewer-error {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* 좁은 화면 안내 */
@media (max-width: 959px) {
    body::before {
        content: '💡 권장 화면 너비: 960px 이상';
        position: fixed;
        top: 70px;
        left: 50%;
        transform: translateX(-50%);
        background: #ff9800;
        color: white;
        padding: 8px 16px;
        border-radius: 6px;
        font-size: 12px;
        z-index: 9999;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        white-space: nowrap;
    }
}
