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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.add-habit-section, .habits-section, .stats-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.add-habit-section h2, .habits-section h2, .stats-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
}

#habitForm {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#habitForm input {
    flex: 1;
    min-width: 200px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 16px;
}

#habitForm input:focus {
    outline: none;
    border-color: #667eea;
}

#habitForm button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.2s;
}

#habitForm button:hover {
    transform: translateY(-2px);
}

.loading, .error {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin: 10px 0;
}

.loading {
    background: #e6f3ff;
    color: #0066cc;
}

.error {
    background: #ffe6e6;
    color: #cc0000;
}

.habit-card {
    background: #f8fafc;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}

.habit-card:hover {
    transform: translateX(5px);
}

.habit-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.habit-info h3 {
    color: #2d3748;
    margin-bottom: 5px;
}

.habit-info p {
    color: #718096;
    font-size: 14px;
}

.delete-habit {
    background: #e53e3e;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.delete-habit:hover {
    background: #c53030;
}

.week-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.day-cell {
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    background: #f1f5f9;
    cursor: pointer;
    transition: all 0.2s;
}

.day-cell:hover {
    background: #e2e8f0;
}

.day-cell.completed {
    background: linear-gradient(135deg, #48bb78, #38a169);
    color: white;
}

.day-cell .date {
    font-weight: 600;
    margin-bottom: 5px;
}

.day-cell .day {
    font-size: 12px;
    opacity: 0.7;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-card .number {
    font-size: 2em;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card .label {
    font-size: 0.8em;
    opacity: 0.8;
}

.progress-bar {
    background: #e2e8f0;
    height: 8px;
    border-radius: 4px;
    margin-top: 10px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(135deg, #48bb78, #38a169);
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    #habitForm {
        flex-direction: column;
    }
    
    .habit-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .week-calendar {
        grid-template-columns: repeat(7, 1fr);
        gap: 5px;
    }
    
    .day-cell {
        padding: 8px 4px;
        font-size: 12px;
    }
}
