/* ============================================
   车间生产日报系统 - 样式表
   ============================================ */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #07c160;
    --primary-dark: #06ad56;
    --secondary-color: #576b95;
    --danger-color: #fa5151;
    --warning-color: #ffc300;
    --info-color: #10aeff;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e5e5e5;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* 容器 */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.user-info {
    font-size: 14px;
    opacity: 0.9;
}

/* 主内容区 */
.main-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

/* 表单样式 */
.production-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group .required {
    color: var(--danger-color);
}

.form-group input,
.form-group select {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.1);
}

.form-group input:read-only {
    background-color: #f9f9f9;
    color: var(--text-secondary);
}

.form-group .hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* 按钮组 */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.btn {
    flex: 1;
    min-width: 100px;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #f2f2f2;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #e6e6e6;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #0d93e0;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.icon {
    font-size: 18px;
}

/* 打印机状态 */
.printer-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px;
    background: #f9f9f9;
    border-radius: var(--radius);
    font-size: 14px;
}

.printer-status.connected {
    background: #e8f5e9;
    color: var(--primary-color);
}

.printer-status.error {
    background: #ffebee;
    color: var(--danger-color);
}

.status-icon {
    font-size: 12px;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    background: #f9f9f9;
}

/* 标签预览 */
.label-preview {
    background: white;
    border: 1px solid #ddd;
    padding: 20px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.label-preview .label-title {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.label-preview .label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.label-preview .label-row span:first-child {
    font-weight: 500;
}

.label-preview .label-divider {
    border-top: 1px solid #999;
    margin: 10px 0;
}

/* 消息提示 */
.message-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    text-align: center;
    max-width: 80%;
}

.message-toast.show {
    opacity: 1;
    visibility: visible;
}

.message-toast.success {
    background: rgba(7, 193, 96, 0.9);
}

.message-toast.error {
    background: rgba(250, 81, 81, 0.9);
}

.message-toast.warning {
    background: rgba(255, 195, 0, 0.9);
    color: #333;
}

/* 加载中 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.loading-overlay.show {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* 响应式 */
@media (max-width: 480px) {
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 16px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 15px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* 打印样式 */
@media print {
    body * {
        visibility: hidden;
    }
    
    .label-preview,
    .label-preview * {
        visibility: visible;
    }
    
    .label-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 60mm;
        height: 40mm;
    }
}
