/* ============================================================
   Quotation System — main.css
   Single CSS file for both price panels
   All units in em/rem (1em = 16px base)
   ============================================================ */

/* === 1. Responsive text helpers === */
.d-only { display: inline; }
.m-only { display: none; }

/* === 2. Container — two panels side by side === */
#price-panels-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5em;
    width: 100%;
}
#price-panels-container .parameter-section-wrapper {
    flex: 0 0 calc(50% - 0.25em);
    width: calc(50% - 0.25em);
    min-width: 0;
    box-sizing: border-box;
}

/* === 3. Panel shell === */
.qt-panel { margin: 0; }
.qt-panel-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85em;
    color: #333;
    background: #fafbfc;
    border-bottom: 1px solid #e4e7ed;
    padding: 0.5em 0.875em;
    list-style: none;
    user-select: none;
}
.qt-panel-summary::-webkit-details-marker { display: none; }
.qt-panel-body { padding: 0.625em; background: #fff; }
.qt-section-label {
    font-size: 0.72em;
    color: #909399;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375em;
}

/* === 4. Factor table === */
.ft-grid {
    display: grid;
    grid-template-columns: 7.5em 1fr 1fr;
    gap: 1px;
    background: #e4e7ed;
    border: 1px solid #e4e7ed;
    border-radius: 0.25em;
    overflow: hidden;
}
.ft-grid > div {
    background: #fff;
    padding: 0.3em 0.5em;
    display: flex;
    align-items: center;
    font-size: 0.8em;
}
.ft-hdr {
    background: #fafbfc !important;
    font-weight: 600;
    font-size: 0.72em !important;
    color: #606266;
    justify-content: center;
}
.ft-lbl { font-weight: 600; font-size: 0.76em !important; color: #555; }
.ft-input {
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    padding: 0.25em 0.375em;
    text-align: center;
    font-size: 0.8em;
    width: 100%;
    height: 1.75em;
    box-sizing: border-box;
    max-width: 6em;
}
.ft-input:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 0.125em rgba(24,144,255,0.15);
}

/* === 5. Section spacer === */
.qt-sp-section { margin-top: 0.875em; }

/* === 6. Special products — card layout === */
.sp-tbl {
    display: block;
    background: transparent;
    border: none;
    margin-top: 10px;
}
.sp-header, .sp-tbl-row.sp-header {
    display: none !important;
}

.sp-rule-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #dcdfe6;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}
.sp-rule-card:hover {
    border-color: #1890ff;
    box-shadow: 0 3px 8px rgba(24,144,255,0.1);
}
.sp-rule-card:nth-child(even) { background: #f9faff; }

.sp-rule-main {
    display: grid;
    grid-template-columns: 1.2fr 1.1fr 1.1fr 1fr 1fr 40px;
    padding: 12px 10px;
    gap: 12px;
    align-items: flex-end;
}
.sp-rule-extra {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 12px;
    background: #fffdf5;
    border-top: 1px dashed #ffe58f;
    font-size: 0.75em;
    color: #666;
    flex-wrap: wrap;
}
.sp-rule-col {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.sp-rule-col label {
    font-size: 10px;
    color: #909399;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 2px;
    white-space: nowrap;
}
.sp-rule-action {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 5px;
}
.sp-rule-extra-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.sp-rule-extra-item span { font-weight: 600; color: #555; }
.sp-rule-extra-item input.sp-cext-inp {
    width: 55px;
    height: 24px;
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    text-align: center;
    padding: 0 4px;
    font-size: 1em;
}
.sp-del, .sp-remove-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #ff4d4f;
    color: #ff4d4f;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
    transition: all 0.2s;
}
.sp-del:hover, .sp-remove-btn:hover { background: #ff4d4f; color: #fff; }

.sp-select {
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    padding: 3px 5px;
    font-size: 0.85em;
    width: 100%;
    height: 28px;
    background: #fff;
}
.sp-input, .sp-rule-main input[type="number"] {
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    padding: 3px 2px;
    text-align: center;
    font-size: 0.9em;
    width: 100%;
    height: 28px;
    box-sizing: border-box;
}

.sp-segmented, .sp-seg {
    display: flex;
    border: 1px solid #dcdfe6;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
    height: 28px;
}
.sp-segmented label, .sp-seg label {
    padding: 0 8px;
    font-size: 0.72em;
    cursor: pointer;
    background: #fff;
    color: #606266;
    border-right: 1px solid #dcdfe6;
    margin: 0;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-segmented label:last-child, .sp-seg label:last-child { border-right: none; }
.sp-segmented input, .sp-seg input { display: none; }
.sp-segmented label:has(input:checked), .sp-seg label:has(input:checked) { background: #1890ff; color: #fff; }
.sp-select {
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    padding: 0.2em 0.3em;
    font-size: inherit;
    width: 100%;
    height: 1.625em;
}
.sp-input {
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    padding: 0.2em 0.3em;
    text-align: center;
    font-size: inherit;
    width: 100%;
    height: 1.625em;
    box-sizing: border-box;
    max-width: 5em;
}
.sp-seg {
    display: flex;
    border: 1px solid #dcdfe6;
    border-radius: 0.2em;
    overflow: hidden;
    flex-shrink: 0;
}
.sp-seg label {
    padding: 0.15em 0.4em;
    font-size: 0.9em;
    cursor: pointer;
    background: #fff;
    color: #606266;
    border-right: 1px solid #dcdfe6;
    margin: 0;
    white-space: nowrap;
}
.sp-seg label:last-child { border-right: none; }
.sp-seg input[type=radio] { display: none; }
.sp-seg label:has(input:checked) { background: #1890ff; color: #fff; }
.sp-del {
    width: 1.375em;
    height: 1.375em;
    border: 1px solid #f5c6cb;
    background: #fff5f5;
    color: #e74c3c;
    border-radius: 0.2em;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    font-size: 0.9em;
    line-height: 1;
}
.sp-del:hover { background: #fde2e2; }
.sp-cext {
    grid-column: 1 / -1;
    padding: 0.2em 0.5em;
    background: #fffdf5;
    border-top: 1px dashed #ffe58f;
    font-size: 0.72em;
    color: #8c8c8c;
    display: flex;
    gap: 0.625em;
    flex-wrap: wrap;
    align-items: center;
}
.sp-cext span { white-space: nowrap; }
.sp-cext input {
    width: 3em;
    height: 1.25em;
    padding: 0.06em 0.2em;
    border: 1px solid #d9d9d9;
    border-radius: 0.125em;
    font-size: 0.85em;
    text-align: center;
}
.sp-cext-promo {
    cursor: pointer;
    color: #e74c3c;
    font-weight: 600;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.125em;
}
.sp-cext-promo input[type=checkbox] {
    width: 0.8em;
    height: 0.8em;
    margin: 0;
}
.qt-sp-btns {
    margin-top: 0.5em;
    display: flex;
    gap: 0.375em;
    align-items: center;
    flex-wrap: wrap;
}
.qt-sp-btn {
    border: 1px dashed #1890ff;
    background: #f0f7ff;
    color: #1890ff;
    border-radius: 0.25em;
    cursor: pointer;
    font-size: 0.78em;
    padding: 0.3em 0.75em;
}
.qt-sp-btn:hover { background: #e6f4ff; }
.qt-sp-btn-save {
    background: #2b7aa2;
    color: #fff;
    border: none;
}
.sp-temp-pat { font-weight: 600; color: #0056b3; font-size: 0.85em; }
.sp-temp-sz,
.sp-temp-md { font-size: 0.85em; color: #555; }

/* === 7. Fluctuation controller === */
.fluct {
    display: flex;
    align-items: center;
    gap: 0.5em;
    background: #f0f7ff;
    border: 1px solid #b3d8ff;
    border-radius: 0.25em;
    padding: 0.375em 0.625em;
    flex-wrap: wrap;
    margin-top: 0.875em;
}
.fluct-title {
    font-weight: 600;
    color: #0369a1;
    font-size: 0.82em;
    flex-shrink: 0;
}
.fluct-group {
    display: flex;
    align-items: center;
    gap: 0.4em;
    background: #fff;
    padding: 0.125em 0.5em;
    border-radius: 0.25em;
    border: 1px solid #bbe5fd;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.fluct-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex-shrink: 0;
}
.fluct-btn {
    width: 1.25em;
    height: 0.875em;
    border: 1px solid #a1d8fd;
    background: #f0f9ff;
    border-radius: 0.125em;
    cursor: pointer;
    font-size: 0.5em;
    color: #0369a1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}
.fluct-val {
    min-width: 1.5em;
    text-align: center;
    font-size: 0.85em;
    font-weight: 700;
    color: #0284c7;
    flex-shrink: 0;
}
.fluct-chk {
    border-left: 1px solid #bbe5fd;
    padding-left: 0.5em;
    display: flex;
    align-items: center;
    gap: 0.25em;
    flex-shrink: 0;
    min-width: 5.5em;
}
.fluct-chk input[type=checkbox] {
    width: 0.8em;
    height: 0.8em;
    margin: 0;
}
.fluct-chk label {
    font-size: 0.72em;
    font-weight: 600;
    color: #0369a1;
    cursor: pointer;
    white-space: nowrap;
}
.fluct-save {
    height: 1.625em;
    padding: 0 0.5em;
    border: 1px solid #ddd;
    background: #fafafa;
    border-radius: 0.2em;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    font-size: 0.78em;
    white-space: nowrap;
    flex-shrink: 0;
}
.fluct-save:hover { background: #f0f0f0; }
.fluct-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1px;
    font-size: 0.72em;
    color: #0c4a6e;
    margin-top: 0.5em;
    padding-top: 0.3em;
    border-top: 1px dashed #b3d8ff;
}
.fluct-v { font-weight: 700; color: #0284c7; }
#fluctuationStatus { font-size: 0.65em; color: #64748b; }

/* === 8. MOBILE (max-width: 768px) === */
@media (max-width: 768px) {
    .d-only { display: none; }
    .m-only { display: inline; }

    #price-panels-container {
        flex-direction: column;
        flex-wrap: wrap;
        gap: 0.375em;
    }
    #price-panels-container .parameter-section-wrapper {
        flex: none;
        width: 100%;
    }

    .ft-grid { grid-template-columns: 5.3em 1fr 1fr; }
    .ft-grid > div { padding: 0.25em 0.3em; font-size: 0.72em; }
    .ft-lbl { font-size: 0.72em !important; }
    .ft-input { height: 1.625em; font-size: 0.75em; padding: 0.125em 0.25em; max-width: 5em; }
    .ft-hdr { font-size: 0.68em !important; }

    .sp-tbl-row { grid-template-columns: 1fr 0.55fr 0.65fr 0.75fr 0.75fr 1.75em; }
    .sp-tbl-row > div { padding: 0.2em 0.25em; font-size: 0.72em; }
    .sp-select { height: 1.5em; font-size: 0.72em; }
    .sp-input { height: 1.5em; font-size: 0.72em; max-width: 4em; }
    .sp-seg label { padding: 0.125em 0.25em; font-size: 0.68em; }
    .sp-del { width: 1.125em; height: 1.125em; font-size: 0.75em; }
    .sp-cext { gap: 0.25em; padding: 0.125em 0.3em; font-size: 0.65em; }
    .sp-cext input { width: 2.5em; height: 1.125em; font-size: 0.75em; }

    .fluct { flex-wrap: wrap; padding: 0.3em 0.5em; gap: 0.5em; }
    .fluct-title { font-size: 0.75em; }
    .fluct-group { flex-wrap: wrap; gap: 0.4em; padding: 0.25em 0.5em; }
    .fluct-chk { padding-left: 0.4em; gap: 0.25em; border-left: 1px solid #bbe5fd; }
    .fluct-save { height: 1.625em; padding: 0 0.5em; font-size: 0.72em; }
    .fluct-info { width: 100%; text-align: right; margin-top: 0.125em; font-size: 0.68em; }

    .qt-panel-summary { font-size: 0.8em; padding: 0.4em 0.75em; }
    .qt-panel-body { padding: 0.5em; }
}
