/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #000;
    min-height: 100vh;
    color: #333;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* AR识别界面 */
.ar-interface {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 1000;
    display: block;
}

.ar-interface #cameraVideo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ar-interface #arCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* AR顶部控制栏 */
.ar-top-controls {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 1001;
}

.ar-top-controls .btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.ar-top-controls .btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(255, 255, 255, 0.5);
}

/* AR视图切换按钮 */
.ar-view-buttons {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1001;
}

.view-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.view-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.view-btn.active {
    background: rgba(102, 126, 234, 0.8);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* 轮廓线按钮样式 */
.ar-outline-button {
    position: absolute;
    right: 1rem;
    top: calc(50% + 220px); /* 在视图按钮下方 */
    z-index: 1001;
}

.outline-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.outline-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.outline-btn.active {
    background: rgba(102, 126, 234, 0.8);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* 触摸手势提示 */
.touch-hints {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2rem;
    z-index: 1001;
}

.hint-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    background: rgba(0, 0, 0, 0.7);
    padding: 1rem;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.hint-item i {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.hint-item span {
    font-size: 0.9rem;
    text-align: center;
}

/* 识别开关按钮 */
.recognition-toggle-btn {
    background: linear-gradient(135deg, #38a169 0%, #68d391 100%);
    color: white;
    border: 2px solid #38a169;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    min-width: 120px;
    justify-content: center;
}

.recognition-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.4);
}

.recognition-toggle-btn.stop {
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
    border-color: #e53e3e;
}

.recognition-toggle-btn.stop:hover {
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.4);
}

/* 识别状态提示 */
.recognition-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.8);
    padding: 2rem;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-text {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.status-indicator {
    display: flex; 
    justify-content: center;
}

.pulse {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
    
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* 管理界面 */
.manage-interface {
    display: block;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow-y: auto;
}

.manage-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.manage-header h1 {
    color: #667eea;
    font-size: 1.8rem;
    font-weight: 600;
}

.manage-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    color: #667eea;
    font-size: 1.8rem;
    font-weight: 600;
}

.header nav {
    display: flex;
    gap: 1rem;
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-secondary:hover {
    background: #667eea;
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* 主要内容区域 */
.main-content {
    flex: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* 统计面板 */
.stats-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-card {
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 3rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.stat-card h3 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.stat-card p {
    color: #666;
    font-size: 1.1rem;
}

/* 图纸选择区域 */
.drawing-section {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    color: white;
    font-size: 1.5rem;
}

.drawing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.drawing-item {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.drawing-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.drawing-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.drawing-item h3 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

/* 管理界面样式 */
.manage-tabs {
    display: flex;
    border-bottom: 2px solid #e1e5e9;
    margin-bottom: 2rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    font-size: 1rem;
    color: #333; /* 从未选中时的灰色(#666)改为黑色(#333) */
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: white;
    border-bottom-color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tab-header h3 {
    color: white;
    font-size: 1.3rem;
}

/* 项目列表样式 */
.items-list {
    display: grid;
    gap: 1rem;
}

.item-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

/* 缩略图样式 */
.item-thumbnail {
    text-align: center;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.association-thumbnails {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.thumbnail-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.thumbnail-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.item-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.item-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.item-description {
    color: #666;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 1rem;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.item-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border: 2px solid transparent;
    font-weight: 600;
}

.item-actions .btn-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-color: #f5576c;
}

.item-actions .btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: white;
    border-color: #ff4b2b;
}

.item-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 提高按钮对比度 */
.btn-primary {
    background: linear-gradient(135deg, #4a6cf7 0%, #6a11cb 100%);
    color: white;
    border: 2px solid #4a6cf7;
    font-weight: 600;
}

.btn-secondary {
    background: white;
    color: #4a6cf7;
    border: 2px solid #4a6cf7;
    font-weight: 600;
}

.btn-success {
    background: linear-gradient(135deg, #38a169 0%, #68d391 100%);
    color: white;
    border: 2px solid #38a169;
    font-weight: 600;
}

.btn-warning {
    background: linear-gradient(135deg, #ed8936 0%, #f6ad55 100%);
    color: white;
    border: 2px solid #ed8936;
    font-weight: 600;
}

.btn-danger {
    background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
    color: white;
    border: 2px solid #e53e3e;
    font-weight: 600;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

/* 加载指示器 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(10px);
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 进度条样式 */
.progress-container {
    width: 100%;
    max-width: 300px;
    background: #e1e5e9;
    border-radius: 10px;
    overflow: hidden;
    margin: 0.5rem 0;
    height: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.loading-percentage {
    font-size: 1.2rem;
    color: #667eea;
    font-weight: bold;
    margin: 0.5rem 0;
}

.loading-details {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

/* 工具类 */
.hidden {
    display: none !important;
}

/* 触摸手势支持 */
@media (hover: none) and (pointer: coarse) {
    .touch-hints {
        display: flex;
    }
}

@media (hover: hover) and (pointer: fine) {
    .touch-hints {
        display: none;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .main-content,
    .manage-content {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    .header,
    .manage-header {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .header h1,
    .manage-header h1 {
        font-size: 1.5rem;
    }
    
    .main-content,
    .manage-content {
        padding: 1rem;
    }
    
    .drawing-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .manage-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        padding: 0.75rem 1rem;
    }
    
    .ar-view-buttons {
        right: 0.5rem;
    }
    
    .view-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .touch-hints {
        bottom: 1rem;
        gap: 1rem;
    }
    
    .hint-item {
        padding: 0.75rem;
    }

    .recognition-status {
        padding: 1.5rem;
        margin: 1rem;
    }

    .status-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .drawing-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .item-actions {
        flex-wrap: wrap;
    }
    
    .ar-top-controls {
        top: 0.5rem;
        left: 0.5rem;
    }
    
    .ar-top-controls .btn {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    .touch-hints {
        flex-direction: column;
        gap: 0.5rem;
    }

    .hint-item {
        padding: 0.5rem;
    }

    .hint-item span {
        font-size: 0.8rem;
    }
}
