/* CSS Variables */
:root {
    --mpd-bg-primary: #0a0e17;
    --mpd-bg-secondary: #0f1419;
    --mpd-bg-tertiary: #151c28;
    --mpd-bg-card: #1a2332;
    --mpd-bg-input: #0d1117;
    --mpd-border-color: #2a3444;
    --mpd-border-light: #3d4f66;
    --mpd-text-primary: #e6edf3;
    --mpd-text-secondary: #8b949e;
    --mpd-text-muted: #6e7681;
    --mpd-accent-primary: #3b82f6;
    --mpd-accent-secondary: #1d4ed8;
    --mpd-accent-glow: rgba(59, 130, 246, 0.3);
    --mpd-success: #10b981;
    --mpd-success-bg: rgba(16, 185, 129, 0.1);
    --mpd-success-border: rgba(16, 185, 129, 0.3);
    --mpd-warning: #f59e0b;
    --mpd-warning-bg: rgba(245, 158, 11, 0.1);
    --mpd-warning-border: rgba(245, 158, 11, 0.3);
    --mpd-error: #ef4444;
    --mpd-error-bg: rgba(239, 68, 68, 0.1);
    --mpd-error-border: rgba(239, 68, 68, 0.3);
    --mpd-gradient-primary: linear-gradient(135deg, #1a2332 0%, #0f1419 100%);
    --mpd-gradient-accent: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    --mpd-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --mpd-radius-sm: 6px;
    --mpd-radius-md: 10px;
    --mpd-radius-lg: 14px;
    --mpd-radius-xl: 20px;
    --mpd-transition-fast: 150ms ease;
    --mpd-transition-normal: 250ms ease;
}

.mpd-calculator {
    max-width: 540px;
    margin: 40px auto;
    background: var(--mpd-gradient-primary);
    border: 1px solid var(--mpd-border-color);
    border-radius: var(--mpd-radius-xl);
    box-shadow: var(--mpd-shadow-xl);
    overflow: hidden;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mpd-calculator * {
    box-sizing: border-box;
}

.mpd-calculator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--mpd-border-light), transparent);
}

/* Header Section */
.mpd-header {
    text-align: center;
    padding: 32px 32px 24px;
    border-bottom: 1px solid var(--mpd-border-color);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
}

.mpd-header-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--mpd-bg-card);
    border: 1px solid var(--mpd-border-color);
    border-radius: var(--mpd-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mpd-accent-primary);
}

.mpd-header-icon svg {
    width: 28px;
    height: 28px;
}

.mpd-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--mpd-text-primary);
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.mpd-subtitle {
    font-size: 14px;
    color: var(--mpd-text-secondary);
    margin: 0;
    font-weight: 400;
}

/* Form Section */
.mpd-form {
    padding: 28px 32px;
}

.mpd-input-group {
    margin-bottom: 24px;
}

.mpd-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.mpd-label-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--mpd-text-primary);
    letter-spacing: -0.01em;
}

.mpd-label-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--mpd-accent-primary);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 12px;
    border-radius: var(--mpd-radius-sm);
    font-variant-numeric: tabular-nums;
}

.mpd-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mpd-input-prefix {
    font-size: 18px;
    font-weight: 700;
    color: var(--mpd-text-primary);
    min-width: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mpd-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 500;
    color: var(--mpd-text-primary);
    background: var(--mpd-bg-input);
    border: 1px solid var(--mpd-border-color);
    border-radius: var(--mpd-radius-md);
    outline: none;
    transition: border-color var(--mpd-transition-fast), box-shadow var(--mpd-transition-fast);
    font-variant-numeric: tabular-nums;
}

.mpd-input:hover {
    border-color: var(--mpd-border-light);
}

.mpd-input:focus {
    border-color: var(--mpd-accent-primary);
    box-shadow: 0 0 0 3px var(--mpd-accent-glow);
}

.mpd-input::placeholder {
    color: var(--mpd-text-muted);
}

.mpd-input::-webkit-outer-spin-button,
.mpd-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.mpd-input[type=number] {
    -moz-appearance: textfield;
}

.mpd-input-hint {
    font-size: 12px;
    color: var(--mpd-text-muted);
    margin-top: 8px;
    margin-bottom: 0;
}

/* Slider Styles */
.mpd-slider-container {
    padding: 8px 0;
}

.mpd-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--mpd-bg-input);
    border: 1px solid var(--mpd-border-color);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.mpd-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--mpd-gradient-accent);
    border: 3px solid var(--mpd-text-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    transition: transform var(--mpd-transition-fast);
}

.mpd-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.mpd-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--mpd-gradient-accent);
    border: 3px solid var(--mpd-text-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.mpd-slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 11px;
    color: var(--mpd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Button Styles */
.mpd-button {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: var(--mpd-gradient-accent);
    border: none;
    border-radius: var(--mpd-radius-md);
    cursor: pointer;
    transition: transform var(--mpd-transition-fast), box-shadow var(--mpd-transition-fast);
    position: relative;
    overflow: hidden;
}

.mpd-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.mpd-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.mpd-button:active {
    transform: translateY(0);
}

.mpd-button-secondary {
    background: var(--mpd-bg-card);
    border: 1px solid var(--mpd-border-color);
    color: var(--mpd-text-secondary);
}

.mpd-button-secondary:hover {
    background: var(--mpd-bg-tertiary);
    color: var(--mpd-text-primary);
}

/* Results Section */
.mpd-results {
    padding: 0 32px 32px;
    animation: mpdFadeIn 0.4s ease;
}

@keyframes mpdFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status Section */
.mpd-status {
    text-align: center;
    padding: 28px;
    border-radius: var(--mpd-radius-lg);
    margin-bottom: 24px;
    border: 1px solid;
}

.mpd-status.mpd-success {
    background: var(--mpd-success-bg);
    border-color: var(--mpd-success-border);
}

.mpd-status.mpd-warning {
    background: var(--mpd-warning-bg);
    border-color: var(--mpd-warning-border);
}

.mpd-status-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mpd-status.mpd-success .mpd-status-icon {
    background: var(--mpd-success);
}

.mpd-status.mpd-warning .mpd-status-icon {
    background: var(--mpd-warning);
}

.mpd-status-icon svg {
    width: 32px;
    height: 32px;
    color: #ffffff;
}

.mpd-status-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
    letter-spacing: -0.02em;
}

.mpd-status.mpd-success .mpd-status-title {
    color: var(--mpd-success);
}

.mpd-status.mpd-warning .mpd-status-title {
    color: var(--mpd-warning);
}

.mpd-status-message {
    font-size: 14px;
    color: var(--mpd-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Metrics Grid */
.mpd-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.mpd-metric {
    background: var(--mpd-bg-card);
    border: 1px solid var(--mpd-border-color);
    border-radius: var(--mpd-radius-md);
    padding: 16px;
    text-align: center;
}

.mpd-metric-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--mpd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.mpd-metric-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--mpd-text-primary);
    font-variant-numeric: tabular-nums;
}

/* Breakdown Section */
.mpd-breakdown {
    background: var(--mpd-bg-card);
    border: 1px solid var(--mpd-border-color);
    border-radius: var(--mpd-radius-md);
    padding: 20px;
    margin-bottom: 24px;
}

.mpd-breakdown-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--mpd-text-primary);
    margin: 0 0 16px;
}

.mpd-breakdown-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mpd-breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--mpd-bg-input);
    border-radius: var(--mpd-radius-sm);
}

.mpd-breakdown-row-highlight {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.mpd-breakdown-label {
    font-size: 13px;
    color: var(--mpd-text-secondary);
}

.mpd-breakdown-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--mpd-text-primary);
    font-variant-numeric: tabular-nums;
}

.mpd-breakdown-row-highlight .mpd-breakdown-value {
    color: var(--mpd-accent-primary);
}

/* Footer Section */
.mpd-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--mpd-border-color);
    background: rgba(0, 0, 0, 0.2);
}

.mpd-disclaimer {
    font-size: 11px;
    color: var(--mpd-text-muted);
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

/* Utility Classes */
.mpd-hidden {
    display: none !important;
}

/* Toggle Switch */
.mpd-toggle-group {
    background: var(--mpd-bg-card);
    border: 1px solid var(--mpd-border-color);
    border-radius: var(--mpd-radius-md);
    padding: 16px;
    margin-bottom: 24px;
}

.mpd-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.mpd-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--mpd-text-primary);
}

.mpd-toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
}

.mpd-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mpd-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--mpd-bg-input);
    border: 1px solid var(--mpd-border-color);
    transition: 0.3s;
    border-radius: 28px;
}

.mpd-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: var(--mpd-text-muted);
    transition: 0.3s;
    border-radius: 50%;
}

.mpd-toggle-switch input:checked + .mpd-toggle-slider {
    background: var(--mpd-accent-primary);
    border-color: var(--mpd-accent-primary);
}

.mpd-toggle-switch input:checked + .mpd-toggle-slider:before {
    transform: translateX(24px);
    background: white;
}

.mpd-toggle-description {
    font-size: 12px;
    color: var(--mpd-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Consistency Inputs */
.mpd-consistency-inputs {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--mpd-border-color);
    animation: mpdSlideDown 0.3s ease;
}

@keyframes mpdSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 600px) {
    .mpd-calculator {
        margin: 20px 0;
        border-radius: var(--mpd-radius-md);
    }

    .mpd-header, .mpd-form, .mpd-results, .mpd-footer {
        padding-left: 20px;
        padding-right: 20px;
    }

    .mpd-header {
        padding-top: 24px;
        padding-bottom: 20px;
    }

    .mpd-title {
        font-size: 20px;
    }

    .mpd-subtitle {
        font-size: 13px;
    }

    .mpd-metrics {
        grid-template-columns: 1fr;
    }

    .mpd-form {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .mpd-results {
        padding-bottom: 24px;
    }

    .mpd-slider-labels span:nth-child(2),
    .mpd-slider-labels span:nth-child(4) {
        display: none;
    }
}