
:root {
    --primary-color: #1890ff;
    --secondary-color: #f0f2f5;
    --text-color: #333;
    --light-text: #666;
    --border-color: #d9d9d9;
    --success-color: #52c41a;
    --error-color: #f5222d;
    --warning-color: #faad14;
    --info-color: #13c2c2;
    --face-color: #722ed1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f8f9fa;
    /*padding: 20px;*/
}

.camera-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.camera-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.camera-header h1 {
    font-size: 2.2rem;
    font-weight: 500;
    margin-bottom: 15px;
    display: flex;
}

/* 硬件绑定提示框样式 */
.hardware-bind-notice {
    background-color: #fff7e6;
    border: 1px solid #ffd591;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d46b08;
    font-size: 1rem;
}

.notice-content i {
    color: #faad14;
    font-size: 1.2rem;
}

.bind-link {
    color: #1890ff;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.bind-link:hover {
    background-color: #e6f7ff;
    text-decoration: underline;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.camera-header img{
     border-radius: 8px;
}

.camera-header p {
    font-size: 1rem;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.9;
}

.container-wrapper {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: flex-start;
}


.my-container {
    flex: 1;
    min-width: 300px;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.left-panel {
    flex: 1.1;
}

.right-panel {
    flex: 1;
}

.my-container h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--face-color);
    border-bottom: 2px solid var(--face-color);
    padding-bottom: 10px;
}


/* 设备选择区域 */
.device-selection-area {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.device-select-label {
    font-weight: 500;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.device-select {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    color: var(--text-color);
    transition: all 0.3s ease;
    min-width: 200px;
}

.device-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.refresh-devices-btn {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: white;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-devices-btn:hover {
    background-color: var(--secondary-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.refresh-devices-btn:active {
    transform: scale(0.95);
}

.refresh-devices-btn i {
    font-size: 1.1rem;
}

.device-live-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: #f7f7f7;
    color: #444;
    font-size: 13px;
    font-weight: 600;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.live-dot.online {
    background: var(--success-color);
    box-shadow: 0 0 0 0 rgba(82, 196, 26, 0.7);
    animation: pulse-green 1.8s infinite;
}

.live-dot.offline {
    background: #8c8c8c;
}

.live-dot.unknown {
    background: #bfbfbf;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(82, 196, 26, 0.6);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(82, 196, 26, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(82, 196, 26, 0);
    }
}

/* 图像上传区域 */
.image-upload-area {
    margin-bottom: 25px;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.upload-zone:hover {
    border-color: var(--face-color);
    background-color: #f6ffed;
}

.upload-zone.dragover {
    border-color: var(--face-color);
    background-color: #e6f3ff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--light-text);
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 8px;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--light-text);
}


.image-preview {
    position: relative;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.image-preview img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background-color: #f5f5f5;
}

.scan-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(5, 10, 30, 0.15), rgba(5, 10, 30, 0.35));
    z-index: 2;
    pointer-events: none;
}

.hardware-overlay-canvas {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.scan-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #00f6ff, transparent);
    box-shadow: 0 0 10px rgba(0, 246, 255, 0.9);
    animation: scan-move 1.2s linear infinite;
}

.scan-text {
    position: absolute;
    right: 10px;
    bottom: 10px;
    color: #d9f7ff;
    font-size: 12px;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.hardware-overlay-box {
    position: absolute;
    display: none;
    border: 2px solid #ffd54f;
    box-sizing: border-box;
    border-radius: 3px;
    z-index: 3;
}

.hardware-overlay-label {
    position: absolute;
    display: none;
    z-index: 4;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(12, 18, 32, 0.62);
    color: #ffd54f;
    text-align: center;
    white-space: normal;
    word-break: break-word;
    pointer-events: none;
}

.hardware-capture-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.hardware-capture-dialog {
    width: min(760px, 96vw);
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.hardware-capture-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.hardware-capture-tip {
    color: var(--light-text);
    margin-bottom: 12px;
}

.hardware-capture-preview-wrap {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f6f8fa;
    margin-bottom: 12px;
}

.hardware-capture-preview-wrap img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
}

@keyframes scan-move {
    0% { top: 6%; }
    100% { top: 94%; }
}

.restart {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 10px auto;
    background-color: #25cdeb;
    color: #ffffff;
}

.stop-preview-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 10px auto;
    background-color: #ff6b6b;
    color: #ffffff;
}

.stop-preview-btn:hover {
    background-color: #ee5a5a;
    transform: translateY(-2px);
}

/* 拍照按钮样式 */
.take-photo-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 10px auto;
    background-color: #ff9800;
    color: #ffffff;
}

.take-photo-btn:hover {
    background-color: #f57c00;
    transform: translateY(-2px);
}

.take-photo-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* 认证配置区域 */
.credential-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 18px 0 15px 0;
}

.settings-panel {
    margin-top: 6px;
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    background: #fcfcfc;
    padding: 10px 14px;
}

.settings-panel summary {
    list-style: none;
    cursor: pointer;
    font-weight: 600;
    color: #404040;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-panel summary::-webkit-details-marker {
    display: none;
}

.settings-panel[open] {
    background: #fff;
}

.credential-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.credential-header label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

.credential-inputs {
    margin-bottom: 20px;
}

.credential-inputs label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--text-color);
}

.credential-inputs input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: border-color 0.3s ease;
}

.credential-inputs textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 8px;
    transition: border-color 0.3s ease;
    resize: vertical;
    min-height: 96px;
}

.credential-inputs input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.credential-inputs textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

.mapping-hint {
    margin: 0 0 10px;
    color: var(--light-text);
    font-size: 12px;
    line-height: 1.5;
}

.credential-tips {
    margin-bottom: 25px;
    padding: 12px;
    background-color: #f6ffed;
    border-left: 4px solid var(--success-color);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--light-text);
}

.credential-tips a {
    color: var(--primary-color);
    text-decoration: none;
}

.credential-tips a:hover {
    text-decoration: underline;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.clear-btn, .analyze-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
}

.save-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    background-color: #28a745;
    color: #fff;
}

.save-btn:hover {
    background-color: #24963e;
    transform: translateY(-2px);
}

.clear-btn {
    background-color: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.clear-btn:hover {
    background-color: #e6f7ff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.analyze-btn {
    background-color: var(--face-color);
    color: white;
}

.analyze-btn:hover {
    background-color: #9254de;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(114, 46, 209, 0.3);
}

.analyze-btn.loading {
    position: relative;
    background-color: #5e2ea7;
    cursor: wait;
}

.analyze-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    animation: spin 1s linear infinite;
}

.analyze-btn:disabled, .clear-btn:disabled {
    background-color: #f5f5f5;
    color: #bfbfbf;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 加载动画 */
.loading {
    display: none;
    text-align: center;
    margin: 25px 0;
    padding: 20px;
    background-color: #f6ffed;
    border-radius: 8px;
    border: 1px solid #b7eb8f;
}

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid var(--face-color);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-indicator-box {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    background-color: #f0f8ff;
    color: #2c5282;
    border: 1px solid #bee3f8;
}

.status-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 12px;
    flex-shrink: 0;
}

.status-dot.info { background-color: #4299e1; }
.status-dot.success { background-color: #48bb78; }
.status-dot.warning { background-color: #ecc94b; }
.status-dot.error { background-color: #f56565; }


.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 15px 0;
}

.stat-item {
    background: #f7fbfc;
    padding: 18px;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 0 40px 40px;
    opacity: 0.1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 5px;
    display: block;
    color: #1a202c;
    word-break: break-all;
}

.stat-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 2.2rem;
    opacity: 0.2;
    color: var(--icon-color, #4299e1);
}

/* 特定结果颜色和装饰 */
.stat-item-id {
    border: 1px solid #63b3ed;
    background-color: #ebf8ff;
}
.stat-item-id .stat-icon { --icon-color: #63b3ed; }

.stat-item-name {
    border: 1px solid #48bb78;
    background-color: #f0fff4;
}
.stat-item-name .stat-icon { --icon-color: #48bb78; }

.stat-item-score {
    border: 1px solid #f6ad55;
    background-color: #fffaf0;
}
.stat-item-score .stat-icon { --icon-color: #f6ad55; }
.stat-item-score .stat-value { color: #dd6b20; }

.stat-item-time {
    border: 1px solid #a0aec0;
    background-color: #f7fafc;
}
.stat-item-time .stat-icon { --icon-color: #a0aec0; }

.history-panel {
    margin-top: 16px;
    border-top: 1px solid #eee;
    padding-top: 12px;
}

.history-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    color: #555;
}

.circular-gallery-wrapper {
    height: 320px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: radial-gradient(circle at center, #0f1d35 0%, #152238 50%, #1b1d2a 100%);
}

.circular-gallery-host {
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

.circular-gallery-host:active {
    cursor: grabbing;
}

.gallery-empty {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
}

.history-fallback-grid {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px;
}

.history-fallback-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-fallback-card.placeholder {
    opacity: 0.65;
}

.history-fallback-image {
    flex: 1;
    min-height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 12px;
    background: rgba(12, 20, 40, 0.45);
}

.history-fallback-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(12, 20, 40, 0.55);
}

.history-fallback-text {
    padding: 8px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 11px;
    line-height: 1.3;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    word-break: break-all;
}

.history-tip {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .camera-header h1 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 10px;
    }
    .container-wrapper {
        flex-direction: column;
    }

    .circular-gallery-wrapper {
        height: 250px;
    }

    .history-fallback-grid {
        grid-template-columns: 1fr;
    }
    .button-group {
        flex-direction: column;
        gap: 12px;
    }

    .credential-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .my-container {
        padding: 20px;
    }

    .header {
        padding: 20px 15px;
    }

    .upload-zone {
        padding: 30px 15px;
    }

}


/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
