/* General Styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    background-color: #f4f7f6;
    color: #333;
}

header {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0 2rem;
    margin-bottom: 2rem; /* <-- Add this line */
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav h1 {
    font-size: 1.5rem;
    color: #0056b3;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    padding: 1.5rem 0;
    border-bottom: 3px solid transparent;
}

nav a.active, nav a:hover {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

main {
    padding: 2rem;
}

.content-page {
    max-width: 1000px;
    margin: auto;
}

/* Diagram Styling */
.diagram-container {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    padding: 1rem;
}

/* SVG Component Styles */
.component-box {
    fill: #e9ecef;
    stroke: #adb5bd;
    stroke-width: 1.5;
}

.etp {
    fill: #d4edda;
    stroke: #77bfa3;
}

.tank {
    fill: #e0f7fa;
    stroke: #007bff;
    stroke-width: 2;
}

.component-label {
    font-size: 14px;
    font-weight: bold;
    text-anchor: middle;
    fill: #333;
}

.data-label {
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    fill: #0056b3;
    font-weight: bold;
    text-anchor: middle;
}

/* Icon specific styles */
.icon-group {
    text-anchor: middle;
}

.icon-text {
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Symbol', sans-serif;
    text-anchor: middle;
    fill: #333;
}

.source-circle {
    fill: #e0f7fa;
    stroke: #007bff;
    stroke-width: 2;
}

.usage-circle {
    fill: #fff3cd;
    stroke: #ffc107;
    stroke-width: 2;
}

.discharge-circle {
    fill: #f8d7da;
    stroke: #dc3545;
    stroke-width: 2;
}

.pump {
    transform-origin: center center;
}

/* Pipe Styling */
.pipe {
    fill: none;
    stroke: #adb5bd;
    stroke-width: 4;
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* Pipe Flow Animation */
.pipe.flowing {
    stroke: #007bff;
    stroke-dasharray: 10 5;
    animation: flow 1s linear infinite;
}

.pipe.dashed {
    stroke-dasharray: 8 8;
    stroke: #28a745;
}

.pipe.dashed.flowing {
    stroke: #28a745;
    stroke-dasharray: 10 5;
    animation: flow 1s linear infinite;
}

@keyframes flow {
    to {
        stroke-dashoffset: -15;
    }
}

/* Balance Sheet Styling */
.balance-container {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}
.balance-table {
    width: 50%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    overflow: hidden;
}

.balance-table th, .balance-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.balance-table thead th {
    background-color: #0056b3;
    color: white;
}

.balance-table .section-header td {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #495057;
}

.balance-table .total-row {
    background-color: #e9ecef;
}

.balance-table .balance-row {
    background-color: #cfe2ff;
}

.chart-container {
    width: 50%;
    padding: 1.5rem;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    position: relative; /* Add this */
    height: 400px;      /* Add this to give the chart a stable container */
}

/* ======================================= */
/* NEW STYLES FOR CARD-BASED BALANCE SHEET */
/* Add these to the end of your style.css  */
/* ======================================= */

.balance-title {
    text-align: center;
    font-size: 2rem;
    color: #333;
    margin-bottom: 2rem;
}

.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    width: 320px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 1rem 1.5rem;
    color: #fff;
}
.card-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

/* Card Colors */

.card-header.usage { background-color: #f39c12; } /* Orange for Usage */
.card-header.incoming { background-color: #3498db; }
.card-header.outgoing { background-color: #e74c3c; }
.card-header.balance { background-color: #2ecc71; }

.card-body {
    padding: 1rem 1.5rem;
    flex-grow: 1;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
}

.data-row:last-child {
    border-bottom: none;
}

.data-row span:first-child {
    color: #555;
}

.data-row span:last-child {
    font-weight: bold;
    color: #333;
}

.card-footer {
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.1rem;
    border-top: 1px solid #e9ecef;
}

.card-footer span:first-child {
    color: #0056b3;
}

/* Status Styling */
#system-status {
    padding: 0.2rem 0.6rem;
    border-radius: 5px;
    color: white;
}
#system-status.optimal { background-color: #2ecc71; }
#system-status.stable { background-color: #f39c12; }
#system-status.deficit { background-color: #e74c3c; }

/* Remove old styles no longer needed */
.balance-table, .chart-container {
    display: none;
}
/* ======================================= */
/* NEW STYLES FOR TRENDLINE PAGE           */
/* Add these to the end of your style.css  */
/* ======================================= */

.trends-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 992px) {
    .trends-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.chart-wrapper {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    height: 450px;
    position: relative;
}

.chart-wrapper h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #333;
}
/* ======================================= */
/* NEW STYLES FOR SUMMARY CARDS ON HOMEPAGE */
/* Add these to the end of your style.css   */
/* ======================================= */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem 1.5rem 2rem;
}

.summary-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.card-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.card-content h4 {
    margin: 0 0 0.5rem 0;
    color: #555;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.card-content p {
    margin: 0;
    font-size: 1.8rem;
    font-weight: bold;
    color: #333;
}

.list-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.2rem 0;
}

.list-item-label {
    color: #666;
}

.list-item-value {
    font-weight: bold;
    color: #0056b3;
}

/* --- NEW PIPE STYLES --- */

/* The outer pipe casing (no changes here) */
.pipe-casing {
    fill: none;
    stroke: #adb5bd; /* A neutral grey color */
    stroke-width: 8; /* Thicker line for the pipe wall */
    stroke-linejoin: round;
    stroke-linecap: round;
}

/* The inner water flow */
.pipe {
    fill: none;
    stroke-width: 5; /* Thinner than the casing to fit inside */
    stroke-linejoin: round;
    stroke-linecap: round;
    /* Set the default state of all water lines to be invisible */
    stroke: transparent;
}

/* We remove the default colors from here, as the base .pipe is now transparent */
.pipe-raw {}
.pipe-waste {}
.pipe-recycle {}
.pipe-discharge {}

/* Animation for all flowing pipes */
.pipe.flowing {
    stroke-dasharray: 10 5;
    animation: flow 0.8s linear infinite;
}

/* When the 'flowing' class is added, we SET the color, making the water visible */
.pipe-raw.flowing { stroke: #0056b3; }
.pipe-waste.flowing { stroke: #0056b3; }
.pipe-recycle.flowing { stroke: #218838; }
.pipe-discharge.flowing { stroke: #c82333; }

@keyframes flow {
    to {
        stroke-dashoffset: -15;
    }
}