
/* =========================================================
   Base
========================================================= */

* {
    box-sizing: border-box;
}

:root {
    font-family: "Microsoft YaHei", Arial, sans-serif;
    color: #1f2937;
    background: #f5f7fb;
}

body {
    margin: 0;
    min-width: 320px;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}


/* =========================================================
   Header
========================================================= */

.page-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.header-content {
    max-width: 1100px;
    min-height: 72px;
    margin: auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #2563eb;
    color: white;
    display: grid;
    place-items: center;
    font-size: 23px;
    font-weight: bold;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
}

.brand p {
    margin: 3px 0 0;
    font-size: 12px;
    color: #6b7280;
}

.record-counter {
    font-size: 14px;
    color: #6b7280;
}

.record-counter span {
    color: #2563eb;
    font-weight: bold;
}


/* =========================================================
   Main
========================================================= */

.container {
    width: min(100% - 32px, 1000px);
    margin: 32px auto;
}

.upload-section,
.review-section {
    margin-bottom: 32px;
}

.section-header,
.records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.section-header h2,
.records-header h2 {
    margin: 0;
    font-size: 20px;
}

.section-header p,
.records-header p {
    margin: 7px 0 0;
    color: #6b7280;
    font-size: 13px;
}

.status-badge {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 20px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
}


/* =========================================================
   Upload Card
========================================================= */

.upload-card {
    padding: 28px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.upload-header {
    margin-bottom: 20px;
}

.upload-header h3 {
    margin: 0;
    font-size: 16px;
}

.upload-header p {
    margin: 7px 0 0;
    color: #6b7280;
    font-size: 13px;
}


/* =========================================================
   Upload Area
========================================================= */

.upload-area {
    position: relative;
    min-width: 0;
    min-height: 280px;
    padding: 24px;
    border: 2px dashed #bfdbfe;
    border-radius: 10px;
    background: #f8fbff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.2s, border-color 0.2s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.upload-icon {
    color: #60a5fa;
    margin-bottom: 12px;
}

.upload-placeholder h3 {
    margin: 0;
    font-size: 16px;
}

.upload-placeholder p {
    margin: 9px 0 20px;
    color: #9ca3af;
    font-size: 13px;
}


/* =========================================================
   Image Preview
========================================================= */

.image-preview {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.image-preview img {
    display: block;
    max-width: 100%;
    max-height: 380px;
    object-fit: contain;
    border-radius: 6px;
}

.image-info {
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    color: #6b7280;
    font-size: 12px;
    overflow-wrap: anywhere;
}

.btn-remove-image {
    position: absolute;
    top: 0;
    right: 0;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #fef2f2;
    color: #dc2626;
    font-size: 21px;
}

.btn-remove-image:hover {
    background: #fee2e2;
}


/* =========================================================
   Buttons
========================================================= */

.btn {
    min-height: 40px;
    padding: 0 20px;
    border-radius: 7px;
    font-size: 14px;
}

.btn-primary {
    border: 1px solid #2563eb;
    background: #2563eb;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
}

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

.btn-secondary {
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
}

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

.btn-text {
    padding: 6px 0;
    border: none;
    background: transparent;
    color: #dc2626;
    font-size: 13px;
}

.btn-remove {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 6px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 19px;
}

.btn-remove:hover {
    background: #fee2e2;
}

.btn-add {
    align-self: flex-start;
    padding: 5px 0;
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 13px;
}

.btn-add:hover {
    color: #1d4ed8;
}


/* =========================================================
   Upload Actions
========================================================= */

.upload-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
}

.upload-actions .btn {
    min-width: 180px;
    min-height: 44px;
    font-size: 15px;
    font-weight: 600;
}

.upload-status {
    margin: 0;
    color: #9ca3af;
    font-size: 12px;
    text-align: center;
}


/* =========================================================
   Review Form
========================================================= */

.form-card {
    padding: 28px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 28px;
}

.field-group {
    min-width: 0;
}

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

.field-label {
    font-size: 14px;
    font-weight: 600;
}

.field-count {
    color: #9ca3af;
    font-size: 12px;
}

.field-rows {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.field-input {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    outline: none;
    background: #ffffff;
    color: #1f2937;
    font-size: 14px;
}

.field-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-input::placeholder {
    color: #b0b7c3;
}


/* =========================================================
   Form Actions
========================================================= */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}


/* =========================================================
   Confirmed Records
========================================================= */

.records-section {
    margin-top: 36px;
}

.records-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.empty-state {
    padding: 36px 16px;
    border: 1px dashed #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    color: #9ca3af;
    text-align: center;
    font-size: 14px;
}

.record-item {
    padding: 18px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 9px;
}

.record-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.record-title {
    font-weight: 600;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.record-meta {
    margin-top: 7px;
    color: #6b7280;
    font-size: 13px;
    overflow-wrap: anywhere;
}

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

.record-detail {
    margin-top: 12px;
}

.record-detail summary {
    color: #2563eb;
    cursor: pointer;
    font-size: 13px;
}

.record-json {
    margin-top: 10px;
    padding: 12px;
    overflow-x: auto;
    border-radius: 7px;
    background: #f3f4f6;
    font-size: 12px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.btn-delete-record {
    border: none;
    background: transparent;
    color: #dc2626;
    font-size: 13px;
}


/* =========================================================
   Footer
========================================================= */

.page-footer {
    padding: 24px 12px;
    color: #9ca3af;
    text-align: center;
    font-size: 12px;
}


/* =========================================================
   Tablet
========================================================= */

@media (max-width: 700px) {

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

    .container {
        width: calc(100% - 24px);
        margin: 24px auto;
    }

    .upload-card,
    .form-card {
        padding: 20px 16px;
    }

    .fields-grid {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .upload-area {
        min-height: 250px;
    }
}


/* =========================================================
   Mobile
========================================================= */

@media (max-width: 420px) {

    .section-header h2,
    .records-header h2 {
        font-size: 18px;
    }

    .section-header p,
    .records-header p {
        font-size: 12px;
        line-height: 1.6;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

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

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

    .record-item {
        padding: 14px;
    }

    .record-top {
        align-items: flex-start;
    }
}


/* =========================================================
   Records Actions
========================================================= */

.records-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {

    .records-header {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }

    .records-actions {
        width: 100%;
    }
}


/* =========================================================
   Camera Capture
========================================================= */

.upload-area {
    min-width: 0;
    overflow: hidden;
}

.upload-placeholder,
.camera-panel,
.image-preview {
    min-width: 0;
    max-width: 100%;
}

.upload-methods {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

/*
   摄像头面板：
   限制在上传区域内部，不能撑开父容器。
*/

.camera-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
}

.camera-video-wrap {
    width: min(100%, 640px);
    max-width: 100%;
    min-width: 0;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    background: #111827;
    border: 1px solid #d1d5db;
    flex-shrink: 1;
}

.camera-video-wrap video {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
    background: #111827;
}

.camera-status {
    width: 100%;
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
    text-align: center;
    overflow-wrap: anywhere;
}

.camera-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.camera-actions .btn {
    min-width: 130px;
}

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


/* =========================================================
   Camera Tablet
========================================================= */

@media (max-width: 700px) {

    .upload-methods {
        width: 100%;
    }

    .upload-methods .btn {
        min-width: 120px;
    }

    .camera-panel {
        width: 100%;
        max-width: 100%;
        gap: 10px;
    }

    .camera-video-wrap {
        width: 100%;
        aspect-ratio: 16 / 9;
    }

    .camera-actions {
        gap: 8px;
    }

    .camera-actions .btn {
        flex: 1 1 120px;
        max-width: 220px;
        min-width: 0;
    }
}


/* =========================================================
   Camera Mobile
========================================================= */

@media (max-width: 420px) {

    .upload-area {
        padding: 14px;
    }

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

    .upload-methods .btn {
        width: 100%;
    }

    .camera-panel {
        gap: 8px;
    }

    .camera-video-wrap {
        width: 100%;
        aspect-ratio: 4 / 3;
    }

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

    .camera-actions .btn {
        width: 100%;
        max-width: none;
        min-width: 0;
    }
}
