/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', 'Monaco', monospace;
    background: #0a0e27;
    color: #00ff41;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

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

/* Header - Terminal Style */
header {
    background: #1a1e3a;
    border: 2px solid #00ff41;
    border-radius: 10px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
    position: relative;
}

header::before {
    content: '$ greenhouse-monitor.sh';
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 0.85em;
    color: #00ff41;
    opacity: 0.7;
}

header h1 {
    font-size: 2.5em;
    color: #00ff41;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    font-weight: normal;
}

.subtitle {
    color: #64f4ac;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 255, 65, 0.1);
    padding: 8px 15px;
    border-radius: 5px;
    border: 1px solid #00ff41;
    font-weight: 600;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: #00ff41;
    box-shadow: 0 0 10px #00ff41;
}

.status-dot.offline {
    background: #ff0051;
    box-shadow: 0 0 10px #ff0051;
    animation: none;
}

.status-dot.firebase-active {
    background: #ffbd2e;
    box-shadow: 0 0 20px #ffbd2e, 0 0 30px #ffbd2e;
    animation: flash 0.3s ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes flash {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 10px #ffbd2e;
    }
    50% { 
        transform: scale(1.3);
        box-shadow: 0 0 30px #ffbd2e, 0 0 40px #ffbd2e;
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 10px #ffbd2e;
    }
}

/* Cards Grid - Terminal Windows */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Card - Terminal Window Style */
.card {
    background: #1a1e3a;
    border: 2px solid #00ff41;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 10px;
    width: 12px;
    height: 12px;
    background: #ff0051;
    border-radius: 50%;
    box-shadow: 15px 0 0 #ffbd2e, 30px 0 0 #00ff41;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.4);
    border-color: #64f4ac;
}

.card-large {
    grid-column: span 2;
}

.card-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
    filter: grayscale(100%) brightness(2);
}

.card-content {
    margin-top: 10px;
}

.card-content h3 {
    color: #64f4ac;
    font-size: 0.9em;
    font-weight: normal;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.value-display {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
}

.value {
    font-size: 2.8em;
    font-weight: bold;
    color: #00ff41;
    line-height: 1;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    font-family: 'Courier New', monospace;
}

.unit {
    color: #64f4ac;
    font-size: 1.2em;
    opacity: 0.8;
    font-weight: normal;
}

/* Progress Bar - Terminal Style */
.progress-bar {
    width: 100%;
    height: 25px;
    background: #0a0e27;
    border: 1px solid #00ff41;
    border-radius: 5px;
    overflow: hidden;
    margin: 15px 0 10px 0;
    position: relative;
}

.progress-bar::before {
    content: '[';
    position: absolute;
    left: 5px;
    color: #00ff41;
    z-index: 2;
}

.progress-bar::after {
    content: ']';
    position: absolute;
    right: 5px;
    color: #00ff41;
    z-index: 2;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #00ff41 0%, #64f4ac 100%);
    transition: width 0.5s ease, background 0.5s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 3px;
    height: 100%;
    background: #fff;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.raw-value {
    color: #64f4ac;
    font-size: 0.85em;
    opacity: 0.7;
}

/* Pump Control Card - Special Terminal Style */
.card-control {
    background: linear-gradient(135deg, #1a1e3a 0%, #0a0e27 100%);
    border-color: #ff0051;
}

.card-control:hover {
    border-color: #ff0051;
    box-shadow: 0 0 25px rgba(255, 0, 81, 0.4);
}

.card-control .card-content h3 {
    color: #ff0051;
}

/* Mode Toggle Buttons */
.mode-toggle {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.btn-mode {
    flex: 1;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: 600;
    border: 2px solid #64f4ac;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    background: rgba(100, 244, 172, 0.1);
    color: #64f4ac;
}

.btn-mode:hover {
    background: rgba(100, 244, 172, 0.2);
    transform: translateY(-2px);
}

.btn-mode.active {
    background: #00ff41;
    color: #0a0e27;
    border-color: #00ff41;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
}

/* Status Row - OFF and Button side by side */
.status-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
}

#manualControls {
    flex: 0 0 auto;
}

.pump-status {
    font-size: 2em;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 5px;
    border: 2px solid #00ff41;
    background: rgba(0, 255, 65, 0.1);
    color: #00ff41;
    font-family: 'Courier New', monospace;
    flex: 0 0 auto;
    cursor: default;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
}

.pump-status.on {
    border-color: #ff0051;
    background: rgba(255, 0, 81, 0.15);
    color: #ff0051;
    box-shadow: 0 0 15px rgba(255, 0, 81, 0.3);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.btn-water-15s {
    font-size: 1.5em;
    font-weight: bold;
    padding: 10px 20px;
    border-radius: 5px;
    border: 2px solid #00ff41;
    background: rgba(0, 255, 65, 0.1);
    color: #00ff41;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.btn-water-15s:hover {
    background: rgba(0, 255, 65, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
    transform: scale(1.05);
}

.auto-hint {
    color: #64f4ac;
    font-size: 1em;
    margin: 0;
    padding: 0;
    display: inline-block;
}

.auto-mode-container {
    margin: 20px 0;
    padding: 15px;
    border: 2px solid #64f4ac;
    border-radius: 8px;
    background: rgba(100, 244, 172, 0.05);
    transition: opacity 0.3s;
    display: block;
}

.threshold-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.threshold-input {
    width: 70px;
    padding: 8px 12px;
    font-size: 1.2em;
    font-family: 'Courier New', monospace;
    background: #1a1e3a;
    border: 2px solid #00ff41;
    border-radius: 5px;
    color: #00ff41;
    text-align: center;
}

.threshold-input:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.4);
}

.threshold-unit {
    color: #64f4ac;
    font-size: 1.2em;
}

.btn-threshold {
    padding: 8px 20px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    background: rgba(0, 255, 65, 0.1);
    border: 2px solid #00ff41;
    border-radius: 5px;
    color: #00ff41;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.btn-threshold:hover {
    background: rgba(0, 255, 65, 0.3);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.4);
    transform: translateY(-2px);
}

.timer-display {
    color: #ffbd2e;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 10px;
    text-align: center;
    display: none;
}

.btn-pump-off {
    background: rgba(0, 255, 65, 0.1);
    color: #00ff41;
    border-color: #00ff41;
}

.btn-pump-off:hover {
    background: rgba(0, 255, 65, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.4);
    transform: scale(1.05);
}

.btn-pump-on {
    background: rgba(255, 0, 81, 0.1);
    color: #ff0051;
    border-color: #ff0051;
}

.btn-pump-on:hover {
    background: rgba(255, 0, 81, 0.3);
    box-shadow: 0 0 20px rgba(255, 0, 81, 0.4);
    transform: scale(1.05);
}

.pump-hint {
    color: #64f4ac;
    font-size: 0.85em;
    margin-top: 10px;
    opacity: 0.7;
}

/* Info Box - Terminal Output Style */
.info-box {
    background: #1a1e3a;
    border: 2px solid #00ff41;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.2);
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    font-family: 'Courier New', monospace;
}

.info-box p {
    color: #64f4ac;
    font-weight: 600;
}

.info-box span {
    color: #00ff41;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
}

/* Footer - Terminal Prompt Style */
footer {
    text-align: center;
    color: #64f4ac;
    padding: 20px;
    background: #1a1e3a;
    border: 2px solid #00ff41;
    border-radius: 8px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

footer::before {
    content: 'mimis@greenhouse:~$ ';
    color: #00ff41;
}

/* ========== CHARTS SECTION ========== */
.charts-section {
    margin: 30px 0;
    padding: 25px;
    background: linear-gradient(135deg, #1a1e3a 0%, #0d1025 100%);
    border: 2px solid #00ff41;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.2);
}

.charts-title {
    color: #00ff41;
    font-size: 1.8em;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
    font-family: 'Courier New', monospace;
}

.charts-title::before {
    content: '📊 ';
}

.chart-container {
    background: #0d1025;
    border: 2px solid #00ff41;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0, 255, 65, 0.1);
    height: 300px;
}

.chart-container:last-child {
    margin-bottom: 0;
}

.chart-title {
    color: #00ff41;
    font-size: 1.2em;
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.5);
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.chart-container canvas {
    max-height: 240px;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .card-large {
        grid-column: span 1;
    }

    .chart-container {
        height: 250px;
    }

    .chart-container canvas {
        max-height: 190px;
    }
    
    .info-box {
        flex-direction: column;
        text-align: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0a0e27;
}

::-webkit-scrollbar-thumb {
    background: #00ff41;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64f4ac;
}

/* Selection */
::selection {
    background: #00ff41;
    color: #0a0e27;
}

/* Cursor Animation */
@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.auto-mode-container {
    margin: 20px 0;
    padding: 15px;
    border: 2px solid #64f4ac;
    border-radius: 8px;
    background: rgba(100, 244, 172, 0.05);
    transition: opacity 0.3s;
    display: block;
}

.copyright-info {
    font-size: 0.95em;
    color: #00ff41;
    margin-top: 4px;
}
