/* web/common/style.css - 华恒化验管理系统全局样式 */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    background: #f0f2f5;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: #001529;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.header-logo {
    font-size: 18px;
    font-weight: 700;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.header-role {
    color: #91d5ff;
}

.header-logout {
    color: #ff7875;
    border: 1px solid #ff7875;
    padding: 4px 12px;
    border-radius: 4px;
    transition: all 0.2s;
}
.header-logout:hover {
    background: #ff7875;
    color: #fff;
}

/* ===== Body Layout ===== */
.app-body {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

/* ===== Sidebar ===== */
.app-sidebar {
    width: 220px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    padding-top: 16px;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
}

.menu-group {
    font-size: 12px;
    color: #999;
    padding: 12px 24px 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-item {
    display: block;
    padding: 12px 24px;
    font-size: 14px;
    color: #555;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: #e6f7ff;
    color: #1890ff;
}

.menu-item.active {
    background: #e6f7ff;
    color: #1890ff;
    border-left-color: #1890ff;
    font-weight: 600;
}

/* ===== Main Content ===== */
.app-main {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* ===== Login Page ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a6dd4, #1989fa 40%, #5eb5ff);
}

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 48px 40px;
    width: 420px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    text-align: center;
}

.login-box h1 {
    font-size: 24px;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.login-box .subtitle {
    font-size: 14px;
    color: #999;
    margin-bottom: 32px;
}

.qrcode-container {
    position: relative;
    display: inline-block;
    margin: 0 auto;
}

.qrcode-container img {
    width: 200px;
    height: 200px;
    border: 1px solid #eee;
    border-radius: 8px;
}

.qrcode-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.92);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
}

.qrcode-mask .mask-icon {
    font-size: 48px;
}

.qrcode-mask .mask-text {
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.status-text {
    margin-top: 16px;
    font-size: 14px;
    color: #666;
}

.status-text.scanned {
    color: #1890ff;
}

.status-text.success {
    color: #52c41a;
}

.status-text.error {
    color: #ff4d4f;
}

.refresh-btn {
    margin-top: 16px;
    display: inline-block;
    color: #1890ff;
    cursor: pointer;
    font-size: 13px;
    border: none;
    background: none;
}

.refresh-btn:hover {
    color: #40a9ff;
}

/* ===== Login Success Animation ===== */
.login-success-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-success-box {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}

.login-success-box .success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.login-success-box h2 {
    font-size: 20px;
    color: #333;
    margin-bottom: 8px;
}

.login-success-box p {
    font-size: 14px;
    color: #999;
}

/* ===== Page Content Styles ===== */
.page-header {
    background: #fff;
    padding: 20px 24px;
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.page-header h2 {
    font-size: 20px;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.page-header .breadcrumb {
    font-size: 13px;
    color: #999;
}

/* ===== Table ===== */
.data-table-wrap {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #fafafa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f5f5f5;
    color: #333;
}

.data-table tr:hover td {
    background: #fafafa;
}

.data-table .empty-row td {
    text-align: center;
    color: #999;
    padding: 40px;
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.pagination button {
    padding: 6px 12px;
    border: 1px solid #d9d9d9;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    color: #555;
}

.pagination button:hover {
    color: #1890ff;
    border-color: #1890ff;
}

.pagination button.active {
    background: #1890ff;
    color: #fff;
    border-color: #1890ff;
}

.pagination button:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 13px;
    color: #999;
    margin: 0 8px;
}

/* ===== Search Bar ===== */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.search-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.search-bar input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.2);
}

.search-bar button {
    padding: 8px 16px;
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.search-bar button:hover {
    background: #40a9ff;
}

/* ===== Detail Card ===== */
.detail-card {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.detail-card h3 {
    font-size: 16px;
    color: #1a1a1a;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.detail-item {
    display: flex;
    gap: 8px;
    font-size: 13px;
}

.detail-item .label {
    color: #999;
    flex-shrink: 0;
}

.detail-item .value {
    color: #333;
    font-weight: 500;
}

/* ===== AI Report ===== */
.report-content {
    background: #fff;
    border-radius: 8px;
    padding: 32px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    line-height: 1.8;
    font-size: 14px;
}

.report-content h2 {
    font-size: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.report-content h3 {
    font-size: 16px;
    margin: 16px 0 8px;
    color: #333;
}

.report-content p {
    margin-bottom: 8px;
    color: #555;
}

.report-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

.report-content table th,
.report-content table td {
    border: 1px solid #e8e8e8;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
}

.report-content table th {
    background: #fafafa;
    font-weight: 600;
}

/* ===== Loading ===== */
.loading-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
    font-size: 14px;
}

/* ===== Error/Empty ===== */
.error-msg {
    text-align: center;
    padding: 40px;
    color: #ff4d4f;
    font-size: 14px;
}

/* ===== Forms ===== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.form-label .required {
    color: #ff4d4f;
}

.form-input {
    padding: 8px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.15);
}

.form-input[disabled] {
    background: #f5f5f5;
    color: #999;
}

.form-input-inline {
    padding: 4px 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid #f0f0f0;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-block;
    padding: 8px 20px;
    background: #1890ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #40a9ff;
    color: #fff;
}

.btn-cancel-link {
    color: #999;
    font-size: 13px;
    text-decoration: none;
    padding: 8px 0;
}

.btn-cancel-link:hover {
    color: #666;
}

.btn-danger {
    display: inline-block;
    padding: 8px 16px;
    background: #fff;
    color: #ff4d4f;
    border: 1px solid #ff4d4f;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

.link-action {
    color: #1890ff;
    font-size: 13px;
    text-decoration: none;
}

.link-action:hover {
    color: #40a9ff;
}

.link-danger {
    color: #ff4d4f;
    font-size: 13px;
    text-decoration: none;
}

.link-danger:hover {
    text-decoration: underline;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.badge-lvl0 { background: #f0f0f0; color: #999; }
.badge-lvl1 { background: #e6f7ff; color: #1890ff; }
.badge-lvl2 { background: #fff7e6; color: #fa8c16; }
.badge-lvl3 { background: #fff2f0; color: #ff4d4f; }

/* ===== Success Message ===== */
.success-msg {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    border-radius: 6px;
    padding: 12px 16px;
    color: #52c41a;
    margin-bottom: 16px;
}

/* ===== Item Checklist ===== */
.item-checklist {
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.item-check-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    border-bottom: 1px solid #fafafa;
}

.item-check-row:last-child {
    border-bottom: none;
}

.item-check-row:hover {
    background: #fafafa;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.check-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #999;
}

/* ===== Responsive Forms ===== */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .item-check-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-sidebar {
        display: none;
    }

    .app-main {
        padding: 12px;
    }

    .login-box {
        width: 90%;
        padding: 32px 20px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .data-table {
        font-size: 12px;
    }
    .data-table th,
    .data-table td {
        padding: 8px;
    }
}

/* ===== Search Card ===== */
.search-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    margin-bottom: 16px;
}

.search-form { display: flex; flex-direction: column; gap: 12px; }

.search-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.search-field { display: flex; flex-direction: column; gap: 4px; }

.search-field label { font-size: 12px; color: #999; font-weight: 600; }

.search-field input, .search-field select {
    padding: 8px 10px; border: 1px solid #d9d9d9; border-radius: 6px;
    font-size: 13px; outline: none; font-family: inherit;
}

.search-field input:focus, .search-field select:focus {
    border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.15);
}

.search-actions { display: flex; gap: 8px; align-items: center; }

.btn-outline {
    display: inline-block; padding: 7px 16px; background: #fff;
    color: #555; border: 1px solid #d9d9d9; border-radius: 6px;
    font-size: 13px; text-decoration: none; cursor: pointer; transition: all 0.2s;
}

.btn-outline:hover { border-color: #1890ff; color: #1890ff; }

.btn-lg { padding: 10px 28px; font-size: 15px; }

/* ===== Record Cards ===== */
.record-cards { display: flex; flex-direction: column; gap: 10px; }

.record-card {
    display: block; background: #fff; border-radius: 8px; padding: 16px 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); text-decoration: none; color: inherit;
    transition: box-shadow 0.2s, transform 0.1s; border-left: 4px solid transparent;
}

.record-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); border-left-color: #1890ff; transform: translateX(2px); }

.rc-header { display: flex; gap: 16px; align-items: center; margin-bottom: 10px; }

.rc-id { font-weight: 800; font-size: 15px; color: #1890ff; }

.rc-lot { font-size: 13px; color: #555; font-weight: 600; }

.rc-time { font-size: 12px; color: #999; margin-left: auto; }

.rc-body { display: flex; flex-direction: column; gap: 8px; }

.rc-info { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: #666; }

.rc-items { display: flex; flex-wrap: wrap; gap: 6px; }

.rc-item-tag {
    padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 500;
    white-space: nowrap; background: #f0f0f0; color: #666;
}

.rc-item-tag.tag-ok { background: #f6ffed; color: #52c41a; }
.rc-item-tag.tag-low { background: #fff7e6; color: #fa8c16; }
.rc-item-tag.tag-high { background: #fff2f0; color: #ff4d4f; }

.rc-item-more { padding: 2px 8px; font-size: 12px; color: #999; }

/* ===== Info Cards ===== */
.info-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }

.info-card {
    display: flex; align-items: center; gap: 12px; background: #fff;
    border-radius: 8px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.info-card-icon { font-size: 28px; }

.info-card-text { display: flex; flex-direction: column; }

.info-card-label { font-size: 11px; color: #999; text-transform: uppercase; letter-spacing: 0.5px; }

.info-card-value { font-size: 15px; font-weight: 700; color: #333; }

.info-card-sub { font-size: 12px; color: #999; }

/* ===== Assay Data Table ===== */
.row-pass { }
.row-below { background: #fffbe6; }
.row-above { background: #fff1f0; }

.badge-pass { background: #f6ffed; color: #52c41a; }
.badge-low { background: #fff7e6; color: #fa8c16; font-weight: 600; }
.badge-high { background: #fff2f0; color: #ff4d4f; font-weight: 600; }

/* ===== Nice Form ===== */
.nice-form { display: flex; flex-direction: column; gap: 16px; }

.form-row { display: flex; gap: 16px; }

.form-field { flex: 1; display: flex; flex-direction: column; gap: 4px; }

.form-field label { font-size: 13px; font-weight: 600; color: #555; }

.form-field .required { color: #ff4d4f; }

.form-field input, .form-field select, .form-field textarea {
    padding: 9px 12px; border: 1px solid #d9d9d9; border-radius: 6px;
    font-size: 14px; font-family: inherit; outline: none;
    transition: border-color 0.2s;
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.15);
}

.flex-2 { flex: 2; }
.flex-3 { flex: 3; }

.section-title { font-size: 16px; font-weight: 700; color: #333; margin-top: 8px; padding-top: 16px; border-top: 1px solid #f0f0f0; }

.section-hint { font-size: 13px; color: #999; }

/* ===== Checklist Table ===== */
.checklist-table-wrap { border: 1px solid #f0f0f0; border-radius: 8px; overflow: hidden; }

.checklist-table { width: 100%; border-collapse: collapse; font-size: 13px; }

.checklist-table th { background: #fafafa; padding: 10px 12px; text-align: left; font-weight: 600; color: #555; border-bottom: 1px solid #eee; }

.checklist-table td { padding: 8px 12px; border-bottom: 1px solid #f8f8f8; }

.checklist-table tr:last-child td { border-bottom: none; }

.checklist-table tr.row-selected { background: #e6f7ff; }

.checklist-table tr:hover { background: #fafafa; }

.checklist-table tr.row-selected:hover { background: #d6efff; }

.tbl-input { width: 80px; padding: 5px 8px; border: 1px solid #d9d9d9; border-radius: 4px; font-size: 13px; text-align: center; outline: none; }

.tbl-input:focus { border-color: #1890ff; }

/* ===== Chip Selector ===== */
.chip-selector { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 12px 16px; border: 2px solid #e8e8e8; border-radius: 10px;
    cursor: pointer; transition: all 0.2s; min-width: 90px; user-select: none;
}

.chip input[type="checkbox"] { display: none; }

.chip:hover { border-color: #91d5ff; background: #f0f9ff; }

.chip-active { border-color: #1890ff; background: #e6f7ff; }

.chip-text { font-size: 14px; font-weight: 600; color: #333; }

.chip-sub { font-size: 11px; color: #999; }

/* ===== User Profile Card ===== */
.user-profile-card {
    display: flex; align-items: center; gap: 20px; background: #fff;
    border-radius: 10px; padding: 24px; box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.user-avatar {
    width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, #1890ff, #36cfc9);
    color: #fff; font-size: 28px; font-weight: 800; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
}

.user-meta { display: flex; flex-direction: column; gap: 4px; }

.user-meta h3 { font-size: 20px; color: #1a1a1a; }

/* ===== Info List ===== */
.info-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; }

.info-list dt { font-size: 12px; color: #999; font-weight: 600; }

.info-list dd { font-size: 13px; color: #555; }

.info-list code { font-size: 11px; background: #f5f5f5; padding: 2px 6px; border-radius: 3px; word-break: break-all; }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 48px; color: #bbb; font-size: 15px; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .form-row { flex-direction: column; }
    .info-cards { grid-template-columns: 1fr 1fr; }
    .search-row { grid-template-columns: 1fr 1fr; }
    .user-profile-card { flex-direction: column; text-align: center; }
    .chip-selector { gap: 6px; }
    .chip { min-width: 70px; padding: 10px 12px; }
}

/* ===== Form Table ===== */
.form-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}

.form-table th, .form-table td {
    padding: 12px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle;
}

.ft-label {
    width: 120px; text-align: right; font-weight: 600; color: #555; font-size: 13px;
    background: #fafafa; white-space: nowrap;
}

.ft-label .required { color: #ff4d4f; margin-left: 2px; }

.ft-value input {
    width: 100%; padding: 9px 12px; border: 1px solid #e0e0e0; border-radius: 6px;
    font-size: 14px; font-family: inherit; outline: none; transition: border-color 0.2s;
}

.ft-value input:focus {
    border-color: #1890ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.12);
}

.ft-value input::placeholder { color: #ccc; }

.ft-actions {
    padding: 16px 14px !important; border-bottom: none !important;
    display: flex; gap: 12px; align-items: center;
}
