body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

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

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #34495e;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 10px;
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.8em;
}

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

.add-habit input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease;
}

.add-habit input[type="text"]:focus {
    border-color: #3498db;
}

.add-habit button {
    padding: 12px 25px;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

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

.habit-list-container {
    margin-top: 30px;
}

.week-header {
    display: flex;
    justify-content: flex-end; /* Align days to the right, matching habit days */
    padding-left: 200px; /* Offset for habit name column */
    margin-bottom: 10px;
    font-weight: bold;
    color: #555;
}

.week-header .day-label {
    width: 40px; /* Match habit-day width */
    text-align: center;
    margin: 0 5px; /* Match habit-day margin */
}

.habit-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.habit-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.habit-name {
    font-weight: 600;
    color: #2c3e50;
    flex-basis: 200px; /* Fixed width for habit name */
    flex-shrink: 0;
}

.habit-days {
    display: flex;
    gap: 10px; /* Space between day checkboxes */
    flex-grow: 1;
    justify-content: flex-end;
}

.habit-day {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    background-color: #ecf0f1;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.habit-day input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.habit-day .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.habit-day input[type="checkbox"]:checked + .checkmark {
    background-color: #2ecc71;
    border-color: #2ecc71;
}

.habit-day input[type="checkbox"]:checked + .checkmark::after {
    content: '✔';
    color: white;
    font-size: 14px;
    line-height: 1;
}

.habit-day:hover {
    transform: scale(1.05);
}

.habit-day input[type="checkbox"]:checked + .checkmark {
    background-color: #2ecc71;
    border-color: #2ecc71;
}

.habit-day input[type="checkbox"]:focus + .checkmark {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.4);
}

.weekly-stats {
    margin-top: 40px;
    background-color: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.stats-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
}

.stats-item:last-child {
    border-bottom: none;
}

.stats-item .habit-name {
    font-weight: normal;
    color: #555;
}

.stats-item .completion-count {
    font-weight: bold;
    color: #2c3e50;
}
