/**
 * 磁检测仪器网页版 - 主样式文件
 * 包含全局样式、布局和通用组件样式
 */

/* ==================== 全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 颜色变量 */
    --primary-orange: #FF6B1A;
    --dark-gray: #2A2A2A;
    --light-gray: #F5F5F5;
    --warning-yellow: #FFFF00;
    --waveform-green: #00FF00;
    --error-red: #FF0000;
    --text-white: #FFFFFF;
    --text-dark: #333333;
    --border-gray: #CCCCCC;
    --bg-dark: #1A1A1A;
    
    /* 尺寸变量 */
    --header-height: 60px;
    --sidebar-width: 250px;
    --button-height: 40px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
    
    /* 过渡 */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: 'Microsoft YaHei', 'Arial', 'Helvetica', sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    color: var(--text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ==================== 通用类 ==================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.grid {
    display: grid;
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-primary {
    background: var(--primary-orange);
    color: white;
}

.btn-primary:hover {
    background: #e85d11;
}

.btn-secondary {
    background: var(--light-gray);
    color: var(--text-dark);
    border: 1px solid var(--border-gray);
}

.btn-secondary:hover {
    background: #e0e0e0;
}

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

.btn-danger {
    background: var(--error-red);
    color: white;
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ==================== 输入框样式 ==================== */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(255, 107, 26, 0.1);
}

.form-control:disabled {
    background: var(--light-gray);
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: 35px;
}

/* ==================== 表格样式 ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: var(--shadow-sm);
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-gray);
}

.table th {
    background: var(--light-gray);
    font-weight: 600;
    color: var(--text-dark);
}

.table tbody tr:hover {
    background: #f9f9f9;
}

.table-striped tbody tr:nth-child(even) {
    background: #fafafa;
}

.table-striped tbody tr:nth-child(even):hover {
    background: #f5f5f5;
}

/* ==================== 卡片样式 ==================== */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    background: var(--light-gray);
    border-bottom: 1px solid var(--border-gray);
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    background: var(--light-gray);
    border-top: 1px solid var(--border-gray);
}

/* ==================== 模态框样式 ==================== */
.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;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-gray);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-gray);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ==================== 提示框样式 ==================== */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

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

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 107, 26, 0.3);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 107, 26, 0.2);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== 徽章样式 ==================== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    line-height: 1;
}

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

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

.badge-danger {
    background: var(--error-red);
    color: white;
}

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

/* ==================== 导航样式 ==================== */
.nav {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-right: 20px;
}

.nav-link {
    display: block;
    padding: 10px 16px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-radius: 4px;
}

.nav-link:hover {
    background: var(--light-gray);
}

.nav-link.active {
    background: var(--primary-orange);
    color: white;
}

/* ==================== 分页样式 ==================== */
.pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid var(--border-gray);
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.pagination button:hover:not(:disabled) {
    background: var(--light-gray);
}

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

.pagination .page-info {
    padding: 0 12px;
    color: var(--text-dark);
}

/* ==================== 工具提示 ==================== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    width: 120px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -60px;
    opacity: 0;
    transition: opacity var(--transition-fast);
    font-size: 12px;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light-gray);
}

::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* ==================== 响应式断点 ==================== */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 540px;
    }
    
    .modal-content {
        width: 95%;
    }
}

@media (max-width: 576px) {
    .container {
        max-width: 100%;
        padding: 10px;
    }
}
