/* ========================================
   Book Scanner - Main Stylesheet
   ======================================== */

/* CSS Variables */
:root {
    --color-primary: #2196F3;
    --color-primary-dark: #1976D2;
    --color-success: #4CAF50;
    --color-warning: #FF9800;
    --color-error: #F44336;
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-text: #212121;
    --color-text-secondary: #757575;
    --color-border: #e0e0e0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

/* App Container */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.header__title {
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary);
}

.header__controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Main Content */
.main {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 16px;
    padding: 16px;
}

/* Preview Section */
.preview-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.preview-container {
    position: relative;
    flex: 1;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#cameraPreview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.camera-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
}

.camera-status.hidden {
    display: none;
}

.processed-preview {
    height: 200px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}

.processed-preview h3 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--color-text-secondary);
}

#processedCanvas {
    width: 100%;
    height: calc(100% - 30px);
    object-fit: contain;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
}

/* Settings Panel */
.settings-panel {
    width: 300px;
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    flex-shrink: 0;
}

.settings-group {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.settings-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-group h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.setting-item {
    margin-bottom: 12px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--color-text);
}

.setting-item--checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-item--checkbox label {
    margin-bottom: 0;
    cursor: pointer;
}

.trigger-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding: 8px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-error);
}

.status-dot.connected {
    background: var(--color-success);
}

/* Thumbnail Section */
.thumbnail-section {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 12px 16px;
}

.thumbnail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.thumbnail-header h3 {
    font-size: 14px;
    font-weight: 500;
}

#pageCount {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.thumbnail-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0;
    min-height: 100px;
}

.thumbnail-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 100px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    transition: var(--transition);
}

.thumbnail-item:hover {
    border-color: var(--color-primary);
}

.thumbnail-item.selected {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.3);
}

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

.thumbnail-item__number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 2px;
}

.thumbnail-item__delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    background: var(--color-error);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.thumbnail-item:hover .thumbnail-item__delete {
    display: flex;
}

/* Footer */
.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.footer__left {
    flex: 1;
    max-width: 300px;
}

.footer__right {
    display: flex;
    gap: 8px;
}

/* Form Elements */
.input, .select {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: var(--transition);
}

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

/* Camera select wrapper */
.camera-select-wrapper {
    display: flex;
    gap: 4px;
    align-items: center;
}

.camera-select-wrapper .select {
    flex: 1;
}

.camera-select-wrapper .btn--icon {
    flex-shrink: 0;
}

.slider {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 2px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition);
}

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

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

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

.btn--primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
}

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

.btn--success:hover:not(:disabled) {
    background: #43A047;
}

.btn--icon {
    padding: 8px;
    border-radius: 50%;
}

.btn--small {
    padding: 4px 8px;
    font-size: 11px;
}

.btn--large {
    width: 100%;
    padding: 12px 20px;
    font-size: 15px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

.modal__content {
    background: var(--color-surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.modal__content h2 {
    margin-bottom: 16px;
    font-size: 18px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: #323232;
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
    max-width: 300px;
}

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

.toast--error {
    background: var(--color-error);
}

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

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Drag & Drop */
.thumbnail-item.dragging {
    opacity: 0.5;
}

.thumbnail-item.drag-over {
    border-color: var(--color-success);
    background: rgba(76, 175, 80, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .main {
        flex-direction: column;
    }

    .settings-panel {
        width: 100%;
        max-height: 200px;
    }

    .preview-section {
        flex: none;
        height: 50vh;
    }

    .processed-preview {
        display: none;
    }
}

@media (max-width: 600px) {
    .header {
        padding: 8px 12px;
    }

    .header__title {
        font-size: 16px;
    }

    .main {
        padding: 8px;
    }

    .settings-panel {
        padding: 12px;
    }

    .footer {
        flex-direction: column;
        gap: 8px;
    }

    .footer__left {
        max-width: none;
        width: 100%;
    }

    .footer__right {
        width: 100%;
    }

    .footer__right .btn {
        flex: 1;
    }
}

/* Overlay Controls */
.overlay-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.btn--overlay {
    padding: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: var(--radius-sm);
}

.btn--overlay:hover {
    background: rgba(0, 0, 0, 0.8);
}

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

/* Processed Preview Header & Toolbar */
.processed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.processed-header h3 {
    margin-bottom: 0;
}

.edit-toolbar {
    display: flex;
    gap: 4px;
    align-items: center;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--color-border);
    margin: 0 4px;
}

.processed-canvas-wrapper {
    position: relative;
    height: calc(100% - 30px);
}

.processed-canvas-wrapper canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.processed-canvas-wrapper .overlay-canvas {
    pointer-events: auto;
}

/* Warning Button */
.btn--warning {
    background: var(--color-warning);
    border-color: var(--color-warning);
    color: white;
}

.btn--warning:hover:not(:disabled) {
    background: #F57C00;
}

/* Danger Button */
.btn--danger {
    background: var(--color-error);
    border-color: var(--color-error);
    color: white;
}

.btn--danger:hover:not(:disabled) {
    background: #D32F2F;
}

/* Wide Modal */
.modal__content--wide {
    max-width: 500px;
}

.modal__content--large {
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal__description {
    color: var(--color-text-secondary);
    font-size: 13px;
    margin-bottom: 16px;
}

/* Reprocess Options */
.reprocess-options {
    display: grid;
    gap: 12px;
}

.reprocess-options .setting-item--checkbox {
    margin-bottom: 8px;
}

/* Correction Preview */
.correction-preview {
    flex: 1;
    min-height: 400px;
    background: #f0f0f0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.correction-preview canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Page Detail Modal */
.page-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.page-detail-header h2 {
    margin-bottom: 0;
}

.page-detail-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 400px;
}

.page-detail-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.page-detail-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ROI Selector Active State */
.overlay-canvas.roi-active {
    cursor: crosshair;
    pointer-events: auto;
}

/* Edge Detection Status */
.edge-status {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 11px;
}

/* Guide Preset Active Indicator */
.guide-indicator {
    position: absolute;
    bottom: 10px;
    left: 10px;
    padding: 4px 8px;
    background: rgba(33, 150, 243, 0.8);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 11px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #121212;
        --color-surface: #1e1e1e;
        --color-text: #ffffff;
        --color-text-secondary: #b0b0b0;
        --color-border: #333333;
    }

    .input, .select {
        background: #2a2a2a;
        border-color: #444;
        color: white;
    }

    .slider {
        background: #444;
    }

    .correction-preview,
    .page-detail-content {
        background: #2a2a2a;
    }
}

/* ========================================
   View System - 뷰 기반 네비게이션
   ======================================== */

.view-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.view {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
}

.view.active {
    display: flex;
}

/* ========================================
   List View - 프로젝트 목록 (랜딩 페이지)
   ======================================== */

.view--list {
    padding: 24px;
    overflow-y: auto;
    background: var(--color-bg);
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.list-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.project-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.project-card__thumbnail {
    width: 100%;
    height: 160px;
    background: linear-gradient(135deg, #e0e0e0 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.project-card__thumbnail svg {
    width: 64px;
    height: 64px;
    color: var(--color-text-secondary);
    opacity: 0.5;
}

.project-card__info {
    padding: 16px;
}

.project-card__name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.project-card__meta {
    font-size: 12px;
    color: var(--color-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.project-card--new {
    border: 2px dashed var(--color-border);
    background: transparent;
    box-shadow: none;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.project-card--new:hover {
    border-color: var(--color-primary);
    background: rgba(33, 150, 243, 0.05);
    transform: none;
}

.project-card__icon {
    font-size: 48px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    line-height: 1;
}

.project-card__label {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.list-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.list-empty p {
    font-size: 16px;
    margin-bottom: 16px;
}

/* ========================================
   Capture View - 촬영 모드 (55:45 레이아웃)
   ======================================== */

.view--capture {
    flex-direction: column;
    overflow: hidden;
}

.capture-layout {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px;
    min-height: 0;
    overflow: hidden;
}

.capture-camera {
    flex: 0 0 55%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.capture-camera .preview-container {
    flex: 1;
    min-height: 0;
}

.capture-processed {
    flex: 0 0 45%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* 처리된 이미지 프리뷰 - 전체 높이 사용 */
.capture-processed .processed-preview {
    flex: 1;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.capture-processed .processed-canvas-wrapper {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: var(--radius-sm);
}

.capture-processed .processed-canvas-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 설정 드로어 (슬라이드 패널) */
.settings-drawer {
    position: fixed;
    right: 0;
    top: 60px;
    bottom: 0;
    width: 300px;
    background: var(--color-surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
    overflow-y: auto;
}

.settings-drawer.open {
    transform: translateX(0);
}

.settings-drawer__toggle {
    position: absolute;
    left: -44px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 88px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}

.settings-drawer__toggle svg {
    transition: transform 0.3s;
}

.settings-drawer.open .settings-drawer__toggle svg {
    transform: rotate(180deg);
}

.settings-drawer__content {
    padding: 16px;
}

/* 캡처 컨트롤 바 */
.capture-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.btn--capture-large {
    padding: 14px 48px;
    font-size: 16px;
    font-weight: 600;
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    border-radius: var(--radius-lg);
}

.btn--capture-large:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: scale(1.02);
}

.btn--exit {
    padding: 14px 24px;
    font-size: 14px;
}

/* 컴팩트 썸네일 스트립 */
.thumbnail-strip {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 8px 16px;
}

.thumbnail-strip .thumbnail-header {
    margin-bottom: 4px;
}

.thumbnail-strip .thumbnail-gallery {
    min-height: 80px;
}

.thumbnail-strip .thumbnail-item {
    width: 60px;
    height: 75px;
}

/* ========================================
   헤더 수정 - 뒤로가기 버튼
   ======================================== */

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

.header__back {
    display: none;
    padding: 8px;
    border-radius: 50%;
}

.header__back.visible {
    display: flex;
}

.header__project-name {
    font-size: 14px;
    color: var(--color-text-secondary);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================
   반응형 - Capture View
   ======================================== */

@media (max-width: 1024px) {
    .capture-layout {
        flex-direction: column;
    }

    .capture-camera,
    .capture-processed {
        flex: none;
        width: 100%;
    }

    .capture-camera {
        height: 45%;
    }

    .capture-processed {
        height: 55%;
    }

    .settings-drawer {
        width: 100%;
        height: 60%;
        top: auto;
        bottom: 0;
        transform: translateY(100%);
    }

    .settings-drawer.open {
        transform: translateY(0);
    }

    .settings-drawer__toggle {
        left: 50%;
        top: -44px;
        transform: translateX(-50%);
        width: 88px;
        height: 44px;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
        border: 1px solid var(--color-border);
        border-bottom: none;
    }
}

@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .project-card__thumbnail {
        height: 120px;
    }

    .capture-layout {
        padding: 8px;
        gap: 8px;
    }

    .capture-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn--capture-large {
        flex: 1;
        min-width: 150px;
    }
}

/* 다크 모드 - List View */
@media (prefers-color-scheme: dark) {
    .project-card__thumbnail {
        background: linear-gradient(135deg, #2a2a2a 0%, #1e1e1e 100%);
    }

    .capture-processed .processed-canvas-wrapper {
        background: #2a2a2a;
    }
}

/* ========================================
   추가 스타일 - 뷰 시스템 보완
   ======================================== */

/* 프로젝트 빈 상태 */
.project-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
    text-align: center;
    grid-column: 1 / -1;
}

.project-empty svg {
    margin-bottom: 16px;
    opacity: 0.3;
}

.project-empty p {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-text);
}

.project-empty span {
    font-size: 14px;
}

/* 설정 오버레이 */
.settings-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

.settings-overlay.active {
    display: block;
}

/* 설정 드로어 헤더 */
.settings-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--color-border);
}

.settings-drawer__header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* 캡처 뷰 썸네일 섹션 */
.capture-thumbnails {
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    padding: 12px 16px;
}

.capture-thumbnails .thumbnail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.capture-thumbnails .thumbnail-header h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
}

.capture-thumbnails .thumbnail-gallery {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    min-height: 90px;
}

/* 캡처 뷰 푸터 */
.capture-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.capture-footer .footer__left {
    flex: 1;
    max-width: 300px;
}

.capture-footer .footer__right {
    display: flex;
    gap: 8px;
}

/* 프로젝트 카드 썸네일 래퍼 */
.project-card__thumbnail-wrapper {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.project-card__thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 프로젝트 카드 삭제 버튼 */
.project-card__delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.project-card:hover .project-card__delete {
    opacity: 1;
}

.project-card__delete:hover {
    background: var(--color-error);
    color: white;
}

/* 프로젝트 카드 position relative for delete button */
.project-card {
    position: relative;
}

/* 프로젝트 카드 제목 */
.project-card__title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 프로젝트 카드 페이지 수 */
.project-card__pages {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* 프로젝트 카드 날짜 */
.project-card__date {
    font-size: 11px;
    color: var(--color-text-secondary);
}

/* 캡처 버튼 레이아웃 */
.btn--capture-large {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn--capture-large svg {
    flex-shrink: 0;
}

/* 설정 그룹 h4 스타일 */
.settings-group h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}
