/* 电机测试数据记录APP样式文件 */

/* 全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f8fafc;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1e293b;
    line-height: 1.6;
}

/* 移动端优化 */
@media (max-width: 640px) {
    /* 表单元素优化 */
    .form-input {
        font-size: 16px !important; /* 防止iOS缩放问题 */
        padding: 12px 16px !important;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 12px 20px !important;
        font-size: 16px !important;
    }
    
    /* 卡片间距优化 */
    .card {
        margin-bottom: 20px !important;
    }
    
    /* 导航栏优化 */
    .navbar {
        padding: 12px 16px !important;
    }
    
    /* 主内容区优化 */
    main {
        padding: 80px 16px 64px !important;
    }
    
    /* 图片预览优化 */
    .image-preview {
        min-height: 200px !important;
    }
    
    /* 录音按钮优化 */
    .record-btn {
        width: 60px !important;
        height: 60px !important;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #0f172a;
        color: #f1f5f9;
    }
    
    .card {
        background-color: #1e293b !important;
        color: #f1f5f9;
    }
    
    .form-input {
        background-color: #334155 !important;
        border-color: #475569 !important;
        color: #f1f5f9 !important;
    }
    
    .form-input:focus {
        border-color: #3b82f6 !important;
    }
    
    select.form-input option {
        background-color: #334155;
        color: #f1f5f9;
    }
    
    .data-card {
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%) !important;
    }
}

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

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* 防止文本选择 */
.no-select {
    user-select: none;
}

/* 触摸反馈 */
.touch-feedback {
    transition: transform 0.1s ease;
}

.touch-feedback:active {
    transform: scale(0.98);
}

/* 图片预览动画 */
.image-preview img {
    transition: transform 0.3s ease;
}

.image-preview img:hover {
    transform: scale(1.02);
}

/* 录音按钮动画 */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

.record-btn.recording {
    animation: pulse 1.5s infinite;
}

/* 表单错误样式 */
.form-input.error {
    border-color: #ef4444 !important;
    background-color: #fee2e2 !important;
}

/* 加载状态 */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* 响应式网格 */
@media (max-width: 480px) {
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

/* 历史记录项样式 */
.history-item {
    transition: all 0.3s ease;
}

.history-item:hover {
    background-color: #f1f5f9;
    border-radius: 8px;
}

/* 模态框动画 */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#historyModal .bg-white {
    animation: modalSlideIn 0.3s ease-out;
}

/* 图表容器样式 */
#dataChart {
    background-color: white;
    border-radius: 8px;
    padding: 8px;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: #cbd5e1;
}

/* 提示框样式 */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    background-color: #10b981;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    animation: toastSlideIn 0.3s ease-out;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 响应式字体 */
@media (max-width: 320px) {
    h1 {
        font-size: 20px !important;
    }
    
    h2 {
        font-size: 18px !important;
    }
    
    p {
        font-size: 14px !important;
    }
}

/* 横屏模式优化 */
@media (max-height: 480px) {
    main {
        padding: 60px 16px 40px !important;
    }
    
    .card {
        margin-bottom: 12px !important;
    }
    
    .image-preview {
        min-height: 150px !important;
    }
}