/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Noto Sans TC', system-ui, sans-serif;
}

/* 主容器 */
.erp-container {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
    background: #f8f9fb;
}

.export-controls, .date-controls, .date-range {
    display: flex;
    align-items: center;
    gap: 6px;
}

.date-range input {
    padding: 6px 12px;
    border: 1px solid #d8dde6;
    border-radius: 4px;
}

.language-switcher {
    position: absolute;
    top: 10px;
    right: 20px;
}

.language-switcher button {
    padding: 5px 10px;
    margin-left: 5px;
    border: none;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    border-radius: 4px;
}

.language-switcher button:hover {
    background-color: #2980b9;
}

/* 侧边导航 */
.erp-sidebar {
    background: #2c3e50;
    padding: 20px;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

.sidebar-header {
    padding: 15px 0 25px;
    border-bottom: 1px solid #34495e;
    margin-bottom: 20px;
}

.sidebar-header h2 {
    color: #ecf0f1;
    font-size: 20px;
    display: inline-block;
}

.version {
    color: #7f8c8d;
    font-size: 12px;
    margin-left: 8px;
}

.current-user {
    color: #bdc3c7;
    font-size: 14px;
    margin-top: 10px;
}

.nav-menu li {
    color: #bdc3c7;
    padding: 12px 15px;
    margin: 6px 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.nav-menu li:hover {
    background: #34495e;
    color: #ecf0f1;
}

.nav-menu li.active {
    background: #3498db;
    color: white;
}

.material-icons {
    font-size: 18px;
    margin-right: 10px;
}

.logout-btn {
    width: 100%;
    margin-top: 20px;
    background: #e74c3c;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: #c0392b;
}

/* 主内容区 */
.erp-main {
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fb;
}

.action-toolbar {
    display: flex;
    gap: 12px;
    padding: 15px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #e4e7ea;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
    transition: all 0.2s;
}

.btn.primary {
    background: #3498db;
    color: white;
}

.btn.primary:hover {
    background: #2980b9;
}

.btn.small {
    padding: 6px 12px;
    font-size: 13px;
}

.spacer {
    flex: 1;
}

.status-indicator {
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    background: #fef5e7;
    color: #f39c12;
}

.blink {
    width: 8px;
    height: 8px;
    background: #f39c12;
    border-radius: 50%;
    margin-right: 8px;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* 表单网格 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px;
}

.form-card {
    background: white;
    border: 1px solid #e4e7ea;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-card.span-2 {
    grid-column: span 2;
}

.card-header {
    padding: 12px 16px;
    border-bottom: 1px solid #e4e7ea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 15px;
    color: #2c3e50;
    font-weight: 600;
}

.card-body {
    padding: 16px;
}

.form-row {
    display: grid;
    gap: 16px;
    margin-bottom: 12px;
}

.form-field {
    margin-bottom: 16px;
}

.form-field label {
    display: block;
    font-size: 13px;
    color: #5c6873;
    margin-bottom: 6px;
    font-weight: 500;
}

input, select, textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d8dde6;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52,152,219,0.2);
}

.input-group {
    display: flex;
    gap: 8px;
}

/* 商品项 */
.product-item {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.product-field {
    margin-bottom: 8px;
}

.product-field label {
    display: block;
    margin-bottom: 4px;
}

.removeProduct {
    color: #e74c3c;
    padding: 6px;
    margin-left: 8px;
}

.productCode, .productPrice, .productQuantity {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d8dde6;
    border-radius: 4px;
    font-size: 14px;
}

/* 建议列表 */
.suggestions-list {
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 100;
    display: none;
}

.suggestions-list li {
    padding: 8px 12px;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s;
}

.suggestions-list li:hover {
    background: #f5f6f7;
}

/* 验证提示 */
.validation-message {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    height: 16px;
}

/* 表格样式 */
#orderTable, #clientTable, #taskTable, #userTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border-radius: 6px;
}

#orderTable th, #orderTable td, #clientTable th, #clientTable td, #taskTable th, #taskTable td, #userTable th, #userTable td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
}

#orderTable thead tr, #clientTable thead tr, #taskTable thead tr, #userTable thead tr {
    background: #2c3e50;
    color: white;
}

#orderTable tbody tr:hover, #clientTable tbody tr:hover, #taskTable tbody tr:hover, #userTable tbody tr:hover {
    background-color: #f5f5f5;
}

.form-actions {
    display: flex;
    gap: 12px;
}

#orderView .form-actions, #taskManagement .form-actions, #userManagement .form-actions {
    display: none !important;
}

.date-filter {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-filter input[type="date"] {
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.delete-order, .delete-client, .delete-task, .delete-user {
    background-color: #e74c3c !important;
    color: white !important;
    border: none;
}

#exportButton {
    background-color: #2ecc71 !important;
    color: white !important;
    border: none;
}

#searchInput, #searchClient {
    width: 200px;
    padding: 6px 12px;
    border: 1px solid #d8dde6;
    border-radius: 4px;
}
.search-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 20px;
    width: 60%;
    border-radius: 5px;
}

.close {
    float: right;
    cursor: pointer;
    font-size: 24px;
}

.client-form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 12px;
}

/* 任务管理样式 */
.task-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e4e7ea;
}

.task-list-container {
    padding: 10px 20px;
    overflow-y: auto;
    max-height: calc(100vh - 150px);
}

.task-create {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 10px; /* 添加间距，避免元素紧贴 */
}

.task-input {
    flex: 1; /* 输入框占满剩余空间 */
    border: 1px solid #d8dde6;
    padding: 8px;
    font-size: 15px;
    border-radius: 4px;
    min-width: 200px; /* 确保输入框有最小宽度 */
}

.task-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.task-select {
    width: 120px; /* 固定下拉框宽度为 120px，更紧凑 */
    padding: 8px;
    border: 1px solid #d8dde6;
    border-radius: 4px;
    font-size: 15px;
}

.task-list {
    list-style: none;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    background: white;
    cursor: pointer;
    transition: background 0.2s;
}

.task-item:hover {
    background: #f5f6f7;
}

.task-item.completed {
    opacity: 0.6;
}

.task-item .task-checkbox {
    margin-right: 15px;
    width: 20px;
    height: 20px;
    border: 2px solid #3498db;
    border-radius: 50%;
    cursor: pointer;
}

.task-item.completed .task-checkbox {
    background: #3498db;
    position: relative;
}

.task-item.completed .task-checkbox::after {
    content: '✔';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

.task-item .task-description {
    flex: 1;
    font-size: 15px;
    color: #2c3e50;
}

.task-item.completed .task-description {
    text-decoration: line-through;
}

.task-item .task-assigned-to {
    font-size: 14px;
    color: black; /* 设置为黑色 */
    font-weight: bold; /* 加粗 */
    margin-left: 15px;
}
.task-item .task-created-by,
.task-item .task-created-at {
    font-size: 14px;
    color: #5c6873;
    margin-left: 15px;
}

.task-item .task-star {
    margin-left: 15px;
    color: #ccc;
    cursor: pointer;
}

.task-item.starred .task-star {
    color: #f1c40f;
}

.task-detail-modal {
    width: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

.task-detail-modal h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.task-detail-modal p {
    margin: 8px 0;
    font-size: 14px;
}

.task-detail-modal .task-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}
#taskPagination, #orderPagination, #clientPagination {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
}
#taskPagination button, #orderPagination button, #clientPagination button {
    padding: 8px 16px;
    border: 1px solid #d8dde6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
}
#taskPagination button:disabled, #orderPagination button:disabled, #clientPagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* 响应式设计 */
@media (max-width: 1400px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-card.span-2 { grid-column: span 1; }
}

@media (max-width: 768px) {
    .erp-container { grid-template-columns: 1fr; }
    .erp-sidebar { display: none; }
    .product-item, .client-form-row { grid-template-columns: 1fr; }
    .input-group { flex-direction: column; }
}