/* 公共样式文件 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 400px;
}

.login-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-weight: 500;
}

/* 必填字段星号样式 - 红色星号（全局） */
label .required-star,
.form-group label .required-star,
.required-star,
th .required-star {
    color: #dc3545;
    font-weight: bold;
    margin-left: 2px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* 材料单表单：label在左侧，input在右侧 */
.material-order-form .form-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0;
}

.material-order-form .form-group label {
    display: inline-block;
    margin-bottom: 0;
    min-width: 100px;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    flex-shrink: 0;
    line-height: 1.4;
}

.material-order-form .form-group input,
.material-order-form .form-group textarea,
.material-order-form .form-group select {
    flex: 1;
    margin: 0;
}

/* 材料单表单中特定字段的宽度设置（覆盖flex:1） */
.material-order-form .form-group input[style*="width"] {
    flex: 0 0 auto;
}

.material-order-form .form-group textarea {
    resize: vertical;
}

/* 批次号字段特殊处理：包含按钮的容器 */
.material-order-form .form-group > div {
    display: flex;
    gap: 8px;
    flex: 1;
    align-items: center;
}

.material-order-form .form-group > div > input {
    flex: 1;
}

/* 批次号操作链接样式 */
.batch-link {
    color: #667eea;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s;
    cursor: pointer;
}

.batch-link:hover {
    color: #5568d3;
    background-color: #f0f0f0;
    text-decoration: underline;
}

.batch-link:active {
    color: #764ba2;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary {
    background-color: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: #ffc107;
    color: #333;
}

.btn-warning:hover {
    background-color: #e0a800;
}

/* 主页面布局 */
.main-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 左侧菜单 */
.sidebar {
    width: 200px;
    background-color: #2c3e50;
    color: white;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    background-color: #1a252f;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

.sidebar-header i {
    margin-right: 8px;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background-color 0.3s;
    border-bottom: 1px solid #34495e;
}

.menu-item:hover {
    background-color: #34495e;
}

.menu-item.active {
    background-color: #667eea;
}

.menu-item a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.menu-item a i {
    width: 20px;
    text-align: center;
}

.menu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform 0.3s;
}

.submenu {
    background-color: #1a252f;
}

.submenu-item {
    padding: 10px 20px 10px 40px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.submenu-item:hover {
    background-color: #34495e;
}

.submenu-item.active {
    background-color: #667eea;
}

.submenu-item a {
    color: #bdc3c7;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.submenu-item a i {
    width: 20px;
    text-align: center;
}

/* 顶部导航 */
.header {
    height: 60px;
    background-color: white;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left i {
    color: #667eea;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info i {
    color: #667eea;
}

.btn i {
    margin-right: 5px;
}

/* 内容区 */
.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f5f5f5;
}

/* 页面标题 */
.page-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

/* 工具栏 */
.toolbar {
    background-color: white;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 15px;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.search-form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
}

.search-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
    flex-shrink: 0;
}

.search-form-group label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}

.search-form-group label i {
    color: #667eea;
}

.search-form input[type="text"],
.search-form input[type="date"],
.search-form select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-form input[type="text"]:focus,
.search-form input[type="date"]:focus,
.search-form select:focus {
    outline: none;
    border-color: #667eea;
}

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

.date-separator {
    color: #999;
    font-size: 12px;
}

.search-form-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.search-form button {
    padding: 8px 16px;
    white-space: nowrap;
}

.toolbar-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* 表格样式 */
.table-container {
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    background-color: #f8f9fa;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
    white-space: nowrap;
}

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

tbody tr:hover .sticky-action-cell {
    background-color: #f8f9fa;
}

.sticky-action-header {
    position: sticky;
    right: 0;
    background-color: #f8f9fa;
    z-index: 2;
    min-width: 150px;
}

.sticky-action-cell {
    position: sticky;
    right: 0;
    background-color: white;
    z-index: 1;
    min-width: 150px;
}

/* 左侧固定列样式 */
.sticky-left-header {
    position: sticky;
    background-color: #f8f9fa;
    z-index: 2;
}

.sticky-left-cell {
    position: sticky;
    background-color: white;
    z-index: 1;
}

tbody tr:hover .sticky-left-cell {
    background-color: #f8f9fa;
}

/* 库存状态样式 */
.stock-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
}

/* 编辑明细行高亮样式 */
.detail-row-editing {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
}

.detail-row-editing:hover {
    background-color: #ffe69c !important;
}

.stock-status-rich {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.stock-status-tight {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.stock-status-low {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-normal {
    background-color: #d4edda;
    color: #155724;
}

.status-disabled {
    background-color: #f8d7da;
    color: #721c24;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background-color: white;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background-color: #f8f9fa;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    color: #666;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 500px;
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

/* 抽屉式模态框 */
.drawer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.drawer-modal.show {
    opacity: 1;
    visibility: visible;
}

.drawer-content {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 1400px;
    height: 100%;
    background-color: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.drawer-modal.show .drawer-content {
    transform: translateX(0);
}

.drawer-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.drawer-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.drawer-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.drawer-close:hover {
    background-color: #e9ecef;
    color: #333;
}

.drawer-body {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.drawer-footer {
    padding: 20px 30px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8f9fa;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.modal-close:hover {
    color: #333;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* 确认对话框样式 */
.confirm-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.confirm-dialog.show {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.confirm-dialog-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 450px;
    transform: scale(0.9) translateY(-20px);
    transition: transform 0.3s;
    overflow: hidden;
}

.confirm-dialog.show .confirm-dialog-content {
    transform: scale(1) translateY(0);
}

.confirm-dialog-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.confirm-dialog-header i {
    font-size: 24px;
    color: #ffd700;
}

.confirm-dialog-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.confirm-dialog-body {
    padding: 24px;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    text-align: center;
}

.confirm-dialog-body p {
    margin: 0;
}

.confirm-dialog-footer {
    padding: 16px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.confirm-dialog-footer .btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s;
}

.confirm-dialog-footer .btn i {
    font-size: 14px;
}

.confirm-btn-cancel {
    background-color: #6c757d;
    color: white;
    border: none;
}

.confirm-btn-cancel:hover {
    background-color: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.3);
}

.confirm-btn-ok {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.confirm-btn-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* 消息提示 */
.message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
    display: none;
    z-index: 10000;
    min-width: 300px;
    max-width: 80%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: messageSlideIn 0.3s ease-out;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.message-text {
    flex: 1;
    word-break: break-word;
}

.message-btn {
    padding: 6px 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.2);
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.message-btn:hover {
    background-color: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.7);
}

.message-btn:active {
    background-color: rgba(255, 255, 255, 0.6);
    transform: scale(0.95);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.message.show {
    display: flex;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 登录失效提示弹框 */
.login-expired-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.login-expired-dialog.show {
    opacity: 1;
    visibility: visible;
}

.login-expired-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.login-expired-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 420px;
    padding: 0;
    transform: scale(0.9) translateY(-30px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.login-expired-dialog.show .login-expired-content {
    transform: scale(1) translateY(0);
}

.login-expired-icon {
    padding: 32px 24px 16px;
    text-align: center;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.login-expired-icon i {
    font-size: 64px;
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.login-expired-title {
    padding: 24px 24px 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.login-expired-message {
    padding: 0 24px 32px;
    text-align: center;
    font-size: 15px;
    line-height: 1.6;
    color: #666;
}

.login-expired-footer {
    padding: 20px 24px 24px;
    display: flex;
    justify-content: center;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.login-expired-btn {
    min-width: 160px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    cursor: pointer;
}

.login-expired-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.login-expired-btn:active {
    transform: translateY(0);
}

.login-expired-btn i {
    font-size: 16px;
}

/* Loading 动效 */
.global-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.global-loading.show {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content {
    background: white;
    padding: 24px 32px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-text {
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
}

/* 响应式 */
@media (max-width: 768px) {
    .sidebar {
        width: 160px;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .search-form {
        width: 100%;
        flex-wrap: wrap;
    }
}

