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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    display: flex;
    height: 100vh;
    padding: 20px;
    gap: 20px;
}

/* 侧边栏 */
.sidebar {
    width: 300px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    overflow-y: auto;
}

.sidebar h2 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 8px;
}

.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 5px;
}

.control-group span {
    display: inline-block;
    background: #f0f0f0;
    padding: 2px 10px;
    border-radius: 4px;
    font-weight: bold;
    color: #667eea;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

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

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

hr {
    border: none;
    border-top: 2px solid #eee;
    margin: 20px 0;
}

/* 统计信息 */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: #667eea;
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.panel h3 {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

/* 3D Canvas */
#canvas-container {
    width: 100%;
    height: 400px;
    background: #1a1a2e;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

#canvas-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.canvas-controls {
    text-align: center;
    margin-top: 10px;
    color: #666;
    font-size: 0.9rem;
}

/* 条码列表 */
.barcode-list {
    max-height: 300px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.barcode-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.barcode-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
}

.barcode-item .index {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
}

.barcode-item .status {
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 12px;
}

.status-success {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    overflow-y: auto;
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 1000px;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

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

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: #667eea;
}

/* 详情页面 */
.detail-section {
    margin-bottom: 30px;
}

.detail-section h3 {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #667eea;
}

/* 三视图 */
.three-views {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.three-views > div {
    text-align: center;
}

.three-views h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
}

.three-views canvas {
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    max-width: 100%;
}

/* 解码结果 */
.decode-result {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

.decode-result > div {
    margin-bottom: 15px;
}

.decode-result label {
    font-weight: 600;
    color: #555;
    margin-right: 10px;
}

.code-display {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    max-width: 300px;
    display: inline-block;
    word-break: break-all;
}

.status-badge {
    padding: 5px 15px;
    border-radius: 12px;
    font-weight: bold;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.error {
    background: #f8d7da;
    color: #721c24;
}

/* 调试信息 */
.debug-info {
    background: #1a1a2e;
    color: #00ff00;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* 日志容器 */
.log-content {
    max-width: 800px;
}

.log-container {
    background: #1a1a2e;
    color: #00ff00;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    max-height: 500px;
    overflow-y: auto;
}

.log-entry {
    margin-bottom: 5px;
    padding: 5px;
    border-bottom: 1px solid #333;
}

.log-entry.timestamp {
    color: #888;
}

.log-entry.level-INFO {
    color: #00ff00;
}

.log-entry.level-WARNING {
    color: #ffaa00;
}

.log-entry.level-ERROR {
    color: #ff4444;
}

/* 加载遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 20px;
    color: white;
    font-size: 1.1rem;
}

/* 响应式 */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
    }

    .three-views {
        grid-template-columns: 1fr;
    }
}
