/* General Body and HTML Reset */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f7f6; /* Light background */
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
    min-height: 100vh; /* Full viewport height */
}

.container {
    max-width: 400px; /* For login/register forms */
    width: 90%;
    margin: 50px auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Header Styling */
header {
    width: 100%;
    background-color: #2c3e50; /* Dark blue/grey */
    color: #ecf0f1; /* Light text */
    padding: 15px 0;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 20px;
    padding-right: 20px;
}

header h1 {
    margin: 0;
    font-size: 1.8em;
}

header a {
    color: #ffda6a; /* Lighter yellow for logout link */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

header a:hover {
    color: #ffd14d;
}

/* Login/Register Form Specifics */
.login-register-form {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    margin: 50px auto;
    box-sizing: border-box; /* Include padding in width */
}

.login-register-form h2 {
    color: #34495e; /* Darker blue/grey */
    margin-bottom: 25px;
    font-size: 1.8em;
}

.login-register-form input[type="text"],
.login-register-form input[type="password"] {
    width: calc(100% - 20px); /* Adjust for padding */
    padding: 12px 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 1em;
}

.login-register-form button[type="submit"] {
    width: 100%;
    padding: 12px 15px;
    background-color: #28a745; /* Green for submit */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-register-form button[type="submit"]:hover {
    background-color: #218838; /* Darker green on hover */
}

.login-register-form p {
    margin-top: 20px;
    font-size: 0.9em;
    color: #666;
}

.login-register-form p a {
    color: #007bff; /* Blue link */
    text-decoration: none;
    font-weight: bold;
}

.login-register-form p a:hover {
    text-decoration: underline;
}

/* Message styling (for login/register feedback) */
.message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    font-weight: bold;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Input Form Container (for Add Reading and Averages sections) */
.input-form-container {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    margin: 20px auto; /* Centered with vertical spacing */
    width: 90%; /* Responsive width */
    max-width: 500px; /* Max width for input form */
    box-sizing: border-box;
}

.input-form-container h2 {
    color: #34495e;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.6em;
}

.input-form-container input[type="number"],
.input-form-container textarea {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    box-sizing: border-box;
}

.input-form-container textarea {
    resize: vertical; /* Allow vertical resizing */
    min-height: 60px;
    max-height: 120px;
}

.input-form-container button {
    width: 100%;
    padding: 12px 15px;
    background-color: #007bff; /* Blue for add button */
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.input-form-container button:hover {
    background-color: #0056b3; /* Darker blue on hover */
}

/* Main Content Layout (Calendar and List side-by-side) */
.main-content-layout {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 20px; /* Space between calendar and list */
    justify-content: center;
    width: 90%;
    max-width: 1200px; /* Max width for the entire application content */
    margin: 20px auto;
}

.main-content-layout > div {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    flex: 1; /* Allow items to grow and shrink */
    min-width: 300px; /* Minimum width before wrapping */
    box-sizing: border-box;
}

.main-content-layout h2,
#chart-section h2 {
    color: #34495e;
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.6em;
}

/* Calendar Section */
#calendar-section {
    /* Specific styles for calendar if needed, otherwise inherits from main-content-layout > div */
}

/* FullCalendar Overrides (adjust as needed for specific themes) */
.fc .fc-button {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}
.fc .fc-button:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}
.fc .fc-daygrid-event {
    background-color: #28a745; /* Green for events */
    border-color: #28a745;
    color: white; /* Ensure text is visible */
}
.fc .fc-daygrid-event:hover {
    background-color: #218838;
    border-color: #218838;
}

/* Reading History List */
#reading-list {
    list-style: none;
    padding: 0;
    margin-top: 0;
    max-height: 400px; /* Max height for scrolling */
    overflow-y: auto; /* Enable vertical scrolling */
    border: 1px solid #eee;
    border-radius: 5px;
}

#reading-list li {
    background-color: #fbfdff; /* Light background for list items */
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95em;
    border-left: 5px solid transparent; /* For category color */
}

/* Category-specific styling for reading list items */
.category-normal { border-left-color: #28a745; /* Green */ }
.category-elevated { border-left-color: #ffc107; /* Yellow */ }
.category-hypertension-stage-1 { border-left-color: #fd7e14; /* Orange */ }
.category-hypertension-stage-2 { border-left-color: #dc3545; /* Red */ }
.category-hypertensive-crisis { border-left-color: #6f42c1; /* Purple/Crisis */ }
.category-uncategorized { border-left-color: #6c757d; /* Grey */ }


/* Chart Section */
#chart-section {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    margin: 20px auto;
    width: 90%;
    max-width: 900px; /* Max width for chart */
    box-sizing: border-box;
}

/* --- Averages Section Styling --- */
#averages-section {
    /* Inherits general card styling from .input-form-container */
    display: flex; /* Make it a flex container */
    flex-direction: column; /* Stack timeframe groups vertically */
    gap: 20px; /* Space between timeframe groups */
    margin: 20px auto; /* Centered with vertical spacing */
    width: 90%; /* Responsive width */
    max-width: 600px; /* Max width for averages section */
    box-sizing: border-box;
}

.average-group {
    background-color: #f8fcfc; /* Slightly different background for each group */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.average-group h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #007bff; /* Blue for the timeframe titles */
    font-size: 1.2em;
    text-align: center;
}

.average-group p {
    margin: 5px 0;
    font-size: 1em;
    color: #333;
    display: flex;
    justify-content: space-between; /* Space out the label and the value */
}

.average-group p span {
    font-weight: bold;
    color: #2c3e50; /* Darker color for the actual average numbers */
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 15px 10px;
    }
    header h1 {
        margin-bottom: 10px;
    }
    .main-content-layout {
        flex-direction: column; /* Stack calendar and list vertically */
        align-items: center;
        width: 95%;
    }
    .main-content-layout > div,
    #input-section,
    #chart-section,
    #averages-section {
        width: 95%; /* Wider on smaller screens */
        margin: 10px auto;
        padding: 20px;
    }
    .input-form-container input[type="number"],
    .input-form-container textarea {
        width: calc(100% - 20px);
    }
}

@media (max-width: 600px) {
    .login-register-form,
    .input-form-container {
        padding: 20px;
    }
    .login-register-form h2,
    .input-form-container h2,
    .main-content-layout h2,
    #chart-section h2 {
        font-size: 1.4em;
    }
    .average-group {
        padding: 10px 15px;
    }
    .average-group h3 {
        font-size: 1.1em;
    }
    .average-group p {
        font-size: 0.9em;
    }
}