/* style.css */

/* Google Fonts - Inter (already in use), Roboto, Open Sans for options */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&family=Roboto:wght@300;400;500;700&family=Open+Sans:wght@300;400;600&display=swap');

body {
    font-family: 'Inter', sans-serif; /* Primary font */
    margin: 0; /* Reset default margin */
    padding: 20px; /* Overall page padding */
    background: linear-gradient(to bottom right, #e0f2f7, #c1e4f0); /* Light blue gradient background */
    color: #333; /* Default text color */
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh; /* Full viewport height */
    line-height: 1.6; /* Improved readability for text */
    box-sizing: border-box; /* Include padding and border in element's total width and height */
}

/* Main Heading */
h1 {
    color: #2c3e50; /* Darker blue for heading */
    margin-bottom: 15px;
    font-size: 2.5rem; /* Larger heading */
    font-weight: 700; /* Bold */
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05); /* Subtle text shadow */
}

p {
    font-size: 1.1rem;
    margin-bottom: 30px;
    text-align: center;
    max-width: 700px; /* Limit paragraph width for readability */
}

/* Control Section Styling */
#controls {
    background-color: #ffffff;
    padding: 25px 30px; /* Increased padding */
    border-radius: 12px; /* More rounded corners */
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); /* Stronger, softer shadow */
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
    gap: 20px; /* Space between items */
    align-items: center;
    justify-content: center; /* Center items horizontally */
    max-width: 900px; /* Max width for controls */
    width: 100%; /* Full width on smaller screens */
    border: 1px solid rgba(0, 0, 0, 0.05); /* Very light border */
}

#controls label {
    font-weight: 600; /* Slightly bolder labels */
    color: #555;
    flex-basis: 120px; /* Give labels a base width */
    text-align: right; /* Align labels to the right */
    padding-right: 10px;
}

#controls input[type="text"],
#controls select,
#controls input[type="date"] {
    flex-grow: 1; /* Allow inputs to grow */
    padding: 12px 18px; /* Slightly more padding */
    border: 1px solid #c0d9e7; /* Softer border color */
    border-radius: 8px; /* More rounded corners */
    font-size: 1.05rem; /* Slightly larger font */
    max-width: 200px; /* Max width for inputs */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08); /* Inner shadow for depth */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -webkit-appearance: none; /* Remove default browser styling for select/date */
    -moz-appearance: none;
    appearance: none;
    background-color: #fdfdfd; /* Light background for inputs */
}

#controls input[type="text"]:focus,
#controls select:focus,
#controls input[type="date"]:focus {
    outline: none;
    border-color: #007bff; /* Highlight on focus */
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 3px rgba(0, 123, 255, 0.25); /* Blue glow */
}

/* Specific styling for select arrow */
#controls select {
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23007bff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.2-6.4H18.4a17.6%2017.6%200%200%200-13.2%206.4%2017.6%2017.6%200%200%200%200%2025.6l128%20128c4.8%204.8%2011.2%206.4%2017.6%206.4s12.8-1.6%2017.6-6.4l128-128c4.8-4.8%206.4-11.2%206.4-17.6-.1-6.4-1.7-12.8-6.5-17.6z%22%2F%3E%3C%2Fsvg%3E');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    padding-right: 35px; /* Make space for the arrow */
}


/* Button Styling */
#fetchDataBtn {
    background-color: #007bff; /* A more vibrant blue */
    color: white;
    padding: 12px 25px; /* More padding */
    border: none;
    border-radius: 8px; /* Rounded corners */
    cursor: pointer;
    font-size: 1.1rem; /* Slightly larger font */
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3); /* Subtle blue shadow */
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    flex-basis: 150px; /* Give button a base width */
}

#fetchDataBtn:hover {
    background-color: #0056b3; /* Darker blue on hover */
    transform: translateY(-2px); /* Slight lift effect */
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4); /* Enhanced shadow on hover */
}

#fetchDataBtn:active {
    transform: translateY(0); /* Press effect */
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.2);
}

/* Chart Container */
#chartContainer {
    background-color: #ffffff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15); /* Consistent shadow */
    width: 95%; /* Responsive width */
    max-width: 900px; /* Max width for larger screens */
    height: 450px; /* Fixed height for the chart area */
    display: flex; /* Use flex to center canvas */
    align-items: center;
    justify-content: center;
    position: relative; /* For potential loading indicator */
    border: 1px solid rgba(0, 0, 0, 0.05); /* Consistent border */
}

canvas {
    max-width: 100%;
    height: 100%;
}

/* Message Box Styling */
#messageBox {
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: bold;
    margin-top: 25px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 700px;
}

.hidden {
    display: none !important;
}

.message-info {
    background-color: #d1ecf1; /* Light blue */
    color: #0c5460; /* Dark blue text */
    border: 1px solid #bee5eb;
}

.message-error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red text */
    border: 1px solid #f5c6cb;
}

/* Footer Styling */
footer {
    margin-top: 40px;
    text-align: center;
    color: #777;
    font-size: 0.9rem;
    padding-bottom: 20px; /* Add some padding at the bottom of the page */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }
    p {
        font-size: 1rem;
    }
    #controls {
        flex-direction: column; /* Stack controls vertically */
        gap: 15px; /* Adjust gap for stacking */
        padding: 20px;
    }
    #controls label {
        text-align: left; /* Align labels to left when stacked */
        width: 100%; /* Full width for labels */
        padding-right: 0;
    }
    #controls input[type="text"],
    #controls select,
    #controls input[type="date"] {
        width: calc(100% - 24px); /* Full width minus padding */
        max-width: none; /* Remove max-width constraint */
    }
    #fetchDataBtn {
        width: 100%; /* Full width button */
        flex-basis: auto; /* Remove base width constraint */
    }
    #chartContainer {
        height: 300px; /* Adjust height for smaller screens */
        padding: 15px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    h1 {
        font-size: 1.8rem;
    }
    #controls {
        padding: 15px;
    }
    #messageBox {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}
