body {
    font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 550px;
    text-align: center;
    box-sizing: border-box;
}

h1 {
    color: #4CAF50;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 600;
}

.add-habit {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.add-habit input[type="text"] {
    flex-grow: 1;
    padding: 14px;
    border: 1px solid #c0c0c0;
    border-radius: 8px;
    font-size: 1.1em;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.add-habit input[type="text"]:focus {
    border-color: #4CAF50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.add-habit button {
    padding: 14px 22px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
    flex-shrink: 0;
}

.add-habit button:hover {
    background-color: #43A047;
    transform: translateY(-1px);
}

.calendar-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    background-color: #f7f7f7;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.calendar-nav button {
    background-color: #616161;
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    transition: background-color 0.3s, transform 0.2s;
}

.calendar-nav button:hover {
    background-color: #424242;
    transform: translateY(-1px);
}

#current-date {
    font-size: 1.4em;
    font-weight: 600;
    color: #555;
    min-width: 120px;
}

.habit-list {
    margin-top: 20px;
    margin-bottom: 40px; /* More space before calendar */
}

.habit-item {
    background-color: #fcfcfc; /* Unified, very light background */
    border: 1px solid #e0e0e0; /* Unified, light border */
    padding: 18px 20px;
    margin-bottom: 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.habit-item.completed {
    background-color: #e6ffe6; /* Light green for completed */
    border-color: #A5D6A7;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.1);
    opacity: 0.9;
}

.habit-item span {
    font-size: 1.15em;
    flex-grow: 1;
    text-align: left;
    color: #333;
    font-weight: 500;
}

.habit-item.completed span {
    text-decoration: line-through;
    color: #66BB6A;
}

.habit-item .complete-btn {
    padding: 10px 18px;
    background-color: #64B5F6;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
    flex-shrink: 0;
    margin-left: 15px;
}

.habit-item .complete-btn:hover {
    background-color: #42A5F5;
    transform: translateY(-1px);
}

.habit-item .complete-btn.mark-completed {
    background-color: #EF5350;
}

.habit-item .complete-btn.mark-completed:hover {
    background-color: #E53935;
}

.no-habits-message {
    color: #888;
    font-style: italic;
    margin-top: 25px;
    font-size: 1.1em;
}

/* Calendar View Styles */
.calendar-view {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.calendar-view h2 {
    font-size: 1.8em;
    color: #4CAF50;
    margin-bottom: 25px;
    font-weight: 600;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr); /* 13 columns for roughly 3 months, or adjust as needed */
    gap: 3px; /* Small gap between cells */
    padding: 10px;
    background-color: #f7f7f7;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    overflow-x: auto; /* Enable scrolling for smaller screens if grid is too wide */
    justify-items: center; /* Center cells horizontally */
}

.calendar-cell {
    width: 25px; /* Fixed size for cells */
    height: 25px;
    border-radius: 3px;
    background-color: #ebedf0; /* Default: no contribution */
    transition: background-color 0.3s ease;
    cursor: help; /* Indicate tooltip on hover */
    position: relative; /* For tooltip positioning */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7em; /* Smaller text for day number if needed */
    color: rgba(0,0,0,0.3); /* Very light grey text */
}

/* Completion levels - similar to GitHub's colors */
.level-0 { background-color: #ebedf0; } /* No activity / very low */
.level-1 { background-color: #9be9a8; } /* Low activity */
.level-2 { background-color: #40c463; } /* Medium activity */
.level-3 { background-color: #30a14e; } /* High activity */
.level-4 { background-color: #216e39; } /* Very high activity / all habits */

/* Tooltip for calendar cells */
.calendar-cell[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%; /* Position above the cell */
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 5px;
    white-space: nowrap;
    font-size: 0.8em;
    z-index: 10;
    pointer-events: none; /* Allows interaction with elements behind it */
}

/* Small arrow for tooltip */
.calendar-cell[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 115%; /* Adjust to sit just above the tooltip */
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    z-index: 10;
    pointer-events: none;
}