.ka-calculator {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.ka-calculator * {
    box-sizing: border-box;
}

/* Input Groups */
.ka-input-group {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.ka-input-label {
    min-width: 200px;
    margin-right: 1rem;
    font-weight: 500;
}

.ka-input-wrapper {
    display: flex;
    align-items: stretch;
    flex: 1;
    max-width: 300px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    overflow: hidden;
}

.ka-input-wrapper input {
    border: none;
    padding: 0.375rem 0.75rem;
    flex: 1;
    min-width: 0;
    outline: none;
    font-size: 1rem;
    line-height: 1.5;
}

.ka-input-wrapper input:focus {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
}

.ka-input-addon {
    background-color: #e9ecef;
    padding: 0.375rem 0.75rem;
    border-left: 1px solid #ced4da;
    min-width: 50px;
    text-align: center;
    display: flex;
    align-items: center;
}

/* Buttons */
.ka-button-group {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
}

.ka-button {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    border: 1px solid transparent;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    transition: background-color 0.15s ease-in-out;
}

.ka-button:hover {
    background-color: #0056b3;
}

.ka-button-secondary {
    background-color: #6c757d;
}

.ka-button-secondary:hover {
    background-color: #545b62;
}

/* Results Section */
.ka-result {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
}

.ka-result.hidden {
    display: none;
}

.ka-result-header {
    margin-bottom: 2rem;
}

.ka-result-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #212529;
}

.ka-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.ka-result-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 0.5rem;
}

.ka-result-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #495057;
}

.ka-result-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.ka-result-row.total {
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid #dee2e6;
    font-weight: bold;
}

/* Chart Container */
.ka-chart-container {
    margin: 2rem 0;
    padding: 1rem;
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

/* Year Slider */
.ka-year-selector {
    margin: 2rem 0;
    padding: 1rem;
    text-align: center;
}

.ka-year-selector input[type="range"] {
    width: 100%;
    max-width: 500px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ka-input-group {
        flex-direction: column;
        align-items: stretch;
    }

    .ka-input-label {
        margin-bottom: 0.5rem;
    }

    .ka-input-wrapper {
        max-width: none;
    }

    .ka-result-grid {
        grid-template-columns: 1fr;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Remove spinner buttons from number inputs */
.ka-calculator input[type=number]::-webkit-inner-spin-button,
.ka-calculator input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.ka-calculator input[type=number] {
    -moz-appearance: textfield;
}

@media (min-width: 768px) {
    #form_calc {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .ka-button-group {
        grid-column: span 2;
    }
}

.ka-result-value {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.25rem;
}

.ka-result-value .value {
    text-align: right;
}

.year-select {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 0.5rem;
}

.help-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    background-color: #6c757d;
    color: white;
    font-size: 12px;
    margin-left: 5px;
    cursor: help;
}

.help-text {
    display: none;
}


/* Mobile Version */
@media (hover: none) {
    .help-icon {
        display: none;
    }

    .help-text {
        display: block;
        color: #666;
        font-size: 12px;
        font-style: italic;
        margin-top: 2px;
    }
}


.ka-input-label {
    display: flex;
    align-items: center;
}


/* Select styling to match inputs */
.ka-input-wrapper {
    position: relative;
}

.ka-input-wrapper select,
.ka-input-wrapper .ka-select {
    border: none;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    flex: 1;
    min-width: 0;
    outline: none;
    font-size: 1rem;
    line-height: 1.5;
    background-color: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* custom dropdown indicator directly on select to avoid showing on inputs */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236c757d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 10px 6px;
}

/* Highlight the whole control when focusing any child (input/select) */
.ka-input-wrapper:focus-within {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
}


/* Standalone select style (if wrapper is removed) */
.ka-select {
    display: inline-block;
    width: 100%;
    max-width: 300px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.375rem 2rem 0.375rem 0.75rem;
    background-color: #fff;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* custom dropdown indicator for standalone select */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236c757d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 10px 6px;
}

.ka-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25);
}
