:root {
    /* --- ORIGINAL LIGHT THEME VARIABLES --- */
    --primary-green: #2e8b57; /* Forest Green Accent */
    --light-green: #e5f9ed; /* Light Green Box Background */
    --primary-text: #222222; /* Dark Gray for high contrast */
    --secondary-text: #666666; /* Muted label text */
    --background: #f4fdf6; /* Very Light Background */
    --card-bg: #ffffff; /* Solid White Cards */
    --shadow: 0 4px 12px rgba(0,0,0,0.1); /* Standard light shadow */
    --border: 1px solid #f0f0f0; /* Very light border */
    --card-radius: 10px;

    /* Status Pill Colors */
    --pill-watered-bg: #e1f5fe;
    --pill-watered-text: #0277bd;
    --pill-trigger-bg: #e8f5e9;
    --pill-trigger-text: #2e7d32;
}

/* Float-in Animation */
@keyframes floatIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

body {
    font-family: 'Segoe UI', sans-serif;
    /* 🔄 Reverted to original light background */
    background-color: var(--background);
    color: var(--primary-text);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

header {
    background-color: var(--primary-green);
    color: white;
    padding: 1.5rem;
    text-align: center;
    opacity: 0;
    animation: floatIn 0.8s ease-out forwards;
    box-shadow: var(--shadow);
}

/* --- Card Styles (Removed Glassmorphism) --- */
#greeting-box, .score-card, .data-card, #plant-recommendations, .prediction-box, .live-indicator, .status-pill {
    background: var(--card-bg); 
    backdrop-filter: none; /* Removed Blur */
    -webkit-backdrop-filter: none;
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: var(--card-radius); 
}

#greeting-box {
    background: var(--light-green); /* Specific light green background for greeting box */
    max-width: 900px;
    margin: 2rem auto 0;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
    opacity: 0;
    animation: floatIn 0.8s ease-out forwards;
    animation-delay: 0.2s; 
}

#greeting-box h2 {
    margin: 0;
    color: var(--primary-green); 
    font-size: 1.8rem;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* --- Live Indicator --- */
.live-indicator {
    color: var(--primary-green);
    background: #fff;
    padding: 5px 12px;
}

.pulse-dot { width: 8px; height: 8px; background-color: #00e676; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 rgba(0, 230, 118, 0.4); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); } 70% { box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); } }

/* --- Logic Stream (Kept High Contrast) --- */
.logic-stream {
    background: #263238; /* Keep dark background for readability */
    color: #00ff41; 
    font-family: 'Courier New', monospace;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    border: none;
}
.logic-label { color: #b0bec5; font-weight: bold; margin-right: 5px; }

/* --- Status Pills --- */
.status-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.status-pill {
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-text); /* Ensure text is dark */
    box-shadow: none;
    border: none;
}
#last-pump-display { background: var(--pill-watered-bg); color: var(--pill-watered-text); }
#ai-target-display { background: var(--pill-trigger-bg); color: var(--pill-trigger-text); }


/* --- Score Card & Prediction Box Layout FIXES --- */
#score-section-embedded {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    align-self: center;
    min-width: 280px;
    width: fit-content;
}

.score-card {
    padding: 20px;
    text-align: center;
    width: 250px; 
    margin-bottom: 5px; 
}

/* --- Gauge Styles (Score Proximity Fixes maintained) --- */
.gauge-container { position: relative; width: 150px; height: 75px; overflow: hidden; margin: 0 auto; }
.gauge-bg, .gauge-fill { position: absolute; width: 150px; height: 150px; border-radius: 50%; border: 20px solid #f0f0f0; box-sizing: border-box; }
.gauge-fill { border-color: transparent; border-top-color: var(--primary-green); border-right-color: var(--primary-green); transform: rotate(-45deg); transition: transform 1.5s cubic-bezier(0.1, 0.9, 0.2, 1); }

.gauge-cover {
    position: absolute;
    bottom: 0;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 15px; 
    transform: translateY(-8px); 
}

#comfort-score { 
    font-size: 1.8rem; /* Corrected smaller size */
    font-weight: 800; 
    color: var(--primary-text); 
    line-height: 1; 
    margin-bottom: 12px; 
}

.score-label { 
    font-size: 0.75rem; 
    color: var(--secondary-text); 
    margin-top: -12px;
    opacity: 1;
}
span.score-label{
   margin-bottom: -12px;
}
/* Environment Optimal text */
#score-text {
    color: var(--secondary-text);
    font-size: 0.9rem;
    margin-top: 12px;
}
#score-text .fa-star { 
    color: #ffeb3b;
}

/* Prediction Box (Sizing Fix maintained) */
.prediction-box {
    background: var(--card-bg);
    border: var(--border);
    box-shadow: var(--shadow);
    padding: 10px 20px;
    width: 250px; 
    max-width: 250px;
    text-align: center;
    margin-bottom: 15px; 
}

.prediction-box p { margin: 0; font-size: 0.9rem; color: var(--secondary-text); }
.pred-text { font-size: 1.2rem; font-weight: bold; color: var(--primary-green); margin-top: 5px !important; }

/* Data Grid & Cards */
.data-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 2rem;
    gap: 1.5rem;
    margin-bottom: 2rem;
    margin-top: 2rem;
    opacity: 0;
    animation: floatIn 0.8s ease-out forwards;
    animation-delay: 0.4s;
}

.data-card {
    padding: 1.5rem;
    min-width: 250px;
    flex-grow: 1;
    max-width: 300px;
    border-left: 5px solid var(--primary-green);
    color: var(--primary-text);
}
.data-card h3 { color: var(--secondary-text); } 
.data-card p { color: var(--primary-text); } 


#plant-recommendations {
    max-width: 900px;
    margin: 1.5rem auto;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    opacity: 0;
    animation: floatIn 0.8s ease-out forwards;
    animation-delay: 0.6s;
}

.advice-container { display: flex; flex-direction: column; gap: 10px; margin-top: 15px; }
.advice-card { padding: 12px; border-radius: 8px; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); }
.advice-ok { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #2e7d32; }
.advice-warn { background: #fff3e0; color: #ef6c00; border-left: 4px solid #ef6c00; }
.advice-alert { background: #ffebee; color: #c62828; border-left: 4px solid #c62828; }
.advice-info { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1565c0; }


.app-button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: var(--primary-green);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.3s;
}
.app-button:hover { background-color: #2e7d32; } 

footer { text-align: center; color: var(--secondary-text); margin-top: 3rem; padding-bottom: 2rem; }
.chart-container { 
    background-color: var(--card-bg); 
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: 12px; 
    padding: 1rem; 
    height: 350px; 
}
@media (max-width: 900px) { .charts-grid { grid-template-columns: 1fr; } }
#charts-view { 
    padding: 2rem; 
    max-width: 1200px; 
    margin: 0 auto; 
    color: var(--primary-text); 
}

/* 🔄 FIX: Centering and Responsiveness */
.charts-grid { 
    display: grid; 
    /* Adaptive grid: 2 columns when space allows, minimum 400px wide */
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); 
    gap: 2rem; 
    margin-top: 2rem; 
    /* 🆕 FIX: Centers the entire grid contents */
    justify-content: center; 
}

.chart-container { 
    background-color: var(--card-bg); 
    backdrop-filter: blur(10px);
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: 12px; 
    padding: 1rem; 
    height: 350px; /* Fixed height for consistent chart rendering */
    /* Ensure the chart fills the container */
    display: flex;
    justify-content: center;
    align-items: center;
}
