.ast-irp-calculator-wrapper {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif !important;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    color: #1F2937;
    --theme-primary-color: #1F2937;
    --theme-accent-color: #19998b;
    --theme-neutral-bg: #F9FAFB;
    --theme-border-color: #E5E7EB;
    box-sizing: border-box;
}

.ast-irp-calculator-wrapper *,
.ast-irp-calculator-wrapper *::before,
.ast-irp-calculator-wrapper *::after {
    box-sizing: inherit;
}

.ast-irp-calculator-wrapper .ast-irp-calculator {
    display: flex; /* Re-added flex for two columns */
    gap: 2rem; /* Re-added gap */
    /* flex-wrap: wrap; */ /* Not needed for now, can add if responsiveness issues */
    max-width: 900px; /* Increased max-width */
    margin: 1rem auto; 
    background: #ffffff;
    padding: 20px; /* Reduced padding */
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.ast-irp-calculator-wrapper .ast-irp-column {
    flex: 1; /* Default flex for columns within the flex container */
    /* width: 100%; */ /* Removed for flex layout */
    /* margin-bottom: 1.5rem; */ /* Removed for flex layout */
}

.ast-irp-calculator-wrapper .ast-irp-column:last-child {
    margin-bottom: 0; /* This might still be useful if flex-wrap occurs */
}

.ast-irp-calculator-wrapper .ast-irp-inputs-column {
    flex: 2; /* Inputs column takes more space */
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced gap */
    text-align: center;
}

.ast-irp-calculator-wrapper .ast-irp-inputs-column > p:first-of-type {
    margin-bottom: 1rem; /* Adjust spacing for the main description paragraph */
    font-size: 0.95em;
    color: #555;
}

.ast-irp-calculator-wrapper .ast-irp-results-column {
    flex: 1; /* Results column takes less space */
}

.ast-irp-calculator-wrapper .ast-irp-results-column h3 {
    font-size: 1.4em; /* Adjusted font size for result heading */
    margin-bottom: 0.75rem;
    color: var(--theme-text-strong);
    font-weight: 600;
}

.ast-irp-calculator-wrapper .ast-irp-result-value {
    font-size: 2em; /* Prominent result value */
    font-weight: 700;
    color: var(--theme-primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.ast-irp-calculator-wrapper .ast-irp-result-explanation {
    font-size: 0.85em;
    color: #777; /* Consistent with field descriptions */
    line-height: 1.4;
    margin-top: 0.5rem;
}

.ast-irp-calculator-wrapper .ast-irp-input-row {
    display: grid;
    /* grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); Default, can be overridden */
    align-items: end;
    gap: 0.75rem; /* Reduced gap */
}

.ast-irp-calculator-wrapper .ast-irp-input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem; /* Reduced margin */
    text-align: left;
}

.ast-irp-calculator-wrapper .ast-irp-input-group label {
    display: block;
    margin-bottom: 0.3rem; /* Slightly reduced margin */
    font-weight: 500;
    font-size: 0.95em; /* Slightly smaller label */
    color: #232425 !important;
    font-family: inherit !important;
    line-height: normal !important;
}

.ast-irp-calculator-wrapper .ast-irp-field-description {
    font-size: 0.85em;
    color: #777; /* Lighter color for sub-text */
    margin-top: 0.25rem; /* Closer to the input */
    line-height: 1.4;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"],
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"],
.ast-irp-calculator-wrapper .ast-irp-input-group select {
    box-sizing: border-box;
    width: 100%;
    appearance: none;
    padding: 8px 10px; /* Reduced padding */
    font-family: inherit !important;
    font-size: 1rem;
    color: #232425 !important;
    background-color: #fff !important;
    border: 1px solid var(--theme-border-color) !important;
    border-radius: 5px !important;
    transition: border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
    box-shadow: none !important;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input::placeholder,
.ast-irp-calculator-wrapper .ast-irp-input-group textarea::placeholder {
    color: #bbb; /* Lighter placeholder text */
    opacity: 1; /* Ensure it's visible */
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"]:hover,
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"]:hover,
.ast-irp-calculator-wrapper .ast-irp-input-group select:hover {
    border-color: #9CA3AF !important;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group select:focus {
    border-color: var(--theme-accent-color) !important;
    box-shadow: 0 0 0 3px rgba(25, 153, 139, 0.15) !important;
    outline: none !important;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group select:focus {
    border-color: #28a745; /* Green border on focus */
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); /* Green shadow glow */
    outline: 0; /* Remove default outline */
}

.ast-irp-calculator-wrapper .ast-irp-results-box {
    background-color: #F3F4F6 !important;
    border-radius: 10px !important;
    border: 1px solid var(--theme-border-color) !important;
    padding: 20px !important;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ast-irp-calculator-wrapper .ast-irp-result-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center; /* Vertically align items */
}

.ast-irp-calculator-wrapper .ast-irp-result-item {
    flex: 1;
    text-align: left;
}

.ast-irp-calculator-wrapper .ast-irp-result-item label {
    font-size: 15px !important;
    font-weight: 500 !important;
    display: block !important;
    margin-bottom: 0.25rem;
    color: #232425 !important;
    font-family: inherit !important;
}

.ast-irp-calculator-wrapper .ast-result-value {
    font-size: 1.6em !important; /* Slightly larger result value */
    font-weight: 700 !important;
    display: block !important;
    color: var(--theme-primary-color) !important;
    font-family: inherit !important;
    animation: ast-flash 0.4s linear;
}

@keyframes ast-flash {
    0% { opacity: 0.2; }
    100% { opacity: 1; }
}

.ast-irp-calculator-wrapper .ast-tooltip {
    display: inline-block;
    position: relative;
    background-color: var(--theme-accent-color) !important;
    color: white !important;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1rem;
    cursor: help;
    margin-left: 0.3rem;
}

.ast-irp-calculator-wrapper .ast-tooltip .ast-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #374151;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%; 
    left: 50%;
    margin-left: -100px; /* Use half of the width to center the tooltip */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.4;
}

.ast-irp-calculator-wrapper .ast-tooltip .ast-tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

.ast-irp-calculator-wrapper .ast-tooltip:hover .ast-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Ensure number inputs show spinner controls consistently */
.ast-irp-calculator-wrapper .ast-irp-input[type="number"],
.ast-irp-calculator-wrapper .ast-irp-input[type="number"]:hover,
.ast-irp-calculator-wrapper .ast-irp-input[type="number"]:focus {
    -moz-appearance: textfield !important; /* Firefox often needs textfield */
    -webkit-appearance: auto !important;  /* Try to get WebKit's default */
    appearance: auto !important;          /* Standard way to get default */
}

/* General styles for all input fields and select within this calculator */
.ast-irp-calculator-wrapper .ast-irp-input,
.ast-irp-calculator-wrapper .ast-irp-select {
    box-sizing: border-box;
    width: 100%;
    appearance: none;
    padding: 8px 10px; /* Reduced padding */
    font-family: inherit !important;
    font-size: 1rem;
    color: #232425 !important;
    background-color: #fff !important;
    border: 1px solid var(--theme-border-color) !important;
    border-radius: 5px !important;
    transition: border-color 150ms ease-in-out, box-shadow 150ms ease-in-out;
    box-shadow: none !important;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input::placeholder,
.ast-irp-calculator-wrapper .ast-irp-input-group textarea::placeholder {
    color: #bbb; /* Lighter placeholder text */
    opacity: 1; /* Ensure it's visible */
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"]:hover,
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"]:hover,
.ast-irp-calculator-wrapper .ast-irp-input-group select:hover {
    border-color: #9CA3AF !important;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group select:focus {
    border-color: var(--theme-accent-color) !important;
    box-shadow: 0 0 0 3px rgba(25, 153, 139, 0.15) !important;
    outline: none !important;
}

.ast-irp-calculator-wrapper .ast-irp-input-group input[type="text"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group input[type="number"]:focus,
.ast-irp-calculator-wrapper .ast-irp-input-group select:focus {
    border-color: #28a745; /* Green border on focus */
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25); /* Green shadow glow */
    outline: 0; /* Remove default outline */
}

.ast-irp-calculator-wrapper .ast-irp-results-box {
    background-color: #F3F4F6 !important;
    border-radius: 10px !important;
    border: 1px solid var(--theme-border-color) !important;
    padding: 20px !important;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ast-irp-calculator-wrapper .ast-irp-result-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center; /* Vertically align items */
}

.ast-irp-calculator-wrapper .ast-irp-result-item {
    flex: 1;
    text-align: left;
}

.ast-irp-calculator-wrapper .ast-irp-result-item label {
    font-size: 15px !important;
    font-weight: 500 !important;
    display: block !important;
    margin-bottom: 0.25rem;
    color: #232425 !important;
    font-family: inherit !important;
}

.ast-irp-calculator-wrapper .ast-result-value {
    font-size: 1.6em !important; /* Slightly larger result value */
    font-weight: 700 !important;
    display: block !important;
    color: var(--theme-primary-color) !important;
    font-family: inherit !important;
    animation: ast-flash 0.4s linear;
}

@keyframes ast-flash {
    0% { opacity: 0.2; }
    100% { opacity: 1; }
}

.ast-irp-calculator-wrapper .ast-tooltip {
    display: inline-block;
    position: relative;
    background-color: var(--theme-accent-color) !important;
    color: white !important;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    font-size: 0.75rem;
    text-align: center;
    line-height: 1rem;
    cursor: help;
    margin-left: 0.3rem;
}

.ast-irp-calculator-wrapper .ast-tooltip .ast-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #374151;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%; 
    left: 50%;
    margin-left: -100px; /* Use half of the width to center the tooltip */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
    font-weight: normal;
    line-height: 1.4;
}

.ast-irp-calculator-wrapper .ast-tooltip .ast-tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #374151 transparent transparent transparent;
}

.ast-irp-calculator-wrapper .ast-tooltip:hover .ast-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Styling for select dropdown arrow. This MUST come AFTER general .ast-irp-select rules if those also set 'appearance'. */
.ast-irp-calculator-wrapper .ast-irp-select { /* General rule for custom arrow on any select with this class */
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important; /* Critical: removes default browser arrow */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27292.4%27%20height%3D%27292.4%27%3E%3Cpath%20fill%3D%27%236c757d%27%20d%3D%27M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%27%2F%3E%3C%2Fsvg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right .75rem center !important;
    background-size: .65em auto !important;
    padding-right: 2.5rem !important; /* Make space for the arrow */
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ast-irp-calculator-wrapper .ast-irp-calculator {
        flex-direction: column;
        gap: 1.5rem;
        padding: 20px;
    }

    .ast-irp-calculator-wrapper .ast-irp-input-row {
        grid-template-columns: 1fr; /* Stack inputs on smaller screens */
    }

    .ast-irp-calculator-wrapper .ast-irp-results-box {
        padding: 20px;
    }

    .ast-irp-calculator-wrapper .ast-result-value {
        font-size: 1.4em !important;
    }
}

.ast-irp-calculator-wrapper .error-message {
    color: #D32F2F; /* Material Design error color */
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.ast-irp-calculator-wrapper .ast-radio-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.ast-irp-calculator-wrapper .ast-radio-group label {
    margin-bottom: 0;
    font-weight: normal !important;
}

.ast-irp-calculator-wrapper .ast-radio-group input[type="radio"] {
    margin-right: 0.25rem;
    accent-color: var(--theme-accent-color);
}

/* Reset Button Styles */
.ast-irp-calculator-wrapper .reset-button { /* Increased specificity */
    background-color: #6c757d !important; /* A neutral or secondary color */
    color: white !important;              /* Ensure text color */
    padding: 10px 15px !important;
    border: none !important;              /* Ensure no theme border */
    border-radius: 5px !important;
    cursor: pointer !important;
    font-size: 1em !important;
    font-weight: 500 !important; /* Explicit font-weight */
    line-height: normal !important; /* Ensure consistent line-height */
    text-align: center !important; /* Ensure text is centered */
    text-decoration: none !important; /* Remove underline if any from theme */
    margin-top: 20px !important; /* Add some space above the button */
    display: block !important; /* Make it full width or adjust as needed */
    width: 100% !important; /* Example: make it full width of its container */
    transition: background-color 0.2s ease-in-out !important; /* Ensure transition isn't broken */
}

.ast-irp-calculator-wrapper .reset-button:hover {
    background-color: #5a6268 !important;
    color: white !important; /* Ensure hover text color too */
}

/* Toast Notification Styles */
.ast-irp-calculator-wrapper .ast-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001; /* Ensure it's above other elements */
    display: flex;
    flex-direction: column-reverse; /* Newest toasts at the bottom, pushing older ones up */
    gap: 10px; /* Spacing between toasts */
}

.ast-irp-calculator-wrapper .ast-toast {
    padding: 12px 20px;
    border-radius: 5px;
    color: white;
    font-size: 0.9em;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
    transform: translateX(0); /* Start on screen */
}

.ast-irp-calculator-wrapper .ast-toast.ast-toast-hidden {
    opacity: 0;
    transform: translateX(100%); /* Slide out to the right */
}

.ast-irp-calculator-wrapper .ast-toast-success {
    background-color: #19998b; /* Accent color (greenish) */
}

.ast-irp-calculator-wrapper .ast-toast-error {
    background-color: #D32F2F; /* Error color (red) */
}

.ast-irp-calculator-wrapper .ast-toast-default {
    background-color: #333; /* Default dark grey/black */
}

/* Styles for embeddable code section */
.ast-irp-calculator-wrapper .ast-embed-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: var(--theme-neutral-bg);
    border: 1px solid var(--theme-border-color);
    border-radius: 8px;
    max-width: 900px; /* Increased max-width */
    margin-left: auto; /* Center it */
    margin-right: auto; /* Center it */
}

.ast-irp-calculator-wrapper .ast-embed-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--theme-primary-color);
}

.ast-irp-calculator-wrapper .ast-embed-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid var(--theme-border-color);
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    resize: vertical;
    background-color: #fff;
}

.ast-irp-calculator-wrapper .ast-embed-section button {
    background-color: var(--theme-accent-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    margin-top: 0.5rem;
}

.ast-irp-calculator-wrapper .ast-embed-section button:hover {
    background-color: #137a6d; /* Darken accent color on hover */
}

/* Social sharing buttons placeholder */
.ast-irp-calculator-wrapper .ast-social-sharing {
    margin-top: 1rem;
    text-align: center;
}

.ast-irp-calculator-wrapper .ast-social-sharing p {
    margin-bottom: 0.5rem;
}

.ast-irp-calculator-wrapper .ast-social-sharing a {
    display: inline-block;
    margin: 0 0.5rem;
    text-decoration: none;
    /* Add more specific styles for social icons if using them */
}

/* Styles for Dynamic Output Area Enhancement */
.reorder-output-area {
    background-color: #f8f9fa; /* Light grey, adjust as needed */
    padding: 20px;
    border-radius: 8px;
    text-align: center; /* Or left, depending on your design */
}

.reorder-point-value {
    font-size: 2.8em; /* Prominent display for the main result */
    font-weight: bold; /* Make the number part bold */
    color: #333;
    margin-top: 5px; /* Space below the "Reorder Point:" title */
    margin-bottom: 20px; /* Space above the divider */
    line-height: 1.1;
}

.reorder-point-value .units-text {
    display: inline;
    font-size: 0.5em; /* Adjust size relative to the large reorder point value */
    font-weight: normal;
    margin-left: 0.3em;
    color: #555;
}

.output-divider-subtle {
    border: 0;
    height: 1px;
    background-color: #e0e0e0; /* Lighter than the main divider if one exists */
    margin-top: 10px;    /* Or adjust as preferred */
    margin-bottom: 15px; /* Or adjust as preferred */
}

.output-divider {
    border: 0;
    height: 1px;
    background-color: #ddd;
    margin: 15px 0;
}

.calculation-breakdown {
    margin-top: 20px; /* Increased margin from Reorder Point value */
    margin-bottom: 20px; /* Increased margin from explanation text */
    text-align: left; 
    font-size: 0.9em;
    color: #555; 
    padding: 15px;
    background-color: #f9f9f9; /* Very light grey background */
    border: 1px solid #e9e9e9; /* Subtle border */
    border-radius: 4px; /* Rounded corners for the block */
}

.breakdown-item {
    margin-bottom: 8px;
    display: flex; /* For better alignment of label and value */
    justify-content: space-between; /* Puts label left, value right */
    align-items: baseline; /* Try baseline alignment */
}

.breakdown-label {
    font-weight: normal;
    /* max-width: 150px; /* Or a percentage, adjust as needed to encourage wrapping */
    /* line-height: 1.3; /* Adjust if needed for multi-line labels */
}

.indented-label-part {
    display: inline-block; /* Or block if it should take full width of its line */
    padding-left: 10px;  /* Adjust this value to get the desired indent */
}

.breakdown-value-main {
    font-size: 1.4em;   /* Larger for main value */
    font-weight: bold;
    color: #333;
    line-height: 1.2;
    display: flex; /* Use flex to ensure number and units stay on one line */
    align-items: baseline; /* Align text content nicely */
    white-space: nowrap; /* Prevent the number and 'units' from wrapping internally */
}

.breakdown-value-main .units-text {
    display: inline; /* Ensure it stays on the same line */
    font-size: 0.7em; /* Make 'units' text a bit smaller than the number */
    font-weight: normal; /* If numbers are bold, units can be normal weight */
    margin-left: 0.3em; /* Small space between number and 'units' */
    color: #555; /* Slightly lighter than the main number */
}

.breakdown-value {
    font-weight: bold;
}

.breakdown-value-wrapper {
    display: flex;
    flex-direction: column; /* Stack main value and sub-calculation vertically */
    align-items: flex-start; /* Align items to the start of the cross axis (left) */
    text-align: left; /* Ensure text within is left-aligned */
    flex-grow: 1; /* Allow wrapper to take available space if needed */
    margin-left: 10px; /* Space between label and value block */
}

.breakdown-sub-calculation {
    font-size: 0.8em; /* Slightly smaller for sub-info to de-emphasize */
    color: #777;      /* Lighter text for sub-info */
    display: block;    /* Ensure it takes its own line / respects parent's flex settings */
    margin-top: 2px;   /* Small space between main value and sub-calculation */
    line-height: 1.3;
}

.units-text {
    margin-left: 0.2em; /* Adjust as needed for slight separation */
}

.explanation-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 10px;
}

/* Style for Safety Stock Equivalent */
.safety-stock-equivalent {
    font-size: 0.85em;
    color: #777;
    margin-left: 8px;
    font-style: italic;
    display: inline; /* Initially hidden by JS, will be set to inline/block */
}

.safety-stock-equivalent-units {
    font-size: 0.8em;
    color: #777;
    margin-top: 4px; /* Slightly adjusted for closer alignment */
    text-align: left;
}
