/* --- Ränta på ränta Kalkylator Stil --- */

.ranta-kalkylator-container {
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    max-width: 750px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333;
}

.ranta-kalkylator-container h1, .ranta-kalkylator-container h2, .ranta-kalkylator-container h3 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 15px;
}
.ranta-kalkylator-container h1 {
    font-size: 1.8em;
}
.ranta-kalkylator-container h2 {
    font-size: 1.5em;
    margin-top: 30px;
}
.ranta-kalkylator-container h3 {
    font-size: 1.2em;
    margin-top: 25px;
}
.ranta-kalkylator-container p {
    text-align: center;
    line-height: 1.6;
    margin-bottom: 25px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.calculator-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 0.95em;
}

.input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: #fff;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.input-wrapper:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.input-wrapper span {
    padding: 0 12px;
    background-color: #f0f0f0;
    border-right: 1px solid #ccc;
    color: #666;
    align-self: stretch;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    padding: 12px;
    border: none;
    background: transparent;
    font-size: 1em;
    outline: none;
}
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

#calculate-btn {
    grid-column: 1 / -1;
    padding: 14px;
    font-size: 1.1em;
    font-weight: bold;
    color: #fff;
    background-color: #007bff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

#calculate-btn:hover {
    background-color: #0056b3;
}

.results-section.hidden {
    display: none;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
    text-align: center;
}

.card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h3 {
    margin-top: 0;
    font-size: 1em;
    color: #666;
    font-weight: normal;
}

.card p {
    font-size: 1.6em;
    font-weight: bold;
    margin: 10px 0 0 0;
    color: #2c3e50;
}
.card .amount-profit {
    color: #28a745;
}

.chart-container {
    margin-top: 15px;
}
.chart-bar {
    display: flex;
    width: 100%;
    height: 40px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 15px;
}
.bar-segment {
    height: 100%;
    transition: flex-basis 0.5s ease-out;
}
.bar-segment.startkapital { background-color: #007bff; }
.bar-segment.insattningar { background-color: #6c757d; }
.bar-segment.avkastning { background-color: #28a745; }

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}
.legend-item p {
    margin: 0;
}
.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
    margin-right: 8px;
}

.details-toggle {
    text-align: center;
    margin: 30px 0 15px 0;
}
#toggle-details-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}
#toggle-details-btn:hover {
    background-color: #5a6268;
}

.details-table-container.hidden {
    display: none;
}
.table-wrapper {
    overflow-x: auto;
    max-height: 400px;
    border: 1px solid #ddd;
    border-radius: 5px;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}
th, td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #ddd;
}
thead th {
    background-color: #f2f2f2;
    font-weight: 600;
    position: sticky;
    top: 0;
}
tbody tr:last-child td {
    border-bottom: none;
}
tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}
td:first-child, th:first-child {
    text-align: left;
    font-weight: bold;
}

@media (max-width: 600px) {
    .ranta-kalkylator-container {
        padding: 15px;
    }
    .calculator-form {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    .summary-cards {
        grid-template-columns: 1fr;
    }
}