/* 基础样式（兼容所有设备） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft Yahei", sans-serif; padding: 10px; font-size: 14px; }
@media (max-width: 768px) { body { font-size: 12px; } }

/* PWA 安装提示按钮样式 */
.pwa-install-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: none;
}

.pwa-install-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.pwa-install-btn:active {
    transform: translateY(0);
}

.pwa-install-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
}

@media (max-width: 768px) {
    .pwa-install-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
        text-align: center;
    }
    
    .pwa-install-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 13px;
    }
}

/* iOS Safari 安装指引弹窗样式 */
.ios-install-guide {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
}

.ios-install-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.ios-install-content {
    position: relative;
    margin: 20% auto;
    width: 90%;
    max-width: 400px;
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ios-install-content h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #333;
    font-size: 18px;
}

.ios-steps {
    margin-bottom: 25px;
}

.ios-steps .step {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.ios-steps .step:last-child {
    border-bottom: none;
}

.step-number {
    background: linear-gradient(135deg, #D4AF37 0%, #F4D03F 100%);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-right: 15px;
    flex-shrink: 0;
}

.step span:last-child {
    color: #666;
    font-size: 15px;
    line-height: 1.5;
}

.step span:last-child strong {
    color: #D4AF37;
}

.ios-install-content .close-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #D4AF37 0%, #F4D03F 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.ios-install-content .close-btn:hover {
    opacity: 0.9;
}

/* 表格响应式样式 */
table { border-collapse: collapse; table-layout: fixed; }
@media (max-width: 768px) {
    table { font-size: 11px; }
    th, td { padding: 0; }
    th { font-size: 10px; }
}

/* 订单列表列宽度（电脑端） */
@media (min-width: 769px) {
    table#task_list_table .customer-col,
    table#task_list_table .mapper-col {
        width: 90px !important;
        min-width: 90px !important;
        max-width: 90px !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    table#task_list_table .filename-col {
        width: auto !important;
        min-width: 300px !important;
        max-width: none !important;
    }
    table#task_list_table .sketch-col {
        width: 90px !important;
        min-width: 90px !important;
        max-width: 90px !important;
    }
    table#task_list_table .file-date-col,
    table#task_list_table .completion-time-col {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
    }
    table#task_list_table .status-col,
    table#task_list_table .action-col {
        width: 90px !important;
        min-width: 90px !important;
        max-width: 90px !important;
    }
}

/* 任务列表页面的手机端样式 */
@media (max-width: 768px) {
    /* 任务列表页面的客户名称和制图列宽度设置 */
    table#task_list_table .customer-col,
    table#task_list_table .mapper-col {
        width: 55px !important;
        min-width: 55px !important;
        max-width: 55px !important;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 !important;
    }
    /* 任务列表页面的文件名称列宽度设置 */
    table#task_list_table .filename-col {
        width: 120px !important;
        min-width: 120px !important;
    }
    /* 任务列表页面的示意图列宽度设置 */
    table#task_list_table .sketch-col {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
        padding: 0 !important;
    }
}

/* 下料表的手机端样式 */
@media (max-width: 768px) {
    /* 下料表材料类型列宽度 */
    #materials_section table .material-name-col {
        width: 40px !important;
        min-width: 40px !important;
    }
    /* 下料表类型列宽度 */
    #materials_section table .material-type-col {
        width: 40px !important;
        min-width: 40px !important;
    }
    /* 下料表加工人员列宽度 */
    #materials_section table .staff-column {
        width: 60px !important;
        min-width: 60px !important;
    }
    /* 文字类下料表和开单表编号列宽度 */
    .serial-col {
        width: 25px;
        min-width: 25px;
    }
    /* 文字类下料表和开单表数量列宽度 */
    .quantity-col {
        width: 30px;
        min-width: 30px;
    }
}

/* 文字类下料表和开单表编号列宽度（电脑端） */
.serial-col {
    width: auto;
    min-width: 40px;
}
/* 文字类下料表和开单表数量列宽度（电脑端） */
.quantity-col {
    width: auto;
    min-width: 80px;
}

/* 页面容器 */
.container { max-width: 1000px; margin: 0 auto; }

/* 导航栏 */
nav {
    background: -webkit-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: -moz-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: -o-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 10px;
    margin-bottom: 15px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
nav a { color: #2c3e50; text-decoration: none; margin: 0 10px; padding: 5px 10px; display: inline-block; font-size: 16px; font-weight: bold; }
nav a:hover { background: rgba(255, 255, 255, 0.5); border-radius: 8px; }

/* 未登录页面的导航栏样式（与表单宽度一致） */
nav.login-nav { max-width: 400px; }

/* 用户信息栏 */
.user-bar {
    background: -webkit-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: -moz-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: -o-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    padding: 8px 15px;
    margin: 10px auto;
    max-width: 1000px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: bold;
    color: #2c3e50;
    border: 1px solid #bbdefb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.user-bar a {
    color: #2c3e50;
    text-decoration: none;
    margin-left: 15px;
    font-weight: bold;
}
.user-bar a:hover { text-decoration: underline; }

/* 消息提示 */
.alert { padding: 10px; margin: 10px auto; border-radius: 10px; max-width: 1000px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }

/* 未登录页面的消息提示样式（与表单宽度一致） */
.alert.login-alert { max-width: 400px; }
.alert-success {
    background: -webkit-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: -moz-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: -o-linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #2c3e50; 
    border: 1px solid #bbdefb; 
}
.alert-danger {
    background: -webkit-linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    background: -moz-linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    background: -o-linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #2c3e50; 
    border: 1px solid #f8d7da; 
}

/* 表单 */
.form-group { margin: 15px 0; }
.form-control { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
@media (max-width: 768px) { .form-control { padding: 6px; } }

/* 大复选框样式 */
.big-checkbox {
    width: 24px;
    height: 24px;
    margin: 0 5px;
    cursor: pointer;
    accent-color: #4CAF50;
    transition: all 0.2s ease;
}
.big-checkbox:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}
.big-checkbox:checked {
    animation: checkPulse 0.3s ease;
}
.big-checkbox:disabled {
    cursor: not-allowed;
}
.big-checkbox:disabled:hover {
    transform: none;
    box-shadow: none;
}
@keyframes checkPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* 锚点定位 */
:target { scroll-margin-top: 80px; }

/* 打印样式（A4适配） */
@media print {
    .no-print { display: none; }
    @page { size: A4; margin: 1cm; }
    table { page-break-inside: avoid; }
}

/* 移动端隐藏桌面端元素 */
@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
    
    /* 手机端用户信息栏优化 */
    .user-bar {
        font-size: 12px;
        padding: 6px 10px;
    }
    .user-bar a {
        margin-left: 10px;
        font-size: 12px;
    }
    
    /* 手机端导航栏优化 */
    nav {
        padding: 8px 5px;
        border-radius: 8px;
        margin-bottom: 10px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    nav::-webkit-scrollbar {
        display: none;
    }
    nav > div {
        display: flex;
        flex-wrap: nowrap;
    }
    nav a {
        font-size: 13px;
        margin: 0 3px;
        padding: 6px 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }
}
