/* ═══════════════════════════════════════════════════════════════
   Finanz-Rechner · Gemeinsames Design-System
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
    --bg-primary: #f5f5f0;
    --bg-card: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #5a5a5a;
    --text-muted: #8a8a8a;
    --accent-primary: #2d5a41;
    --accent-secondary: #4a7c5e;
    --accent-light: #e8f0eb;
    --border-light: #e5e5e0;
    --border-medium: #d0d0c8;
    --positive: #2d7a4f;
    --negative: #c23d3d;
    --warning: #b8860b;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

/* ── Reset & Base ── */
* {
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, sans-serif;
    max-width: 1280px;
    margin: 0 auto;
    background-color: var(--bg-primary);
    padding: 30px 20px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* ── Typography ── */
h1 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.subtitle a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: bold;
}

.subtitle a:hover {
    text-decoration: underline;
}

/* ── Input Sections (3-Spalten-Grid) ── */
.input-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .input-sections {
        grid-template-columns: 1fr;
    }
}

.section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    border: 1px solid var(--border-light);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border-light);
}

.section-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.section-title {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ── Input Grid & Groups ── */
.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.input-grid.single-col {
    grid-template-columns: 1fr;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group.full-width {
    grid-column: span 2;
}

.input-group .input-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
    margin-top: -2px;
}

label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

label a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    text-transform: none;
}

label a:hover {
    text-decoration: underline;
}

input,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

input::placeholder {
    color: var(--text-muted);
}

/* ── Buttons ── */
.calculate-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.calculate-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.calculate-btn:active {
    transform: translateY(0);
}

.calculate-btn:disabled {
    background: var(--text-muted);
    cursor: wait;
}

/* ── Chart Container ── */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    margin-top: 28px;
    border: 1px solid var(--border-light);
    height: 400px;
}

/* ── Summary Cards ── */
.summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 28px;
}

@media (max-width: 900px) {
    .summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

.summary-card {
    background: var(--bg-card);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, transform 0.2s;
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.summary-card .value {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.summary-card .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Data Table ── */
.table-container {
    margin-top: 28px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 8px;
    text-align: right;
    font-size: 0.72rem;
    border-bottom: 1px solid var(--border-light);
}

th {
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    cursor: help;
}

th:hover {
    background: var(--accent-secondary);
}

td:first-child,
th:first-child {
    text-align: center;
}

tr:hover td {
    background: var(--accent-light);
}

.pos {
    color: var(--positive);
    font-weight: 600;
}

.neg {
    color: var(--negative);
    font-weight: 600;
}

/* ── Result Sections (Altersvorsorge-Stil) ── */
.result-section {
    margin-top: 28px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 24px;
    border: 1px solid var(--border-light);
}

.result-section h3 {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.result-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
}

.result-table td:first-child {
    text-align: left;
}

.result-table td:last-child {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.result-table tr.highlight {
    background: var(--accent-light);
    font-weight: 600;
}

.result-table tr.section-head td {
    background: var(--accent-light);
    font-weight: 600;
    padding: 12px;
    border-top: 2px solid var(--border-medium);
}

/* ── Modal ── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    margin: 6% auto;
    padding: 28px;
    border-radius: var(--radius-lg);
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: modalSlide 0.25s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    right: 18px;
    top: 14px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal h3 {
    font-family: 'Fraunces', Georgia, serif;
    margin: 0 0 6px 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.modal .input-group {
    margin-bottom: 14px;
}

.modal .result-box {
    background: var(--accent-light);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-top: 18px;
}

.modal .result-box div {
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.modal .result-box span {
    color: var(--accent-primary);
    font-weight: 700;
}

.modal button.apply-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    margin-top: 14px;
    width: 100%;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s;
}

.modal button.apply-btn:hover {
    background: var(--accent-secondary);
}

.modal small {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ── Progress Bar ── */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
    display: none;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent-primary);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
}

/* ── Utilities ── */
.hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.two-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 28px;
}

@media (max-width: 900px) {
    .two-charts {
        grid-template-columns: 1fr;
    }
}

.two-charts .chart-container {
    margin-top: 0;
    height: 350px;
}

/* ── Footer ── */
.site-footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

/* ── Navigation (injected by nav.js) ── */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.site-nav .nav-home {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.site-nav .nav-home:hover {
    color: var(--accent-primary);
}

.site-nav .nav-links {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.site-nav .nav-links a {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 14px;
    border-radius: 20px;
    transition: all 0.2s;
    white-space: nowrap;
}

.site-nav .nav-links a:hover {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.site-nav .nav-links a.active {
    background: var(--accent-primary);
    color: white;
}

@media (max-width: 600px) {
    .site-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .site-nav .nav-links {
        gap: 4px;
    }
}
