:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #C8E6C9;
    --accent-color: #FF9800;
    --text-color: #333;
    --text-light: #757575;
    --background-color: #f9f9f9;
    --card-color: #fff;
    --border-color: #e0e0e0;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --heatmap-level-0: #ebedf0;
    --heatmap-level-1: #c6e48b;
    --heatmap-level-2: #7bc96f;
    --heatmap-level-3: #239a3b;
    --heatmap-level-4: #196127;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    padding-bottom: 60px;
}

header {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

section {
    background-color: var(--card-color);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

h1, h2, h3 {
    color: var(--primary-dark);
}

h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

h3 {
    margin-bottom: 0.8rem;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input, textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

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

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

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

.btn-danger:hover {
    background-color: #d32f2f;
}

/* Habits List */
.habit-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.habit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.habit-card-info {
    flex-grow: 1;
}

.habit-card h3 {
    margin-bottom: 0.3rem;
}

.habit-card p {
    color: var(--text-light);
    font-size: 0.9rem;
}

.habit-color-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 15px;
}

.habit-check {
    margin-left: 15px;
}

.habit-check input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

#no-habits-message {
    text-align: center;
    color: var(--text-light);
    padding: 2rem 0;
}

/* Habit Details */
.habit-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.habit-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.habit-actions {
    display: flex;
    gap: 0.5rem;
}

.habit-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    background-color: #f5f5f5;
    padding: 1rem;
    border-radius: 8px;
}

.stat {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-dark);
}

/* Heatmap */
.heatmap-container {
    margin-top: 1rem;
}

.heatmap-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.heatmap {
    display: grid;
    grid-template-columns: auto repeat(7, 1fr);
    gap: 3px;
}

.heatmap-label {
    font-size: 0.8rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap-day {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 2px;
    background-color: var(--heatmap-level-0);
    cursor: pointer;
    transition: transform 0.1s;
}

.heatmap-day:hover {
    transform: scale(1.15);
}

.heatmap-day.level-1 {
    background-color: var(--heatmap-level-1);
}

.heatmap-day.level-2 {
    background-color: var(--heatmap-level-2);
}

.heatmap-day.level-3 {
    background-color: var(--heatmap-level-3);
}

.heatmap-day.level-4 {
    background-color: var(--heatmap-level-4);
}

.heatmap-day.today {
    border: 2px solid var(--accent-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--card-color);
    margin: 10% auto;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: var(--text-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Utility Classes */
.hidden {
    display: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-light);
    font-size: 0.9rem;
    position: fixed;
    bottom: 0;
    width: 100%;
    background-color: var(--card-color);
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .habit-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .heatmap {
        grid-template-columns: auto repeat(7, 1fr);
        gap: 2px;
    }
    
    .heatmap-day {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .habit-details-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .habit-actions {
        width: 100%;
        justify-content: flex-start;
    }
}