:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --accent-color: #2563eb; /* Professional Blue */
    
    --flow-color: #059669;
    --flow-bg: rgba(5, 150, 105, 0.08);
    
    --waste-color: #d97706;
    --waste-bg: rgba(217, 119, 6, 0.08);
    
    --alarm-color: #dc2626;
    --alarm-bg: rgba(220, 38, 38, 0.08);
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before, body::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.05; /* Much more subtle for light mode */
    animation: float 25s infinite alternate;
}

body::before {
    background: var(--accent-color);
    top: -150px;
    left: -150px;
}

body::after {
    background: var(--flow-color);
    bottom: -150px;
    right: -150px;
    animation-delay: -12s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

.glow-text {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--text-primary);
    text-transform: uppercase;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

main {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 3rem;
    flex-grow: 1;
    align-items: start;
}

/* Chart Layout */
.chart-container {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: 1fr auto;
    position: relative;
    padding-left: 20px;
}

.axis-y {
    display: flex;
    flex-direction: row;
    padding-right: 10px;
    align-items: stretch;
    position: relative;
    z-index: 20;
}

.axis-label-y {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
    margin-right: 10px;
    display: flex;
    justify-content: center;
}

.axis-y-content {
    position: relative;
    flex: 1;
    min-width: 150px;
}

.axis-line-y {
    position: absolute;
    right: 0;
    top: -20px;
    bottom: 0;
    width: 2px;
    background-color: var(--border-color);
}

.axis-arrow-y {
    position: absolute;
    right: -4px;
    top: -25px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 10px solid var(--border-color);
}

.ticks-y {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
}

.ticks-y .tick {
    text-align: right;
    position: relative;
    height: 25%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all 0.2s;
    white-space: nowrap;
    padding: 0 10px;
}

.ticks-y .tick::after {
    content: '';
    position: absolute;
    right: -15px;
    top: 50%;
    width: 10px;
    height: 2px;
    background-color: var(--border-color);
    transform: translateY(-50%);
}

.ticks-y .tick.active {
    color: var(--accent-color);
    font-weight: 800;
}
.ticks-y .tick.active::after {
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.chart-area {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, 
        var(--waste-bg) 0%, 
        var(--waste-bg) 35%, 
        var(--flow-bg) 45%, 
        var(--flow-bg) 55%, 
        var(--alarm-bg) 65%, 
        var(--alarm-bg) 100%
    );
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: crosshair;
    box-shadow: 0 10px 40px rgba(0,0,0,0.04);
}

/* Static Grid lines */
.chart-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background-size: 25% 25%;
    background-image: 
        linear-gradient(to right, rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0,0,0,0.04) 1px, transparent 1px);
    pointer-events: none;
    z-index: 1;
}

/* Water Ripple Effect */
.water-effect {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.water-effect::before, .water-effect::after {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
    background: radial-gradient(circle at center, rgba(255,255,255,0.06) 0%, transparent 60%);
    animation: waterRipple 12s infinite ease-in-out;
}

.water-effect::after {
    background: radial-gradient(circle at center, rgba(255,255,255,0.03) 0%, transparent 50%);
    animation-delay: -6s;
    animation-duration: 8s;
}

@keyframes waterRipple {
    0% { transform: translate(0, 0) scale(1); opacity: 0.2; }
    33% { transform: translate(3%, 5%) scale(1.05); opacity: 0.4; }
    66% { transform: translate(-2%, 3%) scale(0.98); opacity: 0.3; }
    100% { transform: translate(0, 0) scale(1); opacity: 0.2; }
}



.interaction-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
}

.crosshair {
    position: absolute;
    background-color: var(--accent-color);
    pointer-events: none;
    z-index: 5;
    transition: top 0.1s ease-out, left 0.1s ease-out, opacity 0.2s, background-color 0.3s, box-shadow 0.3s;
}

/* Zone Colors for Crosshairs */
.crosshair.flow { background-color: var(--flow-color); }
.crosshair.waste { background-color: var(--waste-color); }
.crosshair.alarm { background-color: var(--alarm-color); }

.crosshair-h {
    left: 0;
    width: 100%;
    height: 1px;
}

.crosshair-v {
    top: 0;
    height: 100%;
    width: 1px;
}

.magnet-point {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: var(--accent-color);
    border: 3px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    pointer-events: none;
    transition: top 0.1s ease-out, left 0.1s ease-out, opacity 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.magnet-point::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.3;
    animation: magnetPulse 1.5s infinite;
}

@keyframes magnetPulse {
    0% { transform: scale(1); opacity: 0.4; }
    100% { transform: scale(3); opacity: 0; }
}

.crosshair.hidden, .magnet-point.hidden {
    opacity: 0;
}

/* X Axis */
.axis-x {
    position: relative;
    height: 100px;
    margin-top: 15px;
    z-index: 20; /* Ensure axes are above for hover */
}

.axis-line-x {
    position: absolute;
    top: 0;
    left: 0;
    right: -20px;
    height: 2px;
    background-color: var(--border-color);
}

.axis-arrow-x {
    position: absolute;
    right: -25px;
    top: -4px;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 10px solid var(--border-color);
}

.axis-label-x {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 1px;
    margin-top: 50px;
}

.ticks-x {
    display: flex;
    justify-content: space-around;
    width: 100%;
    position: absolute;
    top: 0;
}

.ticks-x .tick {
    position: relative;
    width: 25%;
    text-align: center;
    padding-top: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s;
}

.ticks-x .tick::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    width: 2px;
    height: 10px;
    background-color: var(--border-color);
    transform: translateX(-50%);
}

.ticks-x .tick.active {
    color: var(--accent-color);
    font-weight: 800;
}
.ticks-x .tick.active::before {
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

/* Detail Panel */
.detail-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.03);
}

.detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
    font-style: italic;
    font-size: 1.2rem;
}

.detail-content {
    animation: fadeIn 0.4s ease-out;
}

.hidden { display: none; }

.zone-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.zone-flow { background: var(--flow-bg); color: var(--flow-color); }
.zone-waste { background: var(--waste-bg); color: var(--waste-color); }
.zone-alarm { background: var(--alarm-bg); color: var(--alarm-color); }

.detail-content h2 {
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    font-weight: 700;
}

.description-block {
    margin-bottom: 1.5rem;
}

.description-block h3 {
    font-size: 1rem;
    color: var(--accent-color);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.description-block p {
    line-height: 1.7;
    font-size: 1.2rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1000px) {
    main {
        grid-template-columns: 1fr;
    }
    .detail-panel {
        order: -1;
        margin-bottom: 2rem;
    }
}
