/**
 * 成本核算页面 - 样式（整合版）
 * 金信达智管平台 (JXD-SMP)
 *
 * @author JXD Team
 * @version 2.0.0
 * @date 2026-03-08
 */

/* ==================== 页面容器 ==================== */

.quote-calculate-container {
    min-height: 100vh;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
}

/* ==================== 页面头部 ==================== */

.page-header {
    background: var(--header-solid-color);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-base);
}

.header-left {
    flex: 1;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    letter-spacing: 0.5px;
}

.page-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 2px;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* ==================== 主内容区域 ==================== */

.main-content {
    flex: 1;
    padding: 12px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ==================== 表单区块 ==================== */

.form-section {
    background: white;
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 12px;
    overflow: hidden;
}

.section-header {
    background: var(--table-header-bg);
    padding: 10px 14px;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.section-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

.section-content {
    padding: 12px;
}

/* ==================== 表单网格 ==================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.cost-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

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

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-label.required::after {
    content: ' *';
    color: var(--error-color);
}

.form-input,
.form-select,
.form-textarea {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    transition: var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.form-hint {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* ==================== 数据表格 ==================== */

.table-container {
    overflow-x: auto;
}

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

.data-table th {
    background: var(--primary-color);
    color: white;
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}

.data-table td {
    padding: 6px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.data-table tbody tr:hover {
    background-color: var(--table-hover-bg);
}

.form-input-sm {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 12px;
    text-align: center;
}

.form-input-sm:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-input-sm.readonly {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.btn-icon-delete {
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    font-size: 11px;
    transition: var(--transition-fast);
}

.btn-icon-delete:hover {
    background: #d32f2f;
    transform: scale(1.1);
}

/* ==================== 表格汇总 ==================== */

.table-summary {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    padding: 10px;
    background: var(--table-header-bg);
    border-top: 2px solid var(--primary-color);
    margin-top: 8px;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.summary-unit {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== 结果展示 ==================== */

.result-section {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
}

.result-section .section-header {
    background: rgba(255, 255, 255, 0.1);
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

.result-section .section-title,
.result-section .section-subtitle {
    color: white;
}

/* 并列布局容器 */
.parallel-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* 3列表单网格 */
.form-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* 垂直排列的结果网格 */
.result-grid-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-grid-vertical .result-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    text-align: left;
}

.result-grid-vertical .result-label {
    margin-bottom: 0;
    font-size: 13px;
}

.result-grid-vertical .result-value {
    font-size: 18px;
    margin-bottom: 0;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.result-card {
    background: white;
    border-radius: 6px;
    padding: 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-base);
}

.result-card.highlight {
    background: linear-gradient(90deg, var(--success-color) 0%, var(--success-hover) 100%);
    color: white;
}

.result-card.highlight .result-label,
.result-card.highlight .result-value,
.result-card.highlight .result-hint {
    color: white;
}

.result-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.result-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.result-hint {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

/* ==================== 页面底部 ==================== */

.page-footer {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.05);
}

.footer-left {
    flex: 1;
}

.footer-text {
    font-size: 11px;
    color: var(--text-secondary);
}

.footer-right {
    display: flex;
    gap: 10px;
}

/* ==================== 通知消息 ==================== */

.notification {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 10px 16px;
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    animation: slideIn 0.3s ease;
    max-width: 350px;
    font-size: 13px;
}

.notification-success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success-color);
}

.notification-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error-color);
}

.notification-warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    color: var(--warning-color);
}

.notification-info {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: var(--info-color);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== 数据表格 ==================== */

.table-container {
    overflow-x: auto;
    margin-top: 8px;
}

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

.data-table thead {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
}

.data-table th {
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.data-table td {
    padding: 6px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: var(--table-hover-bg);
}

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

.data-table tbody tr:nth-child(even):hover {
    background-color: #f0f0f0;
}

/* 表格内的小输入框 */
.form-input-sm {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    text-align: center;
    transition: var(--transition-fast);
}

/* 移除数字输入框的上下箭头 */
.form-input-sm::-webkit-outer-spin-button,
.form-input-sm::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.form-input-sm[type=number] {
    -moz-appearance: textfield;
}

.form-input-sm:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.form-input-sm.readonly {
    background-color: #f5f5f5;
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* 表格内必填项标识 */
.required-label::before {
    content: '*';
    color: var(--error-color);
    margin-right: 4px;
}

/* ==================== 按钮图标 ==================== */

.btn-icon {
    margin-right: 4px;
}

/* ==================== 文本对齐 ==================== */

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

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

/* ==================== 响应式设计 ==================== */

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        padding: 10px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

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

    .form-grid-3 {
        grid-template-columns: 1fr;
    }

    .parallel-sections {
        grid-template-columns: 1fr;
    }

    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-footer {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    .footer-right {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .result-grid {
        grid-template-columns: 1fr;
    }

    .table-summary {
        flex-direction: column;
        gap: 8px;
    }
}
