@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #343a40;
    --border-color: #dee2e6;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.calculator-container {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 800px;
}

h1, h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
}

h2 {
    font-size: 1.5em;
    color: var(--secondary-color);
    margin-top: 30px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1rem;
}

.input-group {
    display: flex;
}
.input-group input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex-grow: 1;
}
.input-group select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    width: auto;
}

.radio-group {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.radio-group > div {
    display: flex;
    align-items: center;
}
.radio-group input[type="radio"] {
    margin-right: 10px;
}

hr {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 30px 0;
}

.transaction-form {
    align-items: flex-end;
}

#add-transaction-btn, .calculate-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.2s;
    width: 100%;
}

#add-transaction-btn {
    background-color: var(--secondary-color);
}

#add-transaction-btn:hover {
    background-color: #5a6268;
}

.calculate-btn {
    margin-top: 30px;
    background-color: var(--success-color);
}

.calculate-btn:hover {
    background-color: #218838;
}

#transactions-list {
    list-style: none;
    padding: 0;
    margin-top: 15px;
}

#transactions-list li {
    background-color: #f1f3f5;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#transactions-list .deposit {
    border-left: 4px solid var(--success-color);
}
#transactions-list .withdrawal {
    border-left: 4px solid var(--danger-color);
}

#transactions-list button {
    background: none;
    border: none;
    color: var(--danger-color);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

#results {
    margin-top: 30px;
}

.hidden {
    display: none;
}

.summary {
    background-color: #e9f7ef;
    border-left: 5px solid var(--success-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.summary p {
    margin: 5px 0;
    font-size: 1.1rem;
}

.summary strong {
    font-size: 1.2rem;
    color: #155724;
}

.table-container {
    overflow-x: auto;
}

#history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

#history-table th,
#history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

#history-table th {
    background-color: #e9ecef;
    font-weight: 500;
}

#history-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#history-table .interest-row {
    color: var(--success-color);
    font-weight: 500;
}
#history-table .deposit-row {
    color: #004085;
}
#history-table .withdrawal-row {
    color: var(--danger-color);
}
