:root {
    --primary-color: #00A79D; /* Teal */
    --secondary-color: #f0f7f7; /* Very light mint */
    --text-color: #4A4A4A;
    --heading-color: #2c5d63;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --danger-color: #e57373; /* Softer red */
    --danger-hover-color: #d32f2f;
    --white: #ffffff;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    background-image: url('bg.png');
    background-color: var(--secondary-color);
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed;
}

header { text-align: center; margin-bottom: 2.5rem; }
header h1 { color: var(--heading-color); font-weight: 600; margin-bottom: 0.5rem; }
header i { color: var(--primary-color); }
header p { color: #777; font-size: 1.1rem; }

main { max-width: 800px; margin: 0 auto; display: grid; gap: 25px; }

.card {
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    padding: 25px 30px;
    border-top: 4px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1); }

.card h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--heading-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.card h2 i { margin-right: 10px; }

.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 0.9rem; }
input[type="number"], input[type="datetime-local"] {
    width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px;
    box-sizing: border-box; font-family: 'Poppins', sans-serif; transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
input[type="number"]:focus, input[type="datetime-local"]:focus {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.2);
}

button {
    background-color: var(--primary-color); color: var(--white); border: none; padding: 12px 20px;
    border-radius: 8px; cursor: pointer; font-size: 1rem; font-weight: 600; font-family: 'Poppins', sans-serif;
    display: inline-flex; align-items: center; gap: 8px; transition: background-color 0.3s ease, transform 0.2s ease;
}
button:hover { background-color: #00857b; transform: translateY(-2px); }

.btn-danger { background-color: var(--danger-color); }
.btn-danger:hover { background-color: var(--danger-hover-color); }

#history-log { margin-bottom: 15px; }
#history-log table { width: 100%; border-collapse: collapse; }
#history-log th, #history-log td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border-color); }
#history-log th { background-color: var(--secondary-color); font-weight: 600; color: var(--heading-color); }
#history-log tbody tr:nth-of-type(even) { background-color: #f9f9f9; }
#history-log tbody tr:hover { background-color: #e8f5e9; }

/* --- Corrected Chart and Control Styles --- */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* This replaces the h2 border for a cleaner look */
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 10px;
}
.card-header h2 {
    margin-bottom: 0;
    border-bottom: none; /* Remove border from h2 itself */
    padding-bottom: 0;
}
.chart-controls { display: flex; gap: 8px; }
.time-range-btn {
    background-color: #f0f0f0; color: var(--text-color); padding: 6px 12px;
    border: 1px solid var(--border-color); border-radius: 6px; font-size: 0.85rem;
}
.time-range-btn:hover { background-color: #e0e0e0; border-color: #c0c0c0; }
.time-range-btn.active {
    background-color: var(--primary-color); color: var(--white); border-color: var(--primary-color);
}
/* Ensure chart is responsive */
.chart-container { position: relative; height: 300px; }

footer { text-align: center; margin-top: 3rem; color: #999; font-size: 0.9rem; }
/* --- New styles for Card Actions and Export Button --- */

.card-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between; /* Puts buttons on opposite ends */
    flex-wrap: wrap; /* Allows buttons to stack on small screens */
    gap: 10px;
}

.btn-secondary {
    background-color: #6c757d; /* A neutral gray */
    color: var(--white);
}

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