/* 教辅信息收集工具 - 样式文件 */

/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    margin-top: 20px;
    margin-bottom: 20px;
}

/* ==================== 头部样式 ==================== */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}

.subtitle {
    color: #666;
    font-size: 14px;
}

/* ==================== 表单样式 ==================== */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    position: relative;
}

/* 帮助图标样式 */
.help-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #667eea;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    margin-left: 6px;
    vertical-align: middle;
    transition: all 0.3s ease;
    user-select: none;
}

.help-icon:hover {
    background: #5568d3;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.help-icon:active {
    transform: scale(0.95);
}

.required {
    color: #ff4757;
    margin-left: 4px;
}

.optional {
    color: #999;
    font-weight: normal;
    font-size: 12px;
    margin-left: 4px;
}

/* 输入框样式 */
input[type="text"],
input[type="tel"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="tel"]:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

input[type="text"]:invalid,
input[type="tel"]:invalid {
    border-color: #ff4757;
}

/* ISBN输入组样式 */
.isbn-input-group {
    display: flex;
    gap: 12px;
}

.isbn-input-group input {
    flex: 1;
}

.scan-btn {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.scan-btn:hover {
    background: #5568d3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.scan-btn:active {
    transform: translateY(0);
}

.scan-icon {
    font-size: 16px;
}

.hint {
    display: block;
    color: #999;
    font-size: 12px;
    margin-top: 6px;
}

/* ==================== 上传区域样式 ==================== */
.upload-area {
    position: relative;
}

.upload-placeholder {
    border: 2px dashed #d0d0d0;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
}

.upload-placeholder:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.upload-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.upload-placeholder p {
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.upload-placeholder small {
    color: #999;
    font-size: 12px;
}

/* 上传操作按钮组 */
.upload-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.upload-action-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 120px;
    justify-content: center;
}

.upload-action-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.upload-action-btn:active {
    transform: translateY(0);
}

.upload-action-btn span {
    font-size: 16px;
}

.upload-preview {
    position: relative;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
}

.upload-preview img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
    object-fit: contain;
}

.remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 71, 87, 0.9);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.remove-btn:hover {
    background: rgba(255, 71, 87, 1);
    transform: scale(1.1);
}

/* 上传进度条 */
.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px;
    color: white;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
    position: relative;
}

.progress-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: #4ade80;
    width: var(--progress-width, 0%);
    transition: width 0.3s ease;
    border-radius: 3px;
}

.progress-text {
    font-size: 12px;
    display: block;
    text-align: center;
}

/* ==================== 错误提示样式 ==================== */
.error-message {
    display: block;
    color: #ff4757;
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
}

/* ==================== 提交按钮样式 ==================== */
.submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 8px;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==================== 消息提示框样式 ==================== */
.message-box {
    margin-top: 24px;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    animation: slideDown 0.3s ease;
}

.message-box.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message-box.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

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

/* ==================== 帮助弹窗样式 ==================== */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.help-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.help-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.help-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.help-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.help-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.help-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.help-image-container {
    text-align: center;
}

.help-image-container img {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 16px;
}

.help-image-note {
    color: #666;
    font-size: 14px;
    margin: 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.help-steps {
    margin-top: 20px;
    text-align: left;
}

.help-steps-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.help-steps-list {
    margin: 0;
    padding-left: 24px;
    color: #555;
    font-size: 14px;
    line-height: 1.8;
}

.help-steps-list li {
    margin-bottom: 8px;
}

.help-steps-list li:last-child {
    margin-bottom: 0;
}

/* ==================== 拍照弹窗样式 ==================== */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.camera-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.camera-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.camera-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.camera-close-btn:hover {
    color: #333;
}

.camera-modal-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.camera-area {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4; /* 竖版比例，适合书籍封面（高:宽 = 4:3，即高度是宽度的1.33倍） */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    max-width: 400px; /* 限制最大宽度，避免在桌面端过宽 */
    margin-left: auto;
    margin-right: auto;
}

.camera-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.camera-canvas {
    display: none;
}

.camera-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.camera-actions .btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.camera-actions .btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.camera-actions .btn-secondary:hover {
    background: #e0e0e0;
}

.camera-actions .btn-primary {
    background: #667eea;
    color: white;
}

.camera-actions .btn-primary:hover {
    background: #5568d3;
}

.camera-actions .btn-success {
    background: #4ade80;
    color: white;
    font-size: 16px;
}

.camera-actions .btn-success:hover {
    background: #22c55e;
}

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

.scan-modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.scan-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scan-modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.scan-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.scan-close-btn:hover {
    color: #333;
}

.scan-modal-body {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.scan-area {
    position: relative;
    width: 100%;
    max-width: 90%; /* 限制最大宽度，左右留白 */
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto 20px auto; /* 居中显示，左右自动留白 */
    min-height: 300px;
}

/* QuaggaJS 自动创建的 video 元素 */
.scan-area video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* QuaggaJS 自动创建的 canvas 元素 */
.scan-area canvas {
    display: none;
}

.scan-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-canvas {
    display: none;
}

.scan-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scan-line {
    width: 80%;
    height: 2px;
    background: #4ade80;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
    animation: scanLine 2s linear infinite;
}

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

.scan-hint {
    margin-top: 20px;
    color: white;
    font-size: 14px;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 4px;
}

.scan-actions {
    display: flex;
    gap: 12px;
}

.scan-actions .btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.scan-actions .btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.scan-actions .btn-secondary:hover {
    background: #e0e0e0;
}

.scan-actions .btn-primary {
    background: #667eea;
    color: white;
}

.scan-actions .btn-primary:hover {
    background: #5568d3;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 640px) {
    .container {
        padding: 24px;
        margin: 10px;
    }

    header h1 {
        font-size: 24px;
    }

    .isbn-input-group {
        flex-direction: column;
    }

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

    .scan-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

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

    .upload-action-btn {
        width: 100%;
        min-width: auto;
    }

    .camera-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .camera-area {
        max-width: 100%; /* 移动端全宽显示 */
        aspect-ratio: 3/4; /* 保持竖版比例 */
    }

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

    .camera-actions .btn {
        width: 100%;
    }
}

