/* 全局样式 */
body {
    background-color: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #2c3e50;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 40px;
    background-color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    border-radius: 12px;
}

/* 标题样式 */
h1 {
    color: #1a237e;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e8eaf6;
}

h2 {
    color: #283593;
    font-size: 22px;
    font-weight: 500;
    margin: 25px 0 20px;
}

h3 {
    color: #3949ab;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 15px;
}

/* 表单样式 */
.product-form {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.product-form input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.product-form input:focus {
    border-color: #3949ab;
    box-shadow: 0 0 0 3px rgba(57, 73, 171, 0.1);
    outline: none;
}

/* 按钮样式 */
button {
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.primary-btn {
    background-color: #3949ab;
    color: white;
}

.primary-btn:hover {
    background-color: #283593;
    transform: translateY(-1px);
}

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

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

/* 表格样式 */
.table-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 15px;
    text-align: left;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
}

tr:hover {
    background-color: #f8f9fa;
}

/* 操作按钮样式 */
.action-btn {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    margin: 0 4px;
}

.edit-btn {
    background-color: #4caf50;
    color: white;
}

.edit-btn:hover {
    background-color: #43a047;
}

.save-btn {
    background-color: #2196f3;
    color: white;
}

.save-btn:hover {
    background-color: #1e88e5;
}

.delete-btn {
    background-color: #f44336;
    color: white;
}

.delete-btn:hover {
    background-color: #e53935;
}

/* 分割线 */
.divider {
    margin: 40px 0;
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, #e0e0e0, transparent);
}

/* 文件上传区域 */
.upload-section {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* 消息提示框 */
.message-box {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    background-color: #fff;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-left: 4px solid #3949ab;
    animation: slideDown 0.3s ease-out;
}

/* 编辑输入框 */
.edit-input {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    /* 容器样式 */
    .container {
        padding: 15px;
        margin: 10px;
        border-radius: 8px;
    }

    /* 标题样式 */
    h1 {
        font-size: 22px;
        margin-bottom: 20px;
    }

    h2 {
        font-size: 18px;
    }

    h3 {
        font-size: 16px;
    }

    /* 表单样式 */
    .product-form {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .product-form input {
        width: 100%;
    }

    /* 按钮组样式 */
    .button-group, 
    .list-actions,
    .restore-actions {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .button-group button,
    .list-actions button,
    .restore-actions button {
        width: 100%;
        margin: 0;
    }

    /* 表格容器样式调整 */
    .table-container {
        margin: 0 -15px; /* 抵消容器padding */
        width: calc(100% + 30px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: #fff;
        padding: 0 15px;
    }

    /* 调整表格最小宽度 */
    table {
        min-width: 100%;
        width: 100%;
    }

    /* 调整表格单元格 */
    th, td {
        padding: 8px 6px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* 调整按钮组布局 */
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
        padding: 0;
    }

    /* 调整操作按钮 */
    td .button-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }

    .action-btn {
        padding: 6px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* 调整输入框 */
    .edit-input {
        width: 60px;
        min-width: 60px;
    }

    /* 调整表单布局 */
    .product-form {
        margin: 0 -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }

    /* 调整上传区域 */
    .upload-section {
        margin: 15px -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }

    /* 调整恢复框 */
    .restore-box {
        margin: 0 -15px 15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }

    /* 恢复框样式 */
    .restore-box {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px;
    }

    .restore-box span {
        margin-bottom: 5px;
    }

    /* 消息提示框 */
    .message-box {
        width: calc(100% - 20px);
        left: 10px;
        transform: none;
        border-radius: 0;
    }

    /* 分割线 */
    .divider {
        margin: 25px 0;
    }
}

/* 超小屏幕设备 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    /* 调整表格布局 */
    .table-container {
        margin: 0 -10px;
        width: calc(100% + 20px);
    }

    /* 调整表单和上传区域 */
    .product-form,
    .upload-section,
    .restore-box {
        margin: 10px -10px;
        width: calc(100% + 20px);
    }

    /* 调整按钮大小 */
    .action-btn {
        padding: 4px 6px;
        font-size: 11px;
    }

    /* 调整消息框 */
    .message-box {
        width: calc(100% - 20px);
        left: 10px;
        transform: none;
        border-radius: 0;
    }

    table {
        min-width: 260px;
    }

    th, td {
        padding: 6px;
        font-size: 13px;
    }
}

/* 优化触摸设备的点击区域 */
@media (hover: none) and (pointer: coarse) {
    button, 
    input[type="file"],
    .action-btn {
        min-height: 44px; /* 确保触摸区域足够大 */
    }

    input[type="text"],
    input[type="number"] {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 12px;
    }
}

.product-management {
    margin-bottom: 30px;
}

.product-list {
    margin-top: 20px;
}

.list-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

.file-processing {
    margin-top: 30px;
}

/* 添加高亮动画样式 */
@keyframes highlightRow {
    0% { background-color: #fff; }
    50% { background-color: #ffd700; }
    100% { background-color: #fff; }
}

.highlight {
    animation: highlightRow 2s ease;
}

/* 已存在型号的提示样式 */
.duplicate-tip {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: none;
}

@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

/* 添加恢复框样式 */
.restore-box {
    background-color: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.restore-box span {
    color: #1976d2;
    font-weight: 500;
}

.restore-actions {
    display: flex;
    gap: 10px;
}

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

/* 添加全局盒模型设置 */
* {
    box-sizing: border-box;
}

/* 优化滚动条样式 */
.table-container::-webkit-scrollbar {
    height: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #666;
} 