/**
 * Thuisbatterij Simulatie - Stylesheet
 * Modern, clean, responsive design
 */

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #059669;
    --danger-color: #dc2626;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
}

/* Navigation */
nav {
    background-color: var(--surface);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Two column layout */
.layout-two-column {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .layout-two-column {
        grid-template-columns: 1fr;
    }
}

/* Intro section */
.intro {
    text-align: center;
    margin-bottom: 3rem;
}

.intro h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.intro p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 800px;
    margin: 0 auto;
}

/* Form sections */
.simulation-form {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

@media (min-width: 1025px) {
    .simulation-form {
        position: sticky;
        top: 80px;
    }
}

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1rem;
}

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

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.form-group small {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.form-group-inline label {
    font-weight: 500;
    color: var(--text-primary);
    min-width: 220px;
    flex-shrink: 0;
}

.form-group-inline input {
    flex: 1;
    max-width: 120px;
}

.form-group .formula-display {
    display: block;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: var(--background);
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    line-height: 1.6;
}

.form-group input[type="number"],
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="number"]:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

button {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
}

button[type="submit"]:hover:not(:disabled) {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

button[type="submit"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

/* Progress */
.progress-container {
    margin: 2rem 0;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    border-radius: 12px;
}

#progressText {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Results section */
.results-section {
    margin-top: 3rem;
}

.results-section h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.totals-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

/* Better layout for medium screens (13" laptops) */
@media (min-width: 769px) and (max-width: 1440px) {
    .totals-summary {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .total-card {
        padding: 1.5rem;
    }

    .total-value {
        font-size: 2rem;
    }
}

.total-card {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
}

.total-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.total-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.total-value.profit {
    color: var(--secondary-color);
}

/* Charts */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.chart-box {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.chart-box.full-width {
    grid-column: 1 / -1;
}

#timestepView {
    height: 500px;
}

#timestepChart {
    max-height: 450px;
}

.chart-box h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

/* Table */
.table-container {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    overflow-x: auto;
    margin-bottom: 2rem;
}

.table-container h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

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

thead {
    background-color: var(--background);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

tr:hover {
    background-color: var(--background);
}

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

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

/* Export actions */
.export-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Detail view */
.detail-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background);
    z-index: 200;
    overflow-y: auto;
    padding: 2rem;
}

.detail-header {
    max-width: 1400px;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.detail-nav {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
}

.btn-nav {
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-nav:hover:not(:disabled) {
    background-color: #1d4ed8;
    transform: translateY(-1px);
}

.btn-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-nav-small {
    background-color: var(--text-secondary);
    color: white;
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-nav-small:hover:not(:disabled) {
    background-color: #475569;
    transform: translateY(-1px);
}

.btn-nav-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-back {
    background-color: var(--text-secondary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-back:hover {
    background-color: #475569;
    transform: translateX(-3px);
}

.detail-content {
    max-width: 1400px;
    margin: 0 auto;
}

/* Clickable rows */
.clickable-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.clickable-row:hover {
    background-color: rgba(37, 99, 235, 0.1);
}

/* Content pages */
.content-page {
    background-color: var(--surface);
    border-radius: 12px;
    padding: 3rem;
    box-shadow: var(--shadow);
    margin: 2rem auto;
}

.content-page h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.content-page h3 {
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.content-page h4 {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.content-page section {
    margin-bottom: 2rem;
}

.content-page p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.content-page ul, .content-page ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content-page li {
    margin-bottom: 0.5rem;
}

.content-page a {
    color: var(--primary-color);
    text-decoration: none;
}

.content-page a:hover {
    text-decoration: underline;
}

.content-page code {
    background-color: var(--background);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    background-color: var(--surface);
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    .container {
        padding: 1rem;
    }

    .intro h2 {
        font-size: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .total-value {
        font-size: 2rem;
    }

    .content-page {
        padding: 1.5rem;
    }

    table {
        font-size: 0.9rem;
    }

    th, td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    nav h1 {
        font-size: 1.2rem;
    }

    .nav-links a {
        font-size: 0.9rem;
    }

    .intro h2 {
        font-size: 1.3rem;
    }

    .intro p {
        font-size: 1rem;
    }
}
