/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    background: #fff;
    position: relative;
}

/* 按钮样式 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #007AFF;
    color: white;
}

.btn-primary:hover {
    background: #0056CC;
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

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

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-success:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* 登录页面样式 */
.login-container {
    padding: 40px 20px;
    text-align: center;
}

.logo {
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 28px;
    color: #007AFF;
    margin-bottom: 8px;
}

.logo p {
    font-size: 16px;
    color: #666;
}

.login-form {
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007AFF;
}

.login-form .btn {
    width: 100%;
    margin-top: 20px;
}

.demo-accounts {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    text-align: left;
}

.demo-accounts h3 {
    margin-bottom: 16px;
    color: #333;
    font-size: 18px;
}

.account-item {
    margin-bottom: 12px;
    padding: 8px 0;
    font-size: 14px;
    color: #666;
}

.account-item strong {
    color: #333;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 20px;
    color: #007AFF;
    flex: 1;
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #666;
}

/* 算法列表页面样式 */
.algorithms-container {
    padding: 20px;
}

.user-permission {
    margin-bottom: 30px;
    text-align: center;
}

.user-permission h2 {
    font-size: 18px;
    margin-bottom: 12px;
    color: #333;
}

.permission-badge {
    display: inline-block;
    padding: 8px 16px;
    background: #007AFF;
    color: white;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.algorithms-list h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
}

.algorithm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
}

.algorithm-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.algorithm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: #007AFF;
}

.algorithm-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.algorithm-card h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #333;
}

.algorithm-card p {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* 无权限算法卡片样式 */
.algorithm-card-disabled {
    background: #f8f9fa;
    border-color: #e9ecef;
    opacity: 0.6;
    cursor: not-allowed;
    position: relative;
}

.algorithm-card-disabled:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #e9ecef;
}

.algorithm-card-disabled .algorithm-icon,
.algorithm-card-disabled h3,
.algorithm-card-disabled p {
    color: #999;
}

.no-permission {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 500;
}

/* 演示页面样式 */
.demo-container {
    padding: 20px;
}

.camera-section {
    margin-bottom: 30px;
}

.camera-preview {
    width: 100%;
    height: 240px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.camera-placeholder {
    text-align: center;
    color: #666;
}

.camera-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.camera-feed {
    width: 100%;
    height: 100%;
    position: relative;
}

.camera-feed img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #007AFF;
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

.camera-status {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.status-item:last-child {
    margin-bottom: 0;
}

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

.status-value {
    font-size: 14px;
    font-weight: 500;
}

.status-good {
    color: #28a745;
}

.status-bad {
    color: #dc3545;
}

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

.camera-controls .btn {
    flex: 1;
    max-width: 120px;
}

/* 结果页面样式 */
.result-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
}

.result-section h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

.result-item {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.result-image {
    margin-bottom: 16px;
    text-align: center;
}

.result-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-item h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.sku-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sku-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.sku-name {
    font-weight: 500;
    color: #333;
}

.sku-confidence {
    font-size: 12px;
    color: #007AFF;
}

.detection-box,
.carrier-info,
.display-analysis {
    line-height: 1.6;
}

.detection-box p,
.carrier-info p,
.display-analysis p {
    margin-bottom: 8px;
    font-size: 14px;
}

.detection-box strong,
.carrier-info strong,
.display-analysis strong {
    color: #333;
}

.result-section .btn {
    width: 100%;
    margin-top: 20px;
}

/* 拍摄结果样式 */
.captured-image {
    margin-bottom: 20px;
}

.captured-photo {
    text-align: center;
}

.captured-photo img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    margin-bottom: 12px;
}

.photo-info {
    font-size: 14px;
    color: #666;
    margin: 0;
}

.upload-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.upload-controls .btn {
    flex: 1;
    margin-top: 0;
}

.recognition-results {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        max-width: 100%;
        margin: 0 10px;
    }
    
    .algorithm-grid {
        grid-template-columns: 1fr;
    }
    
    .camera-controls {
        flex-direction: column;
    }
    
    .camera-controls .btn {
        max-width: none;
    }
}

@media (max-width: 375px) {
    .container {
        margin: 0 5px;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-container,
.algorithms-container,
.demo-container {
    animation: fadeIn 0.5s ease-out;
}

/* 加载状态 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007AFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
} 