/* Windows Classic Dialog Style */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'MS Sans Serif', 'Microsoft Sans Serif', 'Segoe UI', Arial, sans-serif;
    font-size: 8pt;
    background: #c0c0c0;
    margin: 0;
    padding: 0;
}

/* Menu Bar */
.menu-bar {
    background: #c0c0c0;
    border-bottom: 2px groove #ffffff;
    display: flex;
    padding: 2px;
    font-size: 8pt;
}

.menu-item {
    position: relative;
    padding: 2px 8px;
    cursor: pointer;
}

.menu-item:hover {
    background: #000080;
    color: #ffffff;
}

.menu-title {
    user-select: none;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    box-shadow: 2px 2px 0 #000000;
    min-width: 150px;
    z-index: 1000;
}

.menu-item:hover .menu-dropdown {
    display: block;
}

.menu-option {
    padding: 4px 20px 4px 8px;
    cursor: pointer;
}

.menu-option:hover {
    background: #000080;
    color: #ffffff;
}

.menu-option.disabled {
    color: #808080;
    cursor: default;
}

.menu-option.disabled:hover {
    background: #c0c0c0;
    color: #808080;
}

.menu-separator {
    height: 1px;
    background: #808080;
    margin: 2px 4px;
}

/* Data Status */
#data-status {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 7pt;
    background: #d0d0d0;
    border: 1px solid #808080;
    cursor: help;
}

#data-status.custom-data {
    background: #ffffcc;
    color: #000080;
    font-weight: bold;
}

/* Main Window Container */
.main-window {
    width: 586px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    box-shadow: 2px 2px 0 #000000;
    display: flex;
    padding: 2px;
    margin: 20px auto;
}

/* Components Group (Left Panel) */
.components-group {
    flex: 0 0 202px;
    margin: 0;
    padding: 4px;
}

/* Component Row */
.component-row {
    display: flex;
    align-items: center;
    margin-bottom: 3px;
    height: 14px;
}

.chk-fix {
    width: 13px;
    height: 13px;
    margin: 0 2px 0 0;
}

.component-row label {
    font-size: 8pt;
    margin: 0 4px 0 0;
    white-space: nowrap;
    width: 38px;
}

.cbo-component {
    width: 86px;
    height: 18px;
    font-size: 8pt;
    font-family: 'MS Sans Serif', Arial;
    border: 1px solid #7f9db9;
    background: white;
    margin-right: 4px;
}

.txt-percent {
    width: 40px;
    height: 18px;
    font-size: 8pt;
    text-align: center;
    border: 1px inset #7f9db9;
    background: #e0e0e0;
    padding: 1px;
}

.txt-percent:not([readonly]) {
    background: white;
}

/* Mixture Row */
.mixture-row {
    display: flex;
    align-items: center;
    margin: 8px 0 6px 0;
    height: 18px;
}

.mixture-row label {
    font-size: 8pt;
    margin-right: 4px;
    width: 42px;
}

.cbo-mixture {
    width: 140px;
    height: 18px;
    font-size: 8pt;
    font-family: 'MS Sans Serif', Arial;
    border: 1px solid #7f9db9;
    background: white;
}

/* Price Row */
.price-row {
    display: flex;
    align-items: center;
    margin: 6px 0;
    flex-wrap: wrap;
}

.price-row label {
    font-size: 8pt;
    width: 100%;
    margin-bottom: 2px;
}

.txt-price {
    width: 60px;
    height: 18px;
    font-size: 8pt;
    text-align: right;
    border: 1px inset #7f9db9;
    background: white;
    padding: 1px 3px;
}

/* Calculate Button */
.btn-calculate {
    width: 80px;
    height: 22px;
    font-size: 8pt;
    font-family: 'MS Sans Serif', Arial;
    background: linear-gradient(to bottom, #ffffff 0%, #dfdfdf 100%);
    border: 1px outset #ffffff;
    cursor: pointer;
    margin: 8px 0 0 0;
}

.btn-calculate:active {
    border: 1px inset #7f9db9;
    background: #c0c0c0;
}

/* Results Group (Right Panel) */
.results-group {
    flex: 1;
    margin: 0 0 0 2px;
}

.results-group fieldset {
    border: 2px groove #ffffff;
    padding: 8px 4px 4px 4px;
    margin: 0;
    height: 100%;
}

.results-group legend {
    font-weight: bold;
    padding: 0 4px;
}

/* Results Grid */
.results-grid {
    font-size: 8pt;
    height: 100%;
    overflow: hidden;
}

.results-header {
    display: none; /* Hidden, just for structure */
}

#results-container {
    display: flex;
    flex-direction: column;
}

.result-row {
    display: flex;
    align-items: center;
    height: 14px;
    margin-bottom: 0px;
}

.result-row input[type="text"] {
    height: 14px;
    font-size: 7pt;
    text-align: center;
    border: 1px inset #7f9db9;
    background: #e0e0e0;
    padding: 0 2px;
    margin-right: 2px;
}

.result-row .col-percent {
    width: 30px;
}

.result-row .col-price {
    width: 30px;
}

.result-row .col-result {
    width: 30px;
}

.result-row .col-param {
    flex: 1;
    display: flex;
    align-items: center;
}

.result-row input[type="checkbox"] {
    width: 13px;
    height: 13px;
    margin: 0 4px 0 4px;
}

.result-row label {
    font-size: 8pt;
    cursor: pointer;
    user-select: none;
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: #c0c0c0;
    border-top: 1px solid #808080;
    display: flex;
    font-size: 8pt;
    font-family: 'MS Sans Serif', Arial;
}

.status-part {
    padding: 2px 6px;
    border-right: 1px solid #808080;
    border-left: 1px solid #ffffff;
    display: flex;
    align-items: center;
}

#status1 {
    flex: 0 0 100px;
}

#status2 {
    flex: 0 0 100px;
}

#status3 {
    flex: 1;
}

/* Dialog Overlay */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.dialog-window {
    background: #c0c0c0;
    border: 2px outset #ffffff;
    box-shadow: 2px 2px 0 #000000;
    min-width: 400px;
    max-width: 500px;
}

.dialog-title {
    background: #000080;
    color: #ffffff;
    padding: 4px 8px;
    font-weight: bold;
    font-size: 8pt;
}

.dialog-content {
    padding: 12px;
}

.dialog-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.dialog-row label {
    flex: 0 0 140px;
    font-size: 8pt;
}

.dialog-select,
.dialog-input {
    flex: 1;
    padding: 2px 4px;
    border: 1px solid #808080;
    font-family: 'MS Sans Serif', Arial;
    font-size: 8pt;
    background: #ffffff;
}

.dialog-input[readonly] {
    background: #f0f0f0;
    color: #808080;
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-group label {
    flex: initial;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dialog-separator {
    height: 1px;
    background: #808080;
    margin: 12px 0;
}

.dialog-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

.dialog-btn {
    padding: 4px 16px;
    border: 2px outset #ffffff;
    background: #c0c0c0;
    font-family: 'MS Sans Serif', Arial;
    font-size: 8pt;
    cursor: pointer;
}

.dialog-btn:hover {
    background: #d0d0d0;
}

.dialog-btn:active {
    border: 2px inset #ffffff;
}

.dialog-btn:disabled {
    color: #808080;
    cursor: default;
}

/* Responsive adjustments */
@media (max-width: 650px) {
    .main-window {
        width: 100%;
        flex-direction: column;
    }

    .components-group {
        flex: 1;
    }

    .results-group {
        flex: 1;
        margin: 4px 0 0 0;
    }
}
