/* 隐藏特定数字输入框（数量）的微调按钮 */
#in-quantity::-webkit-inner-spin-button,
#in-quantity::-webkit-outer-spin-button,
#out-quantity::-webkit-inner-spin-button,
#out-quantity::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#in-quantity,
#out-quantity {
  -moz-appearance: textfield;
}

:root {
    /* 设计系统变量 */

    /* 主色调 */
    --primary-color: #1A1A1A;        /* 深黑色 - 主要元素 */
    --secondary-color: #6B7280;      /* 中性灰 - 次要信息 */
    --success-color: #10B981;        /* 绿色 - 成功状态 */
    --warning-color: #F59E0B;        /* 橙色 - 警告状态 */
    --danger-color: #EF4444;         /* 红色 - 错误/危险 */

    /* 背景色 */
    --background-color: #F9FAFB;     /* 浅灰白 - 页面背景 */
    --surface-color: #FFFFFF;        /* 纯白 - 卡片背景 */

    /* 文字颜色 */
    --text-primary: #111827;         /* 深灰 - 主要文字 */
    --text-secondary: #6B7280;       /* 中灰 - 次要文字 */

    /* 圆角 */
    --rounded-sm: 8px;
    --rounded-md: 12px;
    --rounded-lg: 20px;

    /* 字体 */
    --font-family-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}

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

body {
    font-family: var(--font-family-system);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px; /* 增加基础字体大小 */
}

.site-logo {
    position: absolute;
    top: 85px; /* Adjust this value to be below the navbar */
    left: 40px;
    max-width: 150px;
    z-index: 10;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    padding-top: 80px; /* Add padding to container to avoid content being hidden by nav-bar */
}

.header {
    background: var(--primary-color);
    color: var(--surface-color);
    padding: 25px;
    border-radius: var(--rounded-lg);
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 600;
}

.header .version {
    opacity: 0.7;
    font-size: 14px;
}

.main-content {
    /* 布局已简化 */
}

.left-panel {
   display: none; /* 隐藏左侧面板 */
}

.right-panel {
    background: var(--surface-color);
    border-radius: var(--rounded-lg);
    padding: 25px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 1200px;
    margin: 0 auto;
}

.inline-input {
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #ddd;
    border-radius: 0;
    padding: 4px 2px;
    font-family: inherit;
    font-size: inherit;
    transition: all 0.3s;
    text-align: center;
}
.inline-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 1px 0 var(--primary-color);
}
.report-title .inline-input {
    width: 300px;
    font-size: 24px;
    font-weight: bold;
    border-bottom-width: 2px;
}
.report-header .inline-input {
    width: 180px;
}

/* --- 全局输入框、下拉菜单、文本域新样式 --- */
.report-table input,
.report-table select,
.report-table textarea {
    width: 100%;
    padding: 8px 10px; /* 增加了垂直和水平内边距 */
    border: 1px solid #D1D5DB; /* 更柔和的边框颜色 */
    border-radius: var(--rounded-sm);
    box-sizing: border-box;
    background-color: #F9FAFB; /* 浅灰色背景 */
    text-align: center;
    font-size: 14px; /* 统一字体大小 */
    font-family: inherit; /* 继承body字体 */
    color: var(--text-primary);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* 平滑过渡效果 */
}

/* 移除textarea的大小调整手柄 */
.report-table textarea {
    resize: none;
    text-align: left; /* 文本域左对齐 */
    padding: 10px;
}

/* 鼠标悬停效果 */
.report-table input:hover,
.report-table select:hover,
.report-table textarea:hover {
    border-color: #9CA3AF; /* 悬停时边框颜色加深 */
}

/* 聚焦效果 */
.report-table input:focus,
.report-table select:focus,
.report-table textarea:focus {
    outline: none;
    border-color: #3B82F6; /* 聚焦时边框变为蓝色 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); /* 柔和的蓝色辉光 */
    background-color: var(--surface-color); /* 聚焦时背景变为纯白 */
}

.signature-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
    font-size: 14px;
    color: var(--text-primary);
    font-family: "SimHei", "黑体", var(--font-family-system);
}

.instructions-section {
    margin-top: 30px;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: "SimHei", "黑体", var(--font-family-system);
    line-height: 1.6;
}

.instructions-section h4 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: bold;
}

.instructions-section ol {
    padding-left: 20px;
}

.signature-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.signature-section input {
    flex-grow: 1;
    text-align: left;
    padding: 5px;
    box-sizing: border-box;
    background-color: transparent;
    border: none;
    border-bottom: 1px solid #ccc;
    transition: all 0.3s;
}
.signature-section input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 1px 0 var(--primary-color);
}


.preview-section h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
}

.report-preview {
    border: 1px solid #e5e7eb; /* <-- 恢复此处的浅灰色边框 */
    background: var(--surface-color);
    padding: 30px;
    font-family: "SimSun", serif;
    line-height: 1.8;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-radius: var(--rounded-lg);
}

.report-title {
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.report-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 15px; /* 增加字体大小 */
    color: var(--text-primary);
    font-family: "SimHei", "黑体", var(--font-family-system);
}

.report-unit-info {
    text-align: right;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
    font-family: "SimHei", "黑体", var(--font-family-system);
}

/* --- New, Robust Table Border Styling --- */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    font-size: 14px;
}

/* Set top border for the first table only */
.report-table:first-of-type {
    border-top: 2px solid black;
}
/* Set bottom border for the last table only */
.report-table:last-of-type {
    border-bottom: 2px solid black;
}

/* This rule ensures the border between connected tables is the standard 1px width */
.report-table + .report-table {
    border-top: 1px solid black;
}

.report-table th,
.report-table td {
    border: 1px solid black;
    padding: 8px;
    text-align: center;
}

/* Explicitly set thick outer side borders */
.report-table th:first-child,
.report-table td:first-child {
    border-left: 2px solid black;
}
.report-table th:last-child,
.report-table td:last-child {
    border-right: 2px solid black;
}

/* Remove outer side borders */
.report-table th:first-child,
.report-table td:first-child {
    border-left: none;
}
.report-table th:last-child,
.report-table td:last-child {
    border-right: none;
}

.report-table .valign-middle {
    vertical-align: middle;
}

/* The old rules for manually creating thick borders are no longer needed. */

.report-table th {
    background-color: var(--background-color);
    font-weight: bold;
    color: var(--text-primary);
}

/* 列宽定义 */
.report-table .col-item { width: 8%; }
.report-table .col-date { width: 12%; }
.report-table .col-type { width: 12%; }
.report-table .col-condition { width: 12%; }
.report-table .col-grade { width: 8%; }
.report-table .col-percent { width: 8%; }
.report-table .col-quantity { width: 12%; }
.report-table .col-status { width: 10%; }


.report-table .highlight {
    font-weight: bold;
}

.report-table .warning {
    color: var(--danger-color);
    font-weight: bold;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--rounded-md);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn .material-symbols-rounded {
    font-size: 20px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover {
    background: #374151;
}

.btn-success {
    background: var(--success-color);
    color: white;
}
.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}
.btn-secondary:hover {
    background: #4b5563;
}

.status-bar {
    background: var(--surface-color);
    color: var(--text-secondary);
    padding: 10px 20px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-size: 14px;
    z-index: 1000;
    border-top: 1px solid #e5e7eb;
}

.warning-banner {
    background: linear-gradient(90deg, var(--danger-color), var(--warning-color));
    color: white;
    padding: 12px;
    text-align: center;
    border-radius: var(--rounded-md);
    margin-bottom: 20px;
    font-weight: 500;
    display: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.warning-banner.show {
    display: block;
    animation: pulse 1.5s infinite;
}

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

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

.nav-bar {
    width: 100%;
    background-color: #ffffff;
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    justify-content: center; /* Center navigation links */
    align-items: center;
}
.nav-bar .nav-links {
    display: flex;
    gap: 25px;
}
.nav-bar a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.nav-bar a:hover {
    background-color: #f0f4f8;
}
.nav-bar a.active {
    background-color: #e2e8f0;
    color: #1a202c;
    font-weight: 600;
}

/* Hide number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

@keyframes modal-bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    60% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.modal-overlay.visible .modal-dialog {
    transform: scale(1);
    animation: modal-bounce-in 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.modal-dialog h3 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
