/* 证件复印助手 - 样式文件 */

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

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #dc2626;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
}

.hidden {
    display: none !important;
}

/* ========== 加载界面 ========== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

.loading-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.loading-content h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

.loading-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 40px;
}

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

.loading-bar {
    height: 100%;
    background: white;
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 14px;
    opacity: 0.9;
}

/* ========== 主界面 ========== */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部工具栏 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 100;
}

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

.logo {
    font-size: 18px;
    font-weight: 600;
}

.version-badge {
    background: var(--warning-color);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.ai-status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    margin-left: 8px;
}

.ai-status.ai-loading {
    background: #fef3c7;
    color: #92400e;
}

.ai-status.ai-ready {
    background: #d1fae5;
    color: #065f46;
}

.ai-status.ai-failed {
    background: #fee2e2;
    color: #991b1b;
}

.header-right {
    display: flex;
    gap: 8px;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

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

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

.btn-danger {
    color: var(--danger-color);
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fef2f2;
    border-color: var(--danger-color);
}

.btn-small {
    padding: 4px 10px;
    font-size: 12px;
}

/* 主内容区 */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 左侧预览区 */
.preview-section {
    flex: 2;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    background: var(--bg-color);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.page-count {
    font-size: 13px;
    color: var(--text-secondary);
}

.preview-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.preview-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.placeholder-hint {
    font-size: 13px;
    margin-top: 8px;
    opacity: 0.7;
}

/* A4预览页 */
.a4-page {
    width: 100%;
    max-width: 595px;
    aspect-ratio: 210/297;
    background: white;
    box-shadow: var(--shadow-lg);
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 40px;
    gap: 20px;
}

.a4-page-label {
    position: absolute;
    top: -25px;
    left: 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.id-card-slot {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border-color);
    position: relative;
    overflow: hidden;
}

.id-card-slot img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.slot-label {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 3px;
}

/* 右侧任务区 */
.tasks-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    min-width: 320px;
    max-width: 400px;
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 500;
}

.tasks-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 任务卡片 */
.task-card {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.task-card:hover {
    border-color: var(--primary-color);
}

.task-card.drag-over {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.task-card.processing {
    border-color: var(--warning-color);
}

.task-card.completed {
    border-color: var(--success-color);
}

.task-card.error {
    border-color: var(--danger-color);
}

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

.task-title {
    font-weight: 500;
    font-size: 14px;
}

.task-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

.task-status.waiting { background: #e5e7eb; color: #374151; }
.task-status.processing { background: #fef3c7; color: #92400e; }
.task-status.completed { background: #d1fae5; color: #065f46; }
.task-status.error { background: #fee2e2; color: #991b1b; }

.task-upload-area {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.upload-slot {
    flex: 1;
    aspect-ratio: 3/2;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
    background: white;
}

.upload-slot:hover {
    border-color: var(--primary-color);
    background: #eff6ff;
}

.upload-slot.has-image {
    border-style: solid;
}

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

.upload-slot-icon {
    font-size: 24px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.upload-slot-text {
    font-size: 11px;
    color: var(--text-secondary);
}

.upload-slot-label {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.9);
    padding: 1px 4px;
    border-radius: 2px;
}

.task-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.task-actions .btn {
    padding: 4px 10px;
    font-size: 12px;
    flex: 1;
    justify-content: center;
}

/* ========== 弹窗 ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.modal-body hr {
    margin: 15px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

.disclaimer {
    font-size: 13px;
    color: var(--text-secondary);
    background: #fffbeb;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid var(--warning-color);
}

/* 手动校正 */
.correction-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.tab {
    padding: 8px 20px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

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

.correction-canvas-container {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: center;
}

#correction-canvas {
    max-width: 100%;
    max-height: 500px;
    border: 1px solid var(--border-color);
    cursor: crosshair;
    background: white;
}

.correction-instructions {
    margin-top: 10px;
    text-align: left;
}

.correction-instructions p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.correction-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========== 响应式 - 手机端 ========== */
@media (max-width: 768px) {
    body {
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .app {
        height: auto;
        min-height: 100vh;
    }

    .header {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-left {
        flex-wrap: wrap;
        gap: 6px;
    }

    .logo {
        font-size: 16px;
    }

    .version-badge {
        font-size: 10px;
        padding: 1px 6px;
    }

    .ai-status {
        font-size: 10px;
        padding: 1px 6px;
        margin-left: 4px;
    }

    .header-right {
        gap: 6px;
    }

    .header-right .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    .main-content {
        flex-direction: column;
        height: auto;
    }

    .preview-section {
        flex: none;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        min-height: 50vh;
    }

    .preview-header {
        padding: 8px 12px;
        font-size: 14px;
    }

    .preview-container {
        padding: 12px;
        gap: 12px;
    }

    .tasks-section {
        flex: none;
        max-width: none;
        min-width: auto;
        min-height: 40vh;
    }

    .tasks-header {
        padding: 8px 12px;
        font-size: 14px;
    }

    .tasks-list {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: auto;
        padding: 8px;
    }

    .task-card {
        min-width: auto;
        width: 100%;
    }

    .task-upload-area {
        gap: 6px;
    }

    .upload-slot {
        aspect-ratio: 4/3;
    }

    .upload-slot-icon {
        font-size: 20px;
    }

    .upload-slot-text {
        font-size: 10px;
    }

    .task-actions {
        gap: 4px;
    }

    .task-actions .btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .a4-page {
        padding: 15px;
        max-width: 100%;
    }

    .a4-page-label {
        font-size: 10px;
        top: -20px;
    }

    .placeholder-icon {
        font-size: 48px;
    }

    /* 弹窗适配 */
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-large {
        max-width: 95%;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-header h3 {
        font-size: 16px;
    }

    .modal-body {
        padding: 12px;
    }

    .correction-tabs {
        gap: 6px;
    }

    .tab {
        padding: 6px 14px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }

    .correction-canvas-container {
        padding: 10px;
    }

    #correction-canvas {
        max-height: 350px;
    }

    .correction-instructions p {
        font-size: 12px;
    }

    .correction-actions {
        flex-direction: column;
    }

    .correction-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* 加载界面适配 */
    .loading-content {
        padding: 20px;
        max-width: 300px;
    }

    .loading-logo {
        font-size: 60px;
    }

    .loading-content h1 {
        font-size: 24px;
    }

    .loading-subtitle {
        font-size: 14px;
    }
}

/* 小屏幕手机 */
@media (max-width: 480px) {
    .header-right .btn span {
        display: none;
    }

    .header-right .btn {
        padding: 6px 8px;
    }

    .task-actions .btn {
        font-size: 10px;
        padding: 4px 6px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

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

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}
