/* ============================================================
   AI证件资料智能预审系统 - 样式表
   ============================================================ */

/* --- CSS Variables --- */
:root {
    --color-primary: #2563EB;
    --color-primary-light: #3B82F6;
    --color-primary-bg: #EFF6FF;
    --color-success: #16A34A;
    --color-success-bg: #F0FDF4;
    --color-warning: #D97706;
    --color-warning-bg: #FFFBEB;
    --color-error: #DC2626;
    --color-error-bg: #FEF2F2;
    --color-info: #0891B2;
    --color-info-bg: #ECFEFF;

    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-border: #E2E8F0;
    --color-text: #1E293B;
    --color-text-secondary: #64748B;
    --color-text-muted: #94A3B8;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.08), 0 4px 10px rgba(0,0,0,0.04);

    --transition: 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* --- Header --- */
.header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-primary);
}
.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--color-primary-bg);
    color: var(--color-primary);
}
.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* --- Main Layout --- */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 24px;
    min-height: calc(100vh - 73px);
    align-items: start;
}

@media (max-width: 900px) {
    .main {
        grid-template-columns: 1fr;
    }
}

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.card-title {
    font-size: 17px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.card-icon {
    color: var(--color-primary);
}
.card-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

/* --- Drop Zone --- */
.drop-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 16px;
}
.drop-zone:hover, .drop-zone.active {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
}
.drop-icon {
    color: var(--color-text-muted);
    margin-bottom: 10px;
}
.drop-zone.active .drop-icon {
    color: var(--color-primary);
}
.drop-text {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}
.drop-text .link {
    color: var(--color-primary);
    font-weight: 500;
}
.drop-hint {
    font-size: 12px;
    color: var(--color-text-muted);
}

/* --- File List --- */
.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.file-item-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--color-primary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    overflow: hidden;
}
.file-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.file-item-info {
    flex: 1;
    min-width: 0;
}
.file-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-item-size {
    font-size: 11px;
    color: var(--color-text-muted);
}
.file-item-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition);
    flex-shrink: 0;
}
.file-item-remove:hover {
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* --- Form Controls --- */
.options-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}
.form-group {
    margin-bottom: 12px;
}
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition);
    outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-textarea {
    resize: vertical;
}

/* --- Buttons --- */
.btn-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
}
.btn-primary {
    background: var(--color-primary);
    color: white;
    flex: 1;
    justify-content: center;
}
.btn-primary:hover:not(:disabled) {
    background: #1D4ED8;
    box-shadow: var(--shadow);
}
.btn-primary:disabled {
    background: #93C5FD;
    cursor: not-allowed;
}
.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.btn-ghost:hover {
    background: var(--color-bg);
}

/* --- Empty State --- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 40px;
    height: 100%;
    min-height: 400px;
}
.empty-state h3 {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 8px;
}
.empty-state > p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}
.empty-icon {
    color: var(--color-text-muted);
    opacity: 0.6;
}

/* --- Feature Hints --- */
.feature-hints {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 340px;
}
.hint-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--color-text-secondary);
}
.hint-icon {
    font-size: 18px;
}

/* --- Loading State --- */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    min-height: 400px;
}
.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
}
.loading-hint {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* --- Results --- */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.results-header h2 {
    font-size: 18px;
}
.results-summary {
    display: flex;
    gap: 12px;
    font-size: 13px;
}
.summary-chip {
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
}
.summary-chip.passed {
    background: var(--color-success-bg);
    color: var(--color-success);
}
.summary-chip.failed {
    background: var(--color-error-bg);
    color: var(--color-error);
}
.summary-chip.total {
    background: var(--color-bg);
    color: var(--color-text-secondary);
}

/* --- Result Card --- */
.result-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.result-card:hover {
    box-shadow: var(--shadow);
}
.result-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
}
.result-card-header:hover {
    background: var(--color-bg);
}
.result-card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.result-card-icon.pass { background: var(--color-success-bg); }
.result-card-icon.fail { background: var(--color-error-bg); }
.result-card-icon.warn { background: var(--color-warning-bg); }

.result-card-info {
    flex: 1;
    min-width: 0;
}
.result-card-title {
    font-weight: 600;
    font-size: 14px;
}
.result-card-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
}
.result-card-score {
    display: flex;
    align-items: center;
    gap: 6px;
}
.score-ring {
    position: relative;
    width: 44px;
    height: 44px;
}
.score-ring svg {
    transform: rotate(-90deg);
}
.score-value {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
}
.result-card-arrow {
    color: var(--color-text-muted);
    transition: transform var(--transition);
}
.result-card.expanded .result-card-arrow {
    transform: rotate(180deg);
}

.result-card-body {
    border-top: 1px solid var(--color-border);
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}
.result-card.expanded .result-card-body {
    max-height: 800px;
    padding: 16px 20px;
}

/* --- Issues List --- */
.issues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.issue-item {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.5;
}
.issue-item.error {
    background: var(--color-error-bg);
    border-left: 3px solid var(--color-error);
}
.issue-item.warning {
    background: var(--color-warning-bg);
    border-left: 3px solid var(--color-warning);
}
.issue-item.info {
    background: var(--color-info-bg);
    border-left: 3px solid var(--color-info);
}
.issue-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
}
.issue-content {
    flex: 1;
}
.issue-field {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
    opacity: 0.7;
}
.issue-item.error .issue-field { color: var(--color-error); }
.issue-item.warning .issue-field { color: var(--color-warning); }
.issue-item.info .issue-field { color: var(--color-info); }
.issue-message {
    font-weight: 500;
}
.issue-suggestion {
    margin-top: 4px;
    color: var(--color-text-secondary);
    font-size: 12px;
}

/* --- Extracted Info Table --- */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    font-size: 13px;
}
.info-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border);
}
.info-table td:first-child {
    width: 100px;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 12px;
}
.info-table td.value-null {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 12px;
}

/* --- Photo Spec --- */
.photo-spec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.spec-item {
    padding: 10px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.spec-label {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}
.spec-value {
    font-weight: 600;
}
.spec-value.pass { color: var(--color-success); }
.spec-value.fail { color: var(--color-error); }
.spec-value.warn { color: var(--color-warning); }

/* --- Summary Bar --- */
.result-summary-bar {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.6;
}
.result-summary-bar.valid {
    background: var(--color-success-bg);
    color: #15803D;
}
.result-summary-bar.invalid {
    background: var(--color-error-bg);
    color: #991B1B;
}

/* --- Error State --- */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    min-height: 400px;
}
.error-state h3 {
    margin-top: 16px;
    margin-bottom: 8px;
    color: var(--color-error);
}
.error-state p {
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h3 {
    font-size: 16px;
}
.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    transition: all var(--transition);
}
.modal-close:hover {
    background: var(--color-error-bg);
    color: var(--color-error);
}
.modal-body {
    padding: 20px 24px;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .main {
        padding: 16px;
        gap: 16px;
    }
    .options-row {
        grid-template-columns: 1fr;
    }
    .photo-spec-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Utility --- */
.hidden { display: none !important; }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-warning { color: var(--color-warning); }
.text-muted { color: var(--color-text-muted); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
