/* 移动端专用样式 */
/* 基础移动端优化 */
* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* 允许文本选择 */
p, span, div, h1, h2, h3, h4, h5, h6 {
    -webkit-user-select: text;
    user-select: text;
}

/* 确保移动端滚动正常工作 */
html, body {
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
}

body {
    position: relative;
    min-height: 100vh;
}

/* 移动端滚动优化 */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .container {
        overflow: visible;
    }
    
    .table-container {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
}

/* 移动端视口优化 */
@media (max-width: 768px) {
    /* 容器优化 */
    .container {
        padding: 10px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }
    
    /* 头部优化 */
    .header {
        padding: 20px 15px;
        border-radius: 0;
    }
    
    .header h1 {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    
    .header p {
        font-size: 0.9em;
    }
    
    /* 控制面板优化 */
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        padding: 15px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group label {
        margin-bottom: 5px;
        font-size: 0.9em;
    }
    
    .control-group select,
    .control-group input {
        padding: 12px;
        font-size: 16px; /* 防止iOS缩放 */
        border-radius: 8px;
    }
    
    /* 表格优化 */
    .table-container {
        padding: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .product-table {
        font-size: 12px;
        min-width: 100%;
    }
    
    .product-table th,
    .product-table td {
        padding: 8px 6px;
        word-wrap: break-word;
        white-space: normal;
    }
    
    /* 产品名称优化 */
    .product-name {
        max-width: 120px;
        font-size: 0.9em;
        line-height: 1.3;
    }
    
    /* 图片优化 */
    .product-image-small {
        width: 60px;
        height: 60px;
        border-radius: 6px;
    }
    
    /* 标签优化 */
    .category-tag,
    .model-tag {
        padding: 4px 8px;
        font-size: 0.75em;
        border-radius: 4px;
    }
    
    /* 统计信息优化 */
    .stats {
        padding: 15px;
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        text-align: center;
        padding: 10px;
    }
    
    .stat-number {
        font-size: 1.4em;
    }
    
    .stat-label {
        font-size: 0.8em;
    }
    
    /* 按钮优化 */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 8px;
        min-height: 44px; /* iOS推荐的最小触摸目标 */
    }
    
    /* 表单优化 */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-weight: bold;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        transition: border-color 0.3s;
    }
    
    .form-group input:focus,
    .form-group select:focus,
    .form-group textarea:focus {
        outline: none;
        border-color: #667eea;
    }
    
    /* 卡片布局优化 */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .card-header {
        padding: 15px;
        border-bottom: 1px solid #e9ecef;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* 导航优化 */
    .nav {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-item {
        padding: 12px 15px;
        border-radius: 8px;
        background: #f8f9fa;
        text-decoration: none;
        color: #495057;
        transition: background 0.3s;
    }
    
    .nav-item:hover,
    .nav-item.active {
        background: #667eea;
        color: white;
    }
    
    /* 模态框优化 */
    .modal {
        padding: 20px;
    }
    
    .modal-content {
        border-radius: 12px;
        margin: 20px;
    }
    
    /* 加载状态优化 */
    .loading {
        padding: 40px 20px;
        text-align: center;
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #667eea;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin: 0 auto 20px;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
}

/* 小屏幕设备优化 */
@media (max-width: 480px) {
    .container {
        padding: 5px;
    }
    
    .header {
        padding: 15px 10px;
    }
    
    .header h1 {
        font-size: 1.6em;
    }
    
    .controls {
        padding: 10px;
        gap: 12px;
    }
    
    .product-table {
        font-size: 11px;
    }
    
    .product-table th,
    .product-table td {
        padding: 6px 4px;
    }
    
    .product-name {
        max-width: 100px;
        font-size: 0.85em;
    }
    
    .product-image-small {
        width: 50px;
        height: 50px;
    }
    
    .category-tag,
    .model-tag {
        padding: 3px 6px;
        font-size: 0.7em;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* 横屏优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 15px 20px;
    }
    
    .header h1 {
        font-size: 1.4em;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .control-group {
        flex-direction: row;
        align-items: center;
    }
    
    .stats {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* 触摸优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    .btn,
    .nav-item,
    .control-group select,
    .control-group input {
        min-height: 44px;
    }
    
    /* 优化触摸反馈 */
    .btn:active,
    .nav-item:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    /* 禁用hover效果 */
    .btn:hover,
    .nav-item:hover {
        transform: none;
    }
}

/* 高分辨率屏幕优化 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .product-image-small {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a;
        color: #ffffff;
    }
    
    .container {
        background: #2d2d2d;
        color: #ffffff;
    }
    
    .header {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }
    
    .controls {
        background: #3a3a3a;
        border-bottom-color: #4a4a4a;
    }
    
    .control-group label {
        color: #e2e8f0;
    }
    
    .control-group select,
    .control-group input {
        background: #4a4a4a;
        border-color: #5a5a5a;
        color: #ffffff;
    }
    
    .product-table th {
        background: #3a3a3a;
        color: #ffffff;
    }
    
    .product-table td {
        border-bottom-color: #4a4a4a;
        color: #e2e8f0;
    }
} 