.mps-calculator-wrapper {
    margin: 40px 0;
    width: 100%;
    background: #f1f5f9;
    border-radius: 16px;
    padding: 40px 30px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.mps-calculator-wrapper * {
    box-sizing: border-box;
}


.mps-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 50px;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: #1e293b;
    line-height: 1.1;
}

.mps-subtitle {
    text-align: center;
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 48px;
    font-weight: 400;
    line-height: 1.5;
}

.mps-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
}

.mps-left,
.mps-right {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
    padding: 32px;
    border: 1px solid #e2e8f0;
}

.mps-left {
    position: sticky;
    top: 20px;
}

.mps-inputs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.mps-input-block {
    display: flex;
    flex-direction: column;
}

.mps-input-block label {
    font-size: 12px;
    font-weight: 900;
    color: #374151;
    margin-bottom: 8px;
    line-height: 1.4;
    min-height: 56px;
    display: flex;
    align-items: flex-end;
    text-align: center;
    justify-content: center;
}

.mps-input-block {
    position: relative;
}

.mps-input-block input[type="number"] {
    width: 100%;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    transition: all 0.2s ease;
    outline: none;
    text-align: left;
    margin: 0 auto;
    height: 30px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.mps-input-block input[type="number"]:focus {
    border-color: #0f766e;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.mps-input-block input[type="number"]:hover {
    border-color: #9ca3af;
}

.mps-subheader {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 24px;
    padding-bottom: 0;
    border-bottom: none;
}


.mps-table-block {
    margin-top: 24px;
}


#mps-comp-table {
    width: 100%;
}

#mps-comp-table table {
    table-layout: fixed;
}

.mps-table-headers {
    display: flex;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 16px;
    padding-right: 24px;
}

.mps-table-title {
    padding: 20px 10px;
    text-align: left;
    font-size: 1.25rem;
    color: #1f2937;
    font-weight: 700;
    border-bottom: 1px solid #e5e7eb;
    width: 60%;
}

.mps-table-header {
    padding: 20px 5px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: center;
}

.mps-header-badge {
    background-color: #EEEEEE;
    padding: 7px 10px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: inline-block;
}


#mps-comp-table table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    margin-top: 0;
}

#mps-comp-table .mps-metric-name {
    padding: 20px 10px;
    text-align: left;
    font-size: 13px;
    color: #1f3723;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    width: 60%;
}

#mps-comp-table .mps-value {
    padding: 20px 24px;
    text-align: center;
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
    border-bottom: 1px solid #e5e7eb;
    width: 20%;
}

#mps-comp-table tr:last-child .mps-metric-name,
#mps-comp-table tr:last-child .mps-value {
    border-bottom: none;
}

#mps-comp-table .green {
    color: #10b981;
    font-weight: 700;
}

/* Chart.js Styles */
#mps-plotly-chart {
    width: 100%;
    min-height: 550px;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    padding: 20px;
    position: relative;
}

.mps-chart-wrapper {
    width: 100%;
    height: 500px;
    position: relative;
}

.mps-chart-wrapper .mps-chart-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 20px;
}

#mpsChartCanvas {
    width: 100% !important;
    height: 450px !important;
}


.mps-error {
    padding: 40px;
    text-align: center;
    color: #dc2626;
    background: #fef2f2;
    border: 2px dashed #fca5a5;
    border-radius: 8px;
    font-weight: 500;
}


.mps-export-section {
    margin-top: 24px;
    text-align: center;
}

.mps-export-button {
    background: linear-gradient(135deg, #0f766e, #134e4a);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.2);
}

.mps-export-button:hover {
    background: linear-gradient(135deg, #134e4a, #0f766e);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}


.mps-theme-dark {
    background: #1e293b;
}

.mps-theme-dark .mps-title {
    color: #34d399;
}

.mps-theme-dark .mps-subtitle {
    color: #94a3b8;
}

.mps-theme-dark .mps-left,
.mps-theme-dark .mps-right {
    background: #334155;
    border-color: #475569;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
}

.mps-theme-dark .mps-subheader {
    color: #f1f5f9;
    border-color: #475569;
}

.mps-theme-dark .mps-input-block label {
    color: #e2e8f0;
}

.mps-theme-dark .mps-input-block input[type="number"] {
    background: #475569;
    color: #f1f5f9;
    border-color: #64748b;
}

.mps-theme-dark .mps-input-block input[type="number"]:focus {
    border-color: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.mps-theme-dark #mps-comp-table table {
    background: #475569;
    border-color: #64748b;
}

.mps-theme-dark #mps-comp-table th {
    background: #374151;
    color: #e5e7eb;
}

.mps-theme-dark #mps-comp-table td {
    color: #d1d5db;
    border-color: #4b5563;
}

.mps-theme-dark #mps-comp-table .green {
    color: #34d399;
}

.mps-theme-dark #mps-plotly-chart {
    background: #334155;
}

.mps-theme-dark .mps-css-chart {
    background: linear-gradient(to top, #475569 0%, #334155 100%);
}

.mps-theme-dark .mps-chart-title {
    color: #f1f5f9;
}

.mps-theme-dark .mps-legend-item {
    color: #e2e8f0;
}

.mps-theme-dark .mps-y-label {
    color: #94a3b8;
}

.mps-theme-dark .mps-bar-label {
    color: #e2e8f0;
}

.mps-theme-dark .mps-bar-stack {
    background: #475569;
    border-color: #64748b;
}

.mps-theme-dark .mps-error {
    background: #450a0a;
    border-color: #991b1b;
    color: #fca5a5;
}

.mps-theme-dark .mps-grid-line {
    background: #64748b;
}

.mps-theme-dark .mps-y-label {
    background: rgba(51, 65, 85, 0.9);
}

.mps-theme-dark .mps-bar-total {
    color: #34d399;
}


@media (max-width: 1200px) {
    .mps-container {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .mps-left {
        position: static;
        order: 1;
    }

    .mps-right {
        order: 2;
    }

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

@media (max-width: 820px) {
    #mps-comp-table table {
        width: 100%;
        table-layout: fixed;
    }

    #mps-comp-table th,
    #mps-comp-table td {
        white-space: normal !important;
        word-break: break-word;
        overflow-wrap: anywhere;

    }
}


@media (max-width: 768px) {
    .mps-calculator-wrapper {
        max-width: 100%;
        overflow-x: hidden;
    }

    .mps-container {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .mps-title {
        font-size: 2rem;
        margin-bottom: 8px;
        line-height: 1.2;
    }

    .mps-subtitle {
        font-size: 0.95rem;
        margin-bottom: 28px;
        padding: 0 10px;
    }

    .mps-left,
    .mps-right {
        padding: 20px 16px;
        margin: 0;
        border-radius: 12px;
        width: 100%;
    }

    .mps-inputs {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .mps-input-block label {
        font-size: 0.75rem;
        min-height: 28px;
        font-weight: 600;
    }

    .mps-input-block input[type="number"] {
        padding: 8px 10px;
        font-size: 0.85rem;
        border-radius: 6px;
    }

    #mps-plotly-chart {
        min-height: 350px;
        padding: 15px;
    }

    .mps-css-chart {
        height: 300px;
        padding: 30px 40px 60px 60px;
    }

    .mps-chart-bars {
        gap: 10px;
    }

    .mps-bar-stack {
        width: 45px;
    }

    .mps-bar-text {
        font-size: 8px;
    }

    .mps-bar-label {
        font-size: 12px;
        margin-top: 8px;
    }

    .mps-bar-total {
        font-size: 10px;
    }

    .mps-y-label {
        font-size: 9px;
    }

    .mps-chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .mps-chart-title {
        font-size: 14px;
    }

    .mps-chart-legend {
        gap: 12px;
    }

    .mps-legend-item {
        font-size: 10px;
    }

    .mps-y-label {
        font-size: 9px;
    }

    .mps-subheader {
        font-size: 1.1rem;
        margin-bottom: 16px;
    }

    .mps-total-tooltip {
        max-width: min(320px, calc(100vw - 16px));
        box-sizing: border-box;
        word-wrap: break-word;
        pointer-events: none;
    }


    #mps-comp-table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #mps-comp-table table {
        min-width: 100%;
        font-size: 0.75rem;
    }

    #mps-comp-table th,
    #mps-comp-table td {
        padding: 10px 6px;
        font-size: 1.25rem;
        white-space: nowrap;
    }

    #mps-comp-table th {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {


    #mps-comp-table th,
    #mps-comp-table td {
        white-space: normal;
        word-break: break-word;
        overflow-wrap: anywhere;
        font-size: 0.9rem;
    }

    .mps-calculator-wrapper {
        margin: 1px;
        padding: 3px 2px;
    }

    .mps-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    .mps-title {
        font-size: 1.75rem;
        margin-bottom: 6px;
    }

    .mps-subtitle {
        font-size: 0.9rem;
        margin-bottom: 24px;
        line-height: 1.4;
    }

    .mps-inputs {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .mps-left,
    .mps-right {
        padding: 16px 12px;
        border-radius: 10px;
    }

    .mps-input-block label {
        font-size: 0.7rem;
        min-height: 24px;
    }

    .mps-input-block input[type="number"] {
        text-align: center;
        padding: 8px;
        font-size: 0.8rem;
    }

    #mps-plotly-chart {
        min-height: 280px;
        padding: 12px;
    }

    .mps-css-chart {
        height: 220px;
        padding: 25px 30px 50px 50px;
    }

    .mps-chart-bars {
        gap: 8px;
    }

    .mps-bar-stack {
        width: 35px;
    }

    .mps-bar-text {
        font-size: 7px;
    }

    .mps-bar-label {
        font-size: 10px;
        margin-top: 6px;
    }

    .mps-bar-total {
        font-size: 8px;
    }

    .mps-y-label {
        font-size: 8px;
    }

    .mps-chart-title {
        font-size: 12px;
    }

    .mps-chart-legend {
        gap: 8px;
        flex-direction: column;
        align-items: flex-start;
    }

    .mps-legend-item {
        font-size: 9px;
    }

    .mps-legend-color {
        width: 10px;
        height: 10px;
    }

    .mps-y-label {
        font-size: 8px;
    }

    .mps-subheader {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    #mps-comp-table table {
        font-size: 0.65rem;
    }

    #mps-comp-table th,
    #mps-comp-table td {
        padding: 8px 4px;
        font-size: 11px;
        line-height: 1.3;
    }

    #mps-comp-table th {
        font-size: 0.6rem;
        text-transform: none;
    }

    #mps-comp-table .mps-metric-name {
        padding: 5px 3px;
        font-size: 10px;
    }

    #mps-comp-table .mps-value {
        padding: 5px 3px;
    }

    #mps-comp-table .green {
        font-size: 10px;
    }

    .mps-header-badge {
        font-size: 11px;
        padding: 7px;

    }

    .mps-table-title {
        width: 40%;
    }

    #mps-comp-table .mps-metric-name {
        width: 40%;
    }

    #mps-comp-table .mps-value {
        width: 30%;
    }
}


.mps-calculator-wrapper.loading {
    opacity: 0.7;
    pointer-events: none;
}


.mps-left,
.mps-right {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}