body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f0f2f5; padding: 20px; color: #333; }
.container { max-width: 1100px; margin: auto; background: white; padding: 2rem; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); box-sizing: border-box; }

/* Input Grid */
.grid-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 30px; }
.input-group { display: flex; flex-direction: column; }
label { margin-bottom: 8px; font-weight: 600; font-size: 0.85rem; color: #555; }
input, select { padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 1rem; background-color: #fff; box-sizing: border-box; width: 100%; }

/* Summary Grid - Automatically stacks when narrow */
.summary-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); 
    gap: 25px; 
    margin-bottom: 30px; 
}

/* Column Wrapper */
.summary-column { 
    display: flex; 
    flex-direction: column; 
    gap: 15px; 
    min-width: 0; /* Allows children to shrink below content size */
}

/* Summary Cards */
.card { padding: 20px; border-radius: 8px; border-left: 5px solid #2c3e50; background: #f8f9fa; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.card.real { border-left-color: #27ae60; background: #eef9f1; }
.card h3 { margin-top: 0; font-size: 1.1rem; border-bottom: 1px solid rgba(0,0,0,0.1); padding-bottom: 10px; }
.stat { display: flex; justify-content: space-between; margin-bottom: 8px; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.stat.highlight { color: #2980b9; font-weight: 600; }
.stat.total { font-weight: bold; border-bottom: 2px solid #ccc; font-size: 1.1rem; margin-top: 10px; }

/* Chart Container - Fixed height is key for responsiveness */
.chart-container { 
    background: white; 
    padding: 15px; 
    border: 1px solid #eee; 
    border-radius: 8px; 
    position: relative; 
    height: 350px; /* Fixed height for the chart to live in */
    width: 100%; 
    box-sizing: border-box; 
}

/* Table Section */
.table-container { overflow-x: auto; height: 500px; overflow-y: auto; width: 100%; border: 1px solid #eee; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 800px; }
th { background: #2c3e50; color: white; padding: 12px; text-align: left; position: sticky; top: 0; z-index: 10;}
td { padding: 10px; border-bottom: 1px solid #eee; }
tr:nth-child(even) { background: #fafafa; }
.hl-yellow { background-color: #fff9c4; font-weight: bold; }

@media (max-width: 600px) {
    body { padding: 10px; }
    .container { padding: 1rem; }
    .summary-grid { grid-template-columns: 1fr; }
}



/* THESE ARE FOR AMORTIZATION */
.hl-blue { background-color: rgba(41, 128, 185, 0.05); }
.negative-tilgung { color: #e74c3c; font-weight: bold; }
.chart-container { margin-top: 20px; background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); }

/* Modal & Icon Styles */
.info-icon {
    cursor: pointer;
    margin-left: 8px;
    font-size: 1.1em;
    color: #2980b9;
    transition: transform 0.2s;
    display: inline-block;
}
.info-icon:hover { transform: scale(1.1); }
.rate-container { display: flex; align-items: center; justify-content: flex-end; }

.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    max-width: 650px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
}
.close-btn {
    position: absolute;
    top: 15px; right: 20px;
    font-size: 1.5em;
    cursor: pointer;
    color: #7f8c8d;
}
.close-btn:hover { color: #333; }
.formula-display {
    background: #f8f9fa;
    padding: 15px;
    border-left: 4px solid #2980b9;
    margin-top: 15px;
    font-family: monospace;
    white-space: pre-wrap;
    line-height: 1.5;
    font-size: 0.9em;
    overflow-x: auto;
}



/* THESE ARE FOR INVESTMENT */
/* Tooltip Container Styling */
.tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

/* Clickable ? Icon Button */
.tooltip-trigger {
    background: #e0e0e0;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, color 0.2s;
}

.tooltip-trigger:hover, .tooltip-trigger:focus {
    background: #2980b9;
    color: white;
    outline: none;
}

/* Explanation Popover Box */
.tooltip-box {
    display: none;
    position: absolute;
    bottom: 125%;
    left: 0;
    width: 290px;
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    font-weight: normal;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 100;
    text-transform: none;
}

/* Visual pointer triangle for the box */
.tooltip-box::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 15px;
    border-width: 6px;
    border-style: solid;
    border-color: #2c3e50 transparent transparent transparent;
}

/* Display the box when active class is triggered */
.tooltip-box.active {
    display: block;
}

/* Header Alignment Layout */
.calculator-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.calculator-header-row h2 {
    margin: 0;
}

/* Polished Share Button */
.btn-polished-share {
    background: #34495e;
    color: #ffffff;
    border: none;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: background 0.2s, transform 0.1s;
}
.btn-polished-share:hover {
    background: #2c3e50;
}

/* Modal Overlay Background Blur System */
.share-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.share-modal-overlay.active {
    display: flex;
}
.share-modal {
    background: #ffffff;
    width: 90%;
    max-width: 460px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 24px;
    position: relative;
    box-sizing: border-box;
    animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.modal-close-x {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
}
.modal-close-x:hover {
    color: #475569;
}
.share-options-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}
.share-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
    user-select: none;
}
.share-option-item input {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
}
.modal-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}
.btn-modal-action {
    border: none;
    padding: 11px;
    font-weight: 600;
    font-size: 13px;
    color: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.15s;
}
.btn-modal-action:hover {
    opacity: 0.9;
}