/**
 * calc.css — 报价计算器组件样式
 * 统一亮色主题，基于 Shoelace UI 组件库
 * 跨端（Web/H5/iOS/Android）一致体验
 */

/* ============================================
   Shoelace 全局变量覆盖（亮色，统一全站）
   ============================================ */

:root {
    /* 控件尺寸 */
    --sl-input-height-medium: 42px;
    --sl-input-font-size-medium: 14px;
    --sl-input-spacing-medium: 12px;

    /* 圆角矩形（非 pill）*/
    --sl-input-border-radius-medium: 8px;

    /* 品牌主色 */
    --sl-color-primary-500: #0047AB;
    --sl-color-primary-600: #003580;
    --sl-color-primary-700: #002970;
    --sl-color-primary-300: #4D94FF;
    --sl-color-primary-400: #2B78E4;
}

/* Lucide 图标全局规范 */
.lucide {
    width: 1.25em;
    height: 1.25em;
    stroke-width: 2px;
    vertical-align: middle;
    display: inline-block;
}

/* 特定上下文调整 */
.info-icon .lucide {
    color: var(--sl-color-primary-500);
}

.float-item .lucide {
    width: 22px;
    height: 22px;
    display: block;
}



/* 已选中的选项：显示高亮勾 */
sl-option[aria-selected="true"]::part(checked-icon) {
    opacity: 1;
    color: var(--sl-color-primary-500);
}

/* ============================================
   计算器卡片布局（首页深色背景中使用）
   ============================================ */

.calc-form {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 28px 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* 首页计算器：控件样式适配深色背景 */
.calc-form sl-select,
.calc-form sl-input,
.calc-form sl-range {
    --sl-input-background-color: rgba(255, 255, 255, 0.10);
    --sl-input-border-color: rgba(255, 255, 255, 0.18);
    --sl-input-color: #ffffff;
    --sl-input-placeholder-color: rgba(255, 255, 255, 0.40);
    --sl-input-border-color-hover: rgba(255, 255, 255, 0.32);
    --sl-input-border-color-focus: #4D94FF;
    --sl-input-focus-ring-color: rgba(77, 148, 255, 0.18);
    --sl-input-icon-color: rgba(255, 255, 255, 0.5);
}

.calc-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.calc-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0047AB, #0060DF);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 71, 171, 0.35);
}

.calc-icon svg {
    width: 22px;
    height: 22px;
    stroke: #ffffff;
}

.calc-header h4 {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 3px 0;
    line-height: 1.3;
}

.calc-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0;
    line-height: 1;
}

/* ============================================
   字段与标签（首页计算器默认使用深色文字）
   ============================================ */

.calc-field {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
}

/* 首页 .calc-form 内使用白色标签 */
.calc-form .calc-label {
    color: rgba(255, 255, 255, 0.78);
}

.calc-form .calc-optional {
    color: rgba(255, 255, 255, 0.38);
}

.calc-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

.calc-label em {
    color: #ef4444;
    font-style: normal;
    margin-left: 3px;
}

.calc-optional {
    font-size: 11px;
    color: #9ca3af;
    font-weight: normal;
}

/* 滑块数值展示 */
.calc-value-display {
    font-size: 13px;
    font-weight: 700;
    color: #0047AB;
    background: rgba(0, 71, 171, 0.09);
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: 0.01em;
}

/* 首页暗色背景内的数值显示 */
.calc-form .calc-value-display {
    color: #4D94FF;
    background: rgba(77, 148, 255, 0.15);
}

/* ============================================
   区域联动布局
   ============================================ */

.region-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

/* ============================================
   组件插槽样式 (单位 Addon)
   ============================================ */

.calc-form sl-input::part(suffix) {
    color: rgba(255, 255, 255, 0.50);
    font-weight: 600;
    font-size: 12px;
}

sl-input::part(suffix) {
    color: #6b7280;
    font-weight: 600;
    font-size: 12px;
}

/* ============================================
   弹窗专用样式 (quote.html 计算器 & 历史记录)
   ============================================ */

.quote-calculator {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overscroll-behavior: contain;
}

.quote-calculator>div {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 760px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
    -webkit-overflow-scrolling: touch;
}

/* 弹窗内的 Shoelace 控件使用全局 :root 默认（亮色），无需额外覆盖 */
.quote-calculator .calc-label {
    color: #374151;
}

.quote-calculator .calc-optional {
    color: #9ca3af;
}

.quote-calculator .calc-value-display {
    color: #0047AB;
    background: rgba(0, 71, 171, 0.08);
}

/* 分隔线 */
.calc-separator {
    height: 1px;
    background: #e5e7eb;
}

/* 按钮组 */
.calc-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.calc-btn {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    -webkit-appearance: none;
}

.calc-btn-primary {
    background: #0047AB;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 71, 171, 0.28);
}

.calc-btn-primary:hover {
    background: #003580;
    transform: translateY(-1px);
}

.calc-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1.5px solid #e5e7eb;
}

.calc-btn-secondary:hover {
    background: #e5e7eb;
}

/* ============================================
   历史记录弹窗
   ============================================ */

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

.quote-history-title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    color: #001D3D;
}

.quote-history-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.calc-btn-danger {
    flex: unset;
    padding: 0 14px;
    height: 36px;
    font-size: 13px;
    background: transparent;
    color: #ef4444;
    border: 1.5px solid #ef4444;
    border-radius: 8px;
}

.history-close-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s;
    -webkit-appearance: none;
}

.history-close-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.history-table-wrapper {
    max-height: 450px;
    overflow-y: auto;
    flex: 1;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.history-footer {
    text-align: right;
    margin-top: 16px;
    padding-top: 14px;
    font-size: 13px;
    color: #9ca3af;
    border-top: 1px solid #e5e7eb;
}

.history-count {
    font-weight: 700;
    color: #0047AB;
}

/* ============================================
   响应式适配
   ============================================ */

@media (max-width: 480px) {
    .quote-calculator>div {
        padding: 20px 16px;
        border-radius: 14px;
    }

    .calc-form {
        padding: 20px 16px;
    }

    .calc-actions {
        flex-direction: column;
    }

    .region-selects {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}